public void onPageScrollStateChanged(int state) {
    mScrollState = state;

    if (mListener != null) {
      mListener.onPageScrollStateChanged(state);
    }
  }
 @Override
 public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
   if (mUserOnPageChangeListener != null) {
     mUserOnPageChangeListener.onPageScrolled(
         position, positionOffset, positionOffsetPixels);
   }
 }
  @Result(FlickrApi.LOAD_IMAGES_EVENT)
  private void onPhotosLoaded(List<Photo> photos, boolean hasMore) {
    mPhotoCount = photos.size();
    mGridAdapter.setPhotos(photos, hasMore);
    mPagerAdapter.setPhotos(photos);
    mGridAdapter.onNextItemsLoaded();

    // Ensure listener called for 0 position
    mPagerListener.onPageSelected(mViews.pager.getCurrentItem());

    // Restoring saved state
    if (mPagerPhotoPosition != -1) {
      if (mPagerPhotoPosition < mPhotoCount) {
        mPagerAdapter.setActivated(true);
        mAnimator.enter(mPagerPhotoPosition, false);
      }
      mPagerPhotoPosition = -1;
    }

    if (mGridPosition != -1) {
      if (mGridPosition < mPhotoCount) {
        ((GridLayoutManager) mViews.grid.getLayoutManager())
            .scrollToPositionWithOffset(mGridPosition, mGridPositionFromTop);
      }
      mGridPosition = -1;
      mGridPositionFromTop = 0;
    }
  }
Example #4
0
  @Override
  public void onClick(android.view.View v) {
    int position = (Integer) v.getTag();
    if (position == mSelectedPosition && mListener != null) mListener.onPageSelected(position);

    mViewPager.setCurrentItem(position, true);
  }
 @Override
 public void onPageSelected(int arg0) {
   setCurrentItem(arg0);
   if (mListener != null) {
     mListener.onPageSelected(arg0);
   }
 }
 @Override
 public void onPageSelected(int position) {
   mCurrentPagePosition = position;
   replaceTitle(getTitle());
   if (mUserOnPageChangeListener != null) {
     mUserOnPageChangeListener.onPageSelected(position);
   }
 }
 public void onPageScrolled(int paramInt1, float paramFloat, int paramInt2) {
   h = paramInt1;
   j = paramFloat;
   invalidate();
   if (g != null) {
     g.onPageScrolled(paramInt1, paramFloat, paramInt2);
   }
 }
Example #8
0
  @Override
  public void onPageSelected(int position) {
    mCurrentPage = position;
    invalidate();

    if (mListener != null) {
      mListener.onPageSelected(position);
    }
  }
  public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
    mCurrentPage = position;
    mPageOffset = positionOffset;
    invalidate();

    if (mListener != null) {
      mListener.onPageScrolled(position, positionOffset, positionOffsetPixels);
    }
  }
  public void onPageSelected(int position) {
    if (mScrollState == ViewPager.SCROLL_STATE_IDLE) {
      mCurrentPage = position;
      invalidate();
    }

    if (mListener != null) {
      mListener.onPageSelected(position);
    }
  }
Example #11
0
  @Override
  public void onPageScrollStateChanged(int state) {
    if (state == ViewPager.SCROLL_STATE_IDLE) {
      mScrolling = false;
      TextView tv = getTabView(mSelectedPosition);
      if (tv != null) updateIndicator(tv.getLeft(), tv.getMeasuredWidth());
    } else mScrolling = true;

    if (mListener != null) mListener.onPageScrollStateChanged(state);
  }
 public void onPageSelected(int paramInt) {
   if ((n) || (k == 0)) {
     h = paramInt;
     i = paramInt;
     invalidate();
   }
   if (g != null) {
     g.onPageSelected(paramInt);
   }
 }
  @Override
  public void onPageSelected(int position) {
    Log.d("xx", "page select : " + position);
    if (mScrollState == ViewPager.SCROLL_STATE_IDLE) {
      mCurrentPage = position;
      invalidate();
    }

    if (mListener != null) {
      mListener.onPageSelected(position);
    }
  }
Example #14
0
 @Override
 public void onPageSelected(int position) {
   if (mScrollState == ViewPager.SCROLL_STATE_IDLE) {
     mCurrentPage = position;
     mPositionOffset = 0;
     invalidate();
     mFadeRunnable.run();
   }
   if (mListener != null) {
     mListener.onPageSelected(position);
   }
 }
Example #15
0
  public void onPageSelected(int position) {

    //
    // get current item position
    //
    int old_position = m_tab_indicator.getCurrentItem();

    //
    // notify on change
    //
    Fragment fragment = m_fragments.get(old_position);
    if (fragment instanceof ViewPager.OnPageChangeListener) {
      ViewPager.OnPageChangeListener listener = (ViewPager.OnPageChangeListener) fragment;
      listener.onPageSelected(position);
    }

    Fragment new_fragment = m_fragments.get(position);
    if (new_fragment instanceof ViewPager.OnPageChangeListener) {
      ViewPager.OnPageChangeListener listener = (ViewPager.OnPageChangeListener) new_fragment;
      listener.onPageSelected(position);
    }

    Logger.i("onPageSelected new_position: " + position + " old position: " + old_position);
  }
Example #16
0
  @Override
  public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
    mCurrentPage = position;
    mPositionOffset = positionOffset;
    if (mFades) {
      if (positionOffsetPixels > 0) {
        removeCallbacks(mFadeRunnable);
        mPaint.setAlpha(0xFF);
      } else if (mScrollState != ViewPager.SCROLL_STATE_DRAGGING) {
        postDelayed(mFadeRunnable, mFadeDelay);
      }
    }
    invalidate();

    if (mListener != null) {
      mListener.onPageScrolled(position, positionOffset, positionOffsetPixels);
    }
  }
Example #17
0
  @Override
  public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
    if (mListener != null) mListener.onPageScrolled(position, positionOffset, positionOffsetPixels);

    CheckedTextView tv_scroll = getTabView(position);
    CheckedTextView tv_next = getTabView(position + 1);

    if (tv_scroll != null && tv_next != null) {
      int width_scroll = tv_scroll.getWidth();
      int width_next = tv_next.getWidth();
      float distance = (width_scroll + width_next) / 2f;

      int width = (int) (width_scroll + (width_next - width_scroll) * positionOffset + 0.5f);
      int offset =
          (int)
              (tv_scroll.getLeft()
                  + width_scroll / 2f
                  + distance * positionOffset
                  - width / 2f
                  + 0.5f);
      updateIndicator(offset, width);
    }
  }
 @Override
 public void onPageScrollStateChanged(int state) {
   if (mUserOnPageChangeListener != null) {
     mUserOnPageChangeListener.onPageScrollStateChanged(state);
   }
 }
 @Override
 public void onPageScrolled(int arg0, float arg1, int arg2) {
   if (mListener != null) {
     mListener.onPageScrolled(arg0, arg1, arg2);
   }
 }
 @Override
 public void onPageScrollStateChanged(int arg0) {
   if (mListener != null) {
     mListener.onPageScrollStateChanged(arg0);
   }
 }
Example #21
0
 @Override
 public void onPageSelected(int position) {
   setCurrentItem(position);
   if (mListener != null) mListener.onPageSelected(position);
 }
 public void onPageScrollStateChanged(int paramInt) {
   k = paramInt;
   if (g != null) {
     g.onPageScrollStateChanged(paramInt);
   }
 }