Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 47327831 authored by Alan Viverette's avatar Alan Viverette Committed by Android Git Automerger
Browse files

am 20fbf7ea: am a74cf4f9: am 280dc0ea: Merge "Fix assorted FastScroller regressions" into klp-dev

* commit '20fbf7ea':
  Fix assorted FastScroller regressions
parents a25f4d83 20fbf7ea
Loading
Loading
Loading
Loading
+27 −4
Original line number Original line Diff line number Diff line
@@ -29,6 +29,7 @@ import android.content.res.TypedArray;
import android.graphics.Rect;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Build;
import android.text.TextUtils;
import android.text.TextUtils.TruncateAt;
import android.text.TextUtils.TruncateAt;
import android.util.IntProperty;
import android.util.IntProperty;
import android.util.MathUtils;
import android.util.MathUtils;
@@ -176,6 +177,9 @@ class FastScroller {
     */
     */
    private int mState;
    private int mState;


    /** Whether the preview image is visible. */
    private boolean mShowingPreview;

    private BaseAdapter mListAdapter;
    private BaseAdapter mListAdapter;
    private SectionIndexer mSectionIndexer;
    private SectionIndexer mSectionIndexer;


@@ -769,6 +773,8 @@ class FastScroller {
        mDecorAnimation = new AnimatorSet();
        mDecorAnimation = new AnimatorSet();
        mDecorAnimation.playTogether(fadeOut, slideOut);
        mDecorAnimation.playTogether(fadeOut, slideOut);
        mDecorAnimation.start();
        mDecorAnimation.start();

        mShowingPreview = false;
    }
    }


    /**
    /**
@@ -790,6 +796,8 @@ class FastScroller {
        mDecorAnimation = new AnimatorSet();
        mDecorAnimation = new AnimatorSet();
        mDecorAnimation.playTogether(fadeIn, fadeOut, slideIn);
        mDecorAnimation.playTogether(fadeIn, fadeOut, slideIn);
        mDecorAnimation.start();
        mDecorAnimation.start();

        mShowingPreview = false;
    }
    }


    /**
    /**
@@ -809,6 +817,8 @@ class FastScroller {
        mDecorAnimation = new AnimatorSet();
        mDecorAnimation = new AnimatorSet();
        mDecorAnimation.playTogether(fadeIn, slideIn);
        mDecorAnimation.playTogether(fadeIn, slideIn);
        mDecorAnimation.start();
        mDecorAnimation.start();

        mShowingPreview = true;
    }
    }


    private void postAutoHide() {
    private void postAutoHide() {
@@ -982,9 +992,10 @@ class FastScroller {
        if (mCurrentSection != sectionIndex) {
        if (mCurrentSection != sectionIndex) {
            mCurrentSection = sectionIndex;
            mCurrentSection = sectionIndex;


            if (transitionPreviewLayout(sectionIndex)) {
            final boolean hasPreview = transitionPreviewLayout(sectionIndex);
            if (!mShowingPreview && hasPreview) {
                transitionToDragging();
                transitionToDragging();
            } else {
            } else if (mShowingPreview && !hasPreview) {
                transitionToVisible();
                transitionToVisible();
            }
            }
        }
        }
@@ -1072,7 +1083,7 @@ class FastScroller {


        mPreviewAnimation.start();
        mPreviewAnimation.start();


        return (text != null && text.length() > 0);
        return !TextUtils.isEmpty(text);
    }
    }


    /**
    /**
@@ -1184,7 +1195,19 @@ class FastScroller {
                    / positionsInSection;
                    / positionsInSection;
        }
        }


        return (section + posWithinSection) / sectionCount;
        float result = (section + posWithinSection) / sectionCount;

        // Fake out the scroll bar for the last item. Since the section indexer
        // won't ever actually move the list in this end space, make scrolling
        // across the last item account for whatever space is remaining.
        if (firstVisibleItem > 0 && firstVisibleItem + visibleItemCount == totalItemCount) {
            final View lastChild = mList.getChildAt(visibleItemCount - 1);
            final float lastItemVisible = (float) (mList.getHeight() - mList.getPaddingBottom()
                    - lastChild.getTop()) / lastChild.getHeight();
            result += (1 - result) * lastItemVisible;
        }

        return result;
    }
    }


    /**
    /**
+1 −1
Original line number Original line Diff line number Diff line
@@ -53,7 +53,7 @@
    <!-- Minimum size of the fastscroll overlay -->
    <!-- Minimum size of the fastscroll overlay -->
    <dimen name="fastscroll_overlay_size">104dp</dimen>
    <dimen name="fastscroll_overlay_size">104dp</dimen>
    <!-- Text size of the fastscroll overlay -->
    <!-- Text size of the fastscroll overlay -->
    <dimen name="fastscroll_overlay_text_size">24sp</dimen>
    <dimen name="fastscroll_overlay_text_size">52sp</dimen>
    <!-- Padding of the fastscroll overlay -->
    <!-- Padding of the fastscroll overlay -->
    <dimen name="fastscroll_overlay_padding">16dp</dimen>
    <dimen name="fastscroll_overlay_padding">16dp</dimen>
    <!-- Width of the fastscroll thumb -->
    <!-- Width of the fastscroll thumb -->