Merge "Fix a bug where the fast scroll track would be positioned incorrectly."
This commit is contained in:
@@ -4211,6 +4211,50 @@
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="fastScrollOverlayPosition"
|
||||
type="int"
|
||||
transient="false"
|
||||
volatile="false"
|
||||
value="16843592"
|
||||
static="true"
|
||||
final="true"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="fastScrollPreviewBackgroundLeft"
|
||||
type="int"
|
||||
transient="false"
|
||||
volatile="false"
|
||||
value="16843590"
|
||||
static="true"
|
||||
final="true"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="fastScrollThumbDrawable"
|
||||
type="int"
|
||||
transient="false"
|
||||
volatile="false"
|
||||
value="16843589"
|
||||
static="true"
|
||||
final="true"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="fastScrollTrackDrawable"
|
||||
type="int"
|
||||
transient="false"
|
||||
volatile="false"
|
||||
value="16843591"
|
||||
static="true"
|
||||
final="true"
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
</field>
|
||||
<field name="fillAfter"
|
||||
type="int"
|
||||
transient="false"
|
||||
|
||||
@@ -1779,6 +1779,10 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te
|
||||
}
|
||||
mRecycler.markChildrenDirty();
|
||||
}
|
||||
|
||||
if (mFastScroller != null && mItemCount != mOldItemCount) {
|
||||
mFastScroller.onItemCountChanged(mOldItemCount, mItemCount);
|
||||
}
|
||||
|
||||
layoutChildren();
|
||||
mInLayout = false;
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -520,15 +520,20 @@
|
||||
<attr name="dayPickerWeekDayViewStyle" format="reference" />
|
||||
|
||||
<!-- Fast scroller styles -->
|
||||
<!-- @hide -->
|
||||
<eat-comment />
|
||||
|
||||
<!-- Drawable to use as the fast scroll thumb. -->
|
||||
<attr name="fastScrollThumbDrawable" format="reference" />
|
||||
<!-- @hide -->
|
||||
<!-- Drawable to use as the fast scroll index preview window background
|
||||
when shown on the right. -->
|
||||
<attr name="fastScrollPreviewBackgroundRight" format="reference" />
|
||||
<!-- @hide -->
|
||||
<!-- Drawable to use as the fast scroll index preview window background
|
||||
when shown on the left. -->
|
||||
<attr name="fastScrollPreviewBackgroundLeft" format="reference" />
|
||||
<!-- @hide -->
|
||||
<!-- Drawable to use as the track for the fast scroll thumb.
|
||||
This may be null. -->
|
||||
<attr name="fastScrollTrackDrawable" format="reference" />
|
||||
<!-- @hide -->
|
||||
<!-- Position of the fast scroll index overlay window. -->
|
||||
<attr name="fastScrollOverlayPosition">
|
||||
<enum name="floating" value="0" />
|
||||
<enum name="atThumb" value="1" />
|
||||
|
||||
@@ -1403,6 +1403,10 @@
|
||||
<public type="attr" name="isAlwaysSyncable" />
|
||||
<public type="attr" name="verticalScrollbarPosition" />
|
||||
<public type="attr" name="fastScrollAlwaysVisible" />
|
||||
<public type="attr" name="fastScrollThumbDrawable" />
|
||||
<public type="attr" name="fastScrollPreviewBackgroundLeft" />
|
||||
<public type="attr" name="fastScrollTrackDrawable" />
|
||||
<public type="attr" name="fastScrollOverlayPosition" />
|
||||
|
||||
<public type="anim" name="animator_fade_in" />
|
||||
<public type="anim" name="animator_fade_out" />
|
||||
|
||||
Reference in New Issue
Block a user