summaryrefslogtreecommitdiffstats
path: root/core/java/android/widget/FastScroller.java
diff options
context:
space:
mode:
authorAdam Powell <adamp@google.com>2010-12-10 14:31:54 -0800
committerAdam Powell <adamp@google.com>2010-12-10 16:31:13 -0800
commit2c6196aa557e4eaf09d1ec3ad1347742f7f9f7b5 (patch)
tree6ee25f653247138409df78c36ee50872498d2fc9 /core/java/android/widget/FastScroller.java
parent4decffa46d3ca17df2c5bbb8ba729c2dba4f6a79 (diff)
downloadframeworks_base-2c6196aa557e4eaf09d1ec3ad1347742f7f9f7b5.zip
frameworks_base-2c6196aa557e4eaf09d1ec3ad1347742f7f9f7b5.tar.gz
frameworks_base-2c6196aa557e4eaf09d1ec3ad1347742f7f9f7b5.tar.bz2
Fix a bug where the fast scroll track would be positioned
incorrectly. Make fast scroll theme attributes public. Fix a bug where always-visible fast scrollers wouldn't appear on small lists. Change-Id: I377adf63d2fe88478f77b0b04466c6ae88557efe
Diffstat (limited to 'core/java/android/widget/FastScroller.java')
-rw-r--r--core/java/android/widget/FastScroller.java19
1 files changed, 14 insertions, 5 deletions
diff --git a/core/java/android/widget/FastScroller.java b/core/java/android/widget/FastScroller.java
index f824ff4..4e3ef0c 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) {