Loading core/java/android/widget/AbsListView.java +7 −9 Original line number Diff line number Diff line Loading @@ -1207,15 +1207,13 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te */ public void setFastScrollEnabled(boolean enabled) { mFastScrollEnabled = enabled; if (enabled) { if (mFastScroller == null) { if (enabled && mFastScroller == null) { mFastScroller = new FastScroller(getContext(), this); } } else { if (mFastScroller != null) { mFastScroller.stop(); mFastScroller = null; } mFastScroller.setEnabled(enabled); } } Loading core/java/android/widget/FastScroller.java +45 −13 Original line number Diff line number Diff line Loading @@ -175,6 +175,9 @@ class FastScroller { /** Whether decorations should be laid out from right to left. */ private boolean mLayoutFromRight; /** Whether the fast scroller is enabled. */ private boolean mEnabled; /** Whether the scrollbar and decorations should always be shown. */ private boolean mAlwaysShow; Loading Loading @@ -301,6 +304,39 @@ class FastScroller { mList.postDelayed(mDeferHide, FADE_TIMEOUT); } /** * Removes this FastScroller overlay from the host view. */ public void remove() { mOverlay.remove(mTrackImage); mOverlay.remove(mThumbImage); mOverlay.remove(mPreviewImage); mOverlay.remove(mPrimaryText); mOverlay.remove(mSecondaryText); } /** * @param enabled Whether the fast scroll thumb is enabled. */ public void setEnabled(boolean enabled) { mEnabled = enabled; if (enabled) { if (mAlwaysShow) { setState(STATE_VISIBLE); } } else { stop(); } } /** * @return Whether the fast scroll thumb is enabled. */ public boolean isEnabled() { return mEnabled; } /** * @param alwaysShow Whether the fast scroll thumb should always be shown */ Loading Loading @@ -329,18 +365,6 @@ class FastScroller { setState(STATE_NONE); } /** * @return Whether the fast scroll thumb should be shown. */ public boolean shouldShow() { // Don't show if the list is as tall as or shorter than the thumbnail. if (mList.getHeight() <= mThumbImage.getHeight()) { return false; } return true; } public void setScrollbarPosition(int position) { if (position == View.SCROLLBAR_POSITION_DEFAULT) { position = mList.isLayoutRtl() ? Loading Loading @@ -696,7 +720,7 @@ class FastScroller { } public void onScroll(int firstVisibleItem, int visibleItemCount, int totalItemCount) { if (!mAlwaysShow && !isLongList(visibleItemCount, totalItemCount)) { if (!mEnabled || !mAlwaysShow && !isLongList(visibleItemCount, totalItemCount)) { setState(STATE_NONE); return; } Loading Loading @@ -1106,6 +1130,10 @@ class FastScroller { } public boolean onInterceptTouchEvent(MotionEvent ev) { if (!mEnabled) { return false; } switch (ev.getActionMasked()) { case MotionEvent.ACTION_DOWN: if (isPointInside(ev.getX(), ev.getY())) { Loading Loading @@ -1134,6 +1162,10 @@ class FastScroller { } public boolean onTouchEvent(MotionEvent me) { if (!mEnabled) { return false; } switch (me.getActionMasked()) { case MotionEvent.ACTION_DOWN: { if (isPointInside(me.getX(), me.getY())) { Loading Loading
core/java/android/widget/AbsListView.java +7 −9 Original line number Diff line number Diff line Loading @@ -1207,15 +1207,13 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te */ public void setFastScrollEnabled(boolean enabled) { mFastScrollEnabled = enabled; if (enabled) { if (mFastScroller == null) { if (enabled && mFastScroller == null) { mFastScroller = new FastScroller(getContext(), this); } } else { if (mFastScroller != null) { mFastScroller.stop(); mFastScroller = null; } mFastScroller.setEnabled(enabled); } } Loading
core/java/android/widget/FastScroller.java +45 −13 Original line number Diff line number Diff line Loading @@ -175,6 +175,9 @@ class FastScroller { /** Whether decorations should be laid out from right to left. */ private boolean mLayoutFromRight; /** Whether the fast scroller is enabled. */ private boolean mEnabled; /** Whether the scrollbar and decorations should always be shown. */ private boolean mAlwaysShow; Loading Loading @@ -301,6 +304,39 @@ class FastScroller { mList.postDelayed(mDeferHide, FADE_TIMEOUT); } /** * Removes this FastScroller overlay from the host view. */ public void remove() { mOverlay.remove(mTrackImage); mOverlay.remove(mThumbImage); mOverlay.remove(mPreviewImage); mOverlay.remove(mPrimaryText); mOverlay.remove(mSecondaryText); } /** * @param enabled Whether the fast scroll thumb is enabled. */ public void setEnabled(boolean enabled) { mEnabled = enabled; if (enabled) { if (mAlwaysShow) { setState(STATE_VISIBLE); } } else { stop(); } } /** * @return Whether the fast scroll thumb is enabled. */ public boolean isEnabled() { return mEnabled; } /** * @param alwaysShow Whether the fast scroll thumb should always be shown */ Loading Loading @@ -329,18 +365,6 @@ class FastScroller { setState(STATE_NONE); } /** * @return Whether the fast scroll thumb should be shown. */ public boolean shouldShow() { // Don't show if the list is as tall as or shorter than the thumbnail. if (mList.getHeight() <= mThumbImage.getHeight()) { return false; } return true; } public void setScrollbarPosition(int position) { if (position == View.SCROLLBAR_POSITION_DEFAULT) { position = mList.isLayoutRtl() ? Loading Loading @@ -696,7 +720,7 @@ class FastScroller { } public void onScroll(int firstVisibleItem, int visibleItemCount, int totalItemCount) { if (!mAlwaysShow && !isLongList(visibleItemCount, totalItemCount)) { if (!mEnabled || !mAlwaysShow && !isLongList(visibleItemCount, totalItemCount)) { setState(STATE_NONE); return; } Loading Loading @@ -1106,6 +1130,10 @@ class FastScroller { } public boolean onInterceptTouchEvent(MotionEvent ev) { if (!mEnabled) { return false; } switch (ev.getActionMasked()) { case MotionEvent.ACTION_DOWN: if (isPointInside(ev.getX(), ev.getY())) { Loading Loading @@ -1134,6 +1162,10 @@ class FastScroller { } public boolean onTouchEvent(MotionEvent me) { if (!mEnabled) { return false; } switch (me.getActionMasked()) { case MotionEvent.ACTION_DOWN: { if (isPointInside(me.getX(), me.getY())) { Loading