diff --git a/api/current.xml b/api/current.xml index fb6b950517cfa..e76bd65d78e90 100644 --- a/api/current.xml +++ b/api/current.xml @@ -4211,6 +4211,50 @@ visibility="public" > + + + + + + + + implements Te } mRecycler.markChildrenDirty(); } + + if (mFastScroller != null && mItemCount != mOldItemCount) { + mFastScroller.onItemCountChanged(mOldItemCount, mItemCount); + } layoutChildren(); mInLayout = false; diff --git a/core/java/android/widget/FastScroller.java b/core/java/android/widget/FastScroller.java index f824ff468d0d0..4e3ef0c2fe2af 100644 --- a/core/java/android/widget/FastScroller.java +++ b/core/java/android/widget/FastScroller.java @@ -307,10 +307,13 @@ class FastScroller { } if (mTrackDrawable != null) { - final int left = mThumbDrawable.getBounds().left; + final Rect thumbBounds = mThumbDrawable.getBounds(); + final int left = thumbBounds.left; + final int halfThumbHeight = (thumbBounds.bottom - thumbBounds.top) / 2; final int trackWidth = mTrackDrawable.getIntrinsicWidth(); - final int trackLeft = (left + mThumbW) / 2 - trackWidth / 2; - mTrackDrawable.setBounds(trackLeft, 0, trackLeft + trackWidth, mList.getHeight()); + final int trackLeft = (left + mThumbW / 2) - trackWidth / 2; + mTrackDrawable.setBounds(trackLeft, halfThumbHeight, + trackLeft + trackWidth, mList.getHeight() - halfThumbHeight); mTrackDrawable.draw(canvas); } @@ -393,13 +396,19 @@ class FastScroller { } } } - + + void onItemCountChanged(int oldCount, int newCount) { + if (mAlwaysShow) { + mLongList = true; + } + } + void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) { // Are there enough pages to require fast scroll? Recompute only if total count changes if (mItemCount != totalItemCount && visibleItemCount > 0) { mItemCount = totalItemCount; - mLongList = mItemCount / visibleItemCount >= MIN_PAGES; + mLongList = mAlwaysShow || mItemCount / visibleItemCount >= MIN_PAGES; } if (!mLongList) { if (mState != STATE_NONE) { diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml index f399578d6908e..181bbcc50aa69 100755 --- a/core/res/res/values/attrs.xml +++ b/core/res/res/values/attrs.xml @@ -520,15 +520,20 @@ - + + + - + - + - + - + diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml index 1f9cb6dbca3a4..6c76f572cd53d 100644 --- a/core/res/res/values/public.xml +++ b/core/res/res/values/public.xml @@ -1403,6 +1403,10 @@ + + + +