コード例 #1
0
 @Override
 public int getCurrentItem() {
   int position = super.getCurrentItem();
   if (getAdapter() instanceof InfinitePagerAdapterWrapper) {
     InfinitePagerAdapterWrapper infAdapter = (InfinitePagerAdapterWrapper) getAdapter();
     // Return the actual item position in the data backing InfinitePagerAdapter
     return (position % infAdapter.getRealCount());
   } else {
     return super.getCurrentItem();
   }
 }
コード例 #2
0
 private int getOffsetAmount() {
   if (getAdapter() instanceof InfinitePagerAdapterWrapper) {
     InfinitePagerAdapterWrapper infAdapter = (InfinitePagerAdapterWrapper) getAdapter();
     // allow for 100 back cycles from the beginning
     // should be enough to create an illusion of infinity
     // warning: scrolling to very high values (1,000,000+) results in
     // strange drawing behaviour
     return infAdapter.getRealCount() * 100;
   } else {
     return 0;
   }
 }