|
|
@@ -157,18 +157,22 @@ public class KPIFragment extends Fragment implements KPICell.KPIListener {
|
|
|
|
|
|
@Override
|
|
|
public void onPageSelected(int position) {
|
|
|
+
|
|
|
+ currentKPI = position;
|
|
|
+ int display_index = currentKPI;
|
|
|
Log.d("KPI", "onPageSelected: " + position);
|
|
|
if (position == 0) {
|
|
|
- currentKPI = totalKPI;
|
|
|
- mKPIPager.setCurrentItem(currentKPI,false);
|
|
|
+ display_index = totalKPI;
|
|
|
+// mKPIPager.setCurrentItem(currentKPI,false);
|
|
|
} else if (position == totalKPI + 1) {
|
|
|
- currentKPI = 1;
|
|
|
- mKPIPager.setCurrentItem(currentKPI,false);
|
|
|
- } else {
|
|
|
- currentKPI = position;
|
|
|
+ display_index = 1;
|
|
|
+// mKPIPager.setCurrentItem(currentKPI,false);
|
|
|
+ } else
|
|
|
+ {
|
|
|
+ display_index = position;
|
|
|
}
|
|
|
if (mScrollListener != null) {
|
|
|
- mScrollListener.KPIPagerDidScrollToPage(currentKPI);
|
|
|
+ mScrollListener.KPIPagerDidScrollToPage(display_index);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
@@ -176,7 +180,16 @@ public class KPIFragment extends Fragment implements KPICell.KPIListener {
|
|
|
@Override
|
|
|
public void onPageScrollStateChanged(int state) {
|
|
|
Log.d("KPI", "onPageScrollStateChanged: " + state);
|
|
|
- }
|
|
|
+
|
|
|
+ if (state == ViewPager.SCROLL_STATE_IDLE) {
|
|
|
+ if (currentKPI == mKPIPager.getAdapter().getCount() - 1) {
|
|
|
+ mKPIPager.setCurrentItem(1, false);
|
|
|
+ }
|
|
|
+ else if (currentKPI == 0) {
|
|
|
+ mKPIPager.setCurrentItem(mKPIPager.getAdapter().getCount() - 2, false);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
});
|
|
|
|
|
|
mSwipeRefresh.setEnabled(true);
|
|
|
@@ -223,7 +236,8 @@ public class KPIFragment extends Fragment implements KPICell.KPIListener {
|
|
|
if (show) {
|
|
|
// bar.setDisplayShowTitleEnabled(true);
|
|
|
if (totalKPI > 0) {
|
|
|
- ((Activity)ctx).setTitle(currentKPI + "/" + totalKPI);
|
|
|
+ int display_index = currentKPI % mKPIArr.size()==0?mKPIArr.size():currentKPI % mKPIArr.size();
|
|
|
+ ((Activity)ctx).setTitle(display_index + "/" + totalKPI);
|
|
|
} else {
|
|
|
((Activity)ctx).setTitle(null);
|
|
|
}
|