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

Commit 9097b42c authored by Android Build Merger (Role)'s avatar Android Build Merger (Role)
Browse files

[automerger] Settling scrolls over clear-all button. am: a9283bee

Change-Id: Ifda915057c1c13b08159fe2a638791d8a2a6e45c
parents ddc23b9c a9283bee
Loading
Loading
Loading
Loading
+13 −5
Original line number Original line Diff line number Diff line
@@ -1171,11 +1171,19 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
                    mNextPage = getPageNearestToCenterOfScreen(unscaledScrollX);
                    mNextPage = getPageNearestToCenterOfScreen(unscaledScrollX);
                    int firstPageScroll = getScrollForPage(!mIsRtl ? 0 : getPageCount() - 1);
                    int firstPageScroll = getScrollForPage(!mIsRtl ? 0 : getPageCount() - 1);
                    int lastPageScroll = getScrollForPage(!mIsRtl ? getPageCount() - 1 : 0);
                    int lastPageScroll = getScrollForPage(!mIsRtl ? getPageCount() - 1 : 0);
                    if (mSettleOnPageInFreeScroll && unscaledScrollX > firstPageScroll
                    if (mSettleOnPageInFreeScroll && unscaledScrollX > 0
                            && unscaledScrollX < lastPageScroll) {
                            && unscaledScrollX < mMaxScrollX) {
                        // Make sure we land directly on a page. If flinging past one of the ends,
                        // If scrolling ends in the half of the added space that is closer to the
                        // don't change the velocity as it will get stopped at the end anyway.
                        // end, settle to the end. Otherwise snap to the nearest page.
                        mScroller.setFinalX((int) (getScrollForPage(mNextPage) * getScaleX()));
                        // If flinging past one of the ends, don't change the velocity as it will
                        // get stopped at the end anyway.
                        final int finalX = unscaledScrollX < firstPageScroll / 2 ?
                                0 :
                                unscaledScrollX > (lastPageScroll + mMaxScrollX) / 2 ?
                                        mMaxScrollX :
                                        getScrollForPage(mNextPage);

                        mScroller.setFinalX((int) (finalX * getScaleX()));
                        // Ensure the scroll/snap doesn't happen too fast;
                        // Ensure the scroll/snap doesn't happen too fast;
                        int extraScrollDuration = OVERSCROLL_PAGE_SNAP_ANIMATION_DURATION
                        int extraScrollDuration = OVERSCROLL_PAGE_SNAP_ANIMATION_DURATION
                                - mScroller.getDuration();
                                - mScroller.getDuration();