コード例 #1
0
 @Override
 public void draw(Canvas canvas) {
   super.draw(canvas);
   if (mFastScroller != null) {
     final int scrollY = getScrollY();
     if (scrollY != 0) {
       int restoreCount = canvas.save();
       canvas.translate(0, scrollY);
       mFastScroller.draw(canvas);
       canvas.restoreToCount(restoreCount);
     } else {
       mFastScroller.draw(canvas);
     }
   }
 }
コード例 #2
0
 @Override
 protected void onSizeChanged(int w, int h, int oldw, int oldh) {
   super.onSizeChanged(w, h, oldw, oldh);
   if (mFastScroller != null) {
     mFastScroller.onSizeChanged(w, h, oldw, oldh);
   }
 }
コード例 #3
0
 @Override
 public boolean isFastScrollAlwaysVisible() {
   if (mForceFastScrollAlwaysVisibleDisable) {
     return false;
   }
   return mFastScrollEnabled && mFastScroller.isAlwaysShowEnabled();
 }
コード例 #4
0
 @Override
 public void setVerticalScrollbarPosition(int position) {
   mVerticalScrollbarPosition = position;
   if (mFastScroller != null) {
     mFastScroller.setScrollbarPosition(position);
   }
   recomputePaddingFromScroller();
 }
コード例 #5
0
 @Override
 protected void onLayout(boolean changed, int l, int t, int r, int b) {
   final int mOldItemCount = getCount();
   super.onLayout(changed, l, t, r, b);
   final int mItemCount = getCount();
   if (mFastScroller != null && mItemCount != mOldItemCount) {
     mFastScroller.onItemCountChanged(mOldItemCount, mItemCount);
   }
 }
コード例 #6
0
 @Override
 public boolean onInterceptTouchEvent(MotionEvent ev) {
   if (!mIsAttached) {
     return false;
   }
   if (mFastScroller != null && mFastScroller.onInterceptTouchEvent(ev)) {
     return true;
   }
   return super.onInterceptTouchEvent(ev);
 }
コード例 #7
0
 @Override
 public int getVerticalScrollbarWidth() {
   mForceFastScrollAlwaysVisibleDisable = true;
   final int superWidth = super.getVerticalScrollbarWidth();
   mForceFastScrollAlwaysVisibleDisable = false;
   if (isFastScrollAlwaysVisible()) {
     return Math.max(superWidth, mFastScroller.getWidth());
   }
   return superWidth;
 }
コード例 #8
0
 void invokeOnItemScrollListener() {
   final int mFirstPosition = getFirstVisiblePosition();
   final int mItemCount = getCount();
   if (mFastScroller != null) {
     mFastScroller.onScroll(this, mFirstPosition, getChildCount(), mItemCount);
   }
   if (mOnScrollListener != null) {
     mOnScrollListener.onScroll(this, mFirstPosition, getChildCount(), mItemCount);
   }
   onScrollChanged(0, 0, 0, 0);
 }
コード例 #9
0
 @Override
 public boolean onTouchEvent(MotionEvent ev) {
   if (!isEnabled()) {
     return isClickable() || isLongClickable();
   }
   if (!mIsAttached) {
     return false;
   }
   if (mFastScroller != null && mFastScroller.onTouchEvent(ev)) {
     return true;
   }
   return super.onTouchEvent(ev);
 }
コード例 #10
0
 @Override
 public void setFastScrollEnabled(boolean enabled) {
   mFastScrollEnabled = enabled;
   if (enabled) {
     if (mFastScroller == null) {
       mFastScroller = new FastScroller(getContext(), this);
     }
   } else {
     if (mFastScroller != null) {
       mFastScroller.stop();
       mFastScroller = null;
     }
   }
 }
コード例 #11
0
 @Override
 public void setFastScrollAlwaysVisible(boolean alwaysShow) {
   if (alwaysShow && !mFastScrollEnabled) {
     setFastScrollEnabled(true);
   }
   if (mFastScroller != null) {
     mFastScroller.setAlwaysShow(alwaysShow);
   }
   try {
     Method method = View.class.getDeclaredMethod("computeOpaqueFlags");
     method.setAccessible(true);
     method.invoke(this);
     method = View.class.getDeclaredMethod("recomputePadding");
     method.setAccessible(true);
     method.invoke(this);
   } catch (Exception e) {
   }
   if (alwaysShow) {
     setPaddingFromScroller(true);
   }
 }
コード例 #12
0
 protected boolean isVerticalScrollBarHidden() {
   return mFastScroller != null && mFastScroller.isVisible();
 }
コード例 #13
0
 @Override
 public void onInvalidated() {
   if (mFastScroller != null) {
     mFastScroller.onSectionsChanged();
   }
 }