Fix bug 5073637 - Market apps crashing FastScroller
It seems that some popular Market apps do not properly implement SectionIndexer#getSectionForPosition and the framework did not previously call it. Revert to more simplistic scrollbar behavior for apps targeting sdk < Honeycomb. Change-Id: If0b1f2b4db540de4bb8ba45798e498c09cddb42f
This commit is contained in:
@@ -116,6 +116,8 @@ class FastScroller {
|
||||
|
||||
private int mOverlayPosition;
|
||||
|
||||
private boolean mMatchDragPosition;
|
||||
|
||||
private static final int FADE_TIMEOUT = 1500;
|
||||
|
||||
private final Rect mTmpRect = new Rect();
|
||||
@@ -262,6 +264,9 @@ class FastScroller {
|
||||
|
||||
ta.recycle();
|
||||
|
||||
mMatchDragPosition = context.getApplicationInfo().targetSdkVersion >=
|
||||
android.os.Build.VERSION_CODES.HONEYCOMB;
|
||||
|
||||
setScrollbarPosition(mList.getVerticalScrollbarPosition());
|
||||
}
|
||||
|
||||
@@ -417,7 +422,7 @@ class FastScroller {
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (totalItemCount - visibleItemCount > 0 && mState != STATE_DRAGGING ) {
|
||||
if (totalItemCount - visibleItemCount > 0 && mState != STATE_DRAGGING) {
|
||||
mThumbY = getThumbPositionForListPosition(firstVisibleItem, visibleItemCount,
|
||||
totalItemCount);
|
||||
if (mChangedBounds) {
|
||||
@@ -595,7 +600,7 @@ class FastScroller {
|
||||
if (mSectionIndexer == null) {
|
||||
getSectionsFromIndexer();
|
||||
}
|
||||
if (mSectionIndexer == null) {
|
||||
if (mSectionIndexer == null || !mMatchDragPosition) {
|
||||
return ((mList.getHeight() - mThumbH) * firstVisibleItem)
|
||||
/ (totalItemCount - visibleItemCount);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user