|
@@ -154,7 +154,7 @@ public class KPIFragment extends Fragment implements KPICell.KPIListener {
|
|
|
} else {
|
|
} else {
|
|
|
currentKPI = position;
|
|
currentKPI = position;
|
|
|
}
|
|
}
|
|
|
- showTitle(!isHidden());
|
|
|
|
|
|
|
+ showTitle(mContext,!isHidden());
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -185,29 +185,36 @@ public class KPIFragment extends Fragment implements KPICell.KPIListener {
|
|
|
return root;
|
|
return root;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- @Override
|
|
|
|
|
- public void setUserVisibleHint(boolean isVisibleToUser) {
|
|
|
|
|
- super.setUserVisibleHint(isVisibleToUser);
|
|
|
|
|
- showTitle(isVisibleToUser);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- @Override
|
|
|
|
|
- public void onHiddenChanged(boolean hidden) {
|
|
|
|
|
- super.onHiddenChanged(hidden);
|
|
|
|
|
- showTitle(!hidden);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+// @Override
|
|
|
|
|
+// public void setUserVisibleHint(boolean isVisibleToUser) {
|
|
|
|
|
+// super.setUserVisibleHint(isVisibleToUser);
|
|
|
|
|
+// showTitle(isVisibleToUser);
|
|
|
|
|
+// }
|
|
|
|
|
+//
|
|
|
|
|
+// @Override
|
|
|
|
|
+// public void onHiddenChanged(boolean hidden) {
|
|
|
|
|
+// super.onHiddenChanged(hidden);
|
|
|
|
|
+// showTitle(!hidden);
|
|
|
|
|
+// }
|
|
|
|
|
|
|
|
- public void showTitle(boolean show) {
|
|
|
|
|
|
|
+ public void showTitle(Context ctx,boolean show) {
|
|
|
|
|
+ if (ctx == null) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ android.support.v7.app.ActionBar bar = ((RootActivity)ctx).getSupportActionBar();
|
|
|
|
|
+ if (bar == null) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
if (show) {
|
|
if (show) {
|
|
|
- ((RootActivity)mContext).getSupportActionBar().setDisplayShowTitleEnabled(true);
|
|
|
|
|
|
|
+ bar.setDisplayShowTitleEnabled(true);
|
|
|
if (totalKPI > 0) {
|
|
if (totalKPI > 0) {
|
|
|
- ((Activity)mContext).setTitle(currentKPI + "/" + totalKPI);
|
|
|
|
|
|
|
+ ((Activity)ctx).setTitle(currentKPI + "/" + totalKPI);
|
|
|
} else {
|
|
} else {
|
|
|
- ((Activity)mContext).setTitle(null);
|
|
|
|
|
|
|
+ ((Activity)ctx).setTitle(null);
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
- ((RootActivity)mContext).getSupportActionBar().setDisplayShowTitleEnabled(false);
|
|
|
|
|
- ((Activity)mContext).setTitle(null);
|
|
|
|
|
|
|
+ bar.setDisplayShowTitleEnabled(false);
|
|
|
|
|
+ ((Activity)ctx).setTitle(null);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -229,8 +236,8 @@ public class KPIFragment extends Fragment implements KPICell.KPIListener {
|
|
|
outState.putString("KPIData",mData.toString());
|
|
outState.putString("KPIData",mData.toString());
|
|
|
outState.putInt("currentKPI",currentKPI);
|
|
outState.putInt("currentKPI",currentKPI);
|
|
|
}
|
|
}
|
|
|
- mKPIArr.clear();
|
|
|
|
|
- mAdapter.notifyDataSetChanged();
|
|
|
|
|
|
|
+// mKPIArr.clear();
|
|
|
|
|
+// mAdapter.notifyDataSetChanged();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -254,6 +261,16 @@ public class KPIFragment extends Fragment implements KPICell.KPIListener {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void setUserVisibleHint(boolean isVisibleToUser) {
|
|
|
|
|
+ super.setUserVisibleHint(isVisibleToUser);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onHiddenChanged(boolean hidden) {
|
|
|
|
|
+ super.onHiddenChanged(hidden);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
private boolean loading = false;
|
|
private boolean loading = false;
|
|
|
private void loadKPIData() {
|
|
private void loadKPIData() {
|
|
|
|
|
|
|
@@ -283,9 +300,9 @@ public class KPIFragment extends Fragment implements KPICell.KPIListener {
|
|
|
mSwipeRefresh.setRefreshing(false);
|
|
mSwipeRefresh.setRefreshing(false);
|
|
|
}
|
|
}
|
|
|
prepareData();
|
|
prepareData();
|
|
|
- if (mKPIArr != null && mKPIArr.size() > 0) {
|
|
|
|
|
- mKPIPager.setCurrentItem(currentKPI,false);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+// if (mKPIArr != null && mKPIArr.size() > 0) {
|
|
|
|
|
+// mKPIPager.setCurrentItem(currentKPI,false);
|
|
|
|
|
+// }
|
|
|
loading = false;
|
|
loading = false;
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
@@ -378,6 +395,9 @@ public class KPIFragment extends Fragment implements KPICell.KPIListener {
|
|
|
totalKPI = mKPIArr.size();
|
|
totalKPI = mKPIArr.size();
|
|
|
}
|
|
}
|
|
|
mAdapter.notifyDataSetChanged();
|
|
mAdapter.notifyDataSetChanged();
|
|
|
|
|
+ if (mKPIArr != null && mKPIArr.size() > 0) {
|
|
|
|
|
+ mKPIPager.setCurrentItem(currentKPI,false);
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|