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

Commit c101e1c5 authored by Tony Wickham's avatar Tony Wickham
Browse files

Fix curve properties not applying when dismissing task

- ag/10936255 replaced getViewCenterPosition() with getChildStart(),
  meaning getTranslationX() was no longer included.
- This change goes back to using getViewCenterPosition() and renames
  it to getChildStartWithTranslation().
- Update typo with parameter in getCurveProperties being mInsets
  instead of insets.

Bug: 153574162
Change-Id: I9b46daecf3ee6dbefe0270e70fdc5e6d9d0b0c00
parent a24c341b
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -849,7 +849,8 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl
        final int pageCount = getPageCount();
        for (int i = 0; i < pageCount; i++) {
            View page = getPageAt(i);
            mScrollState.updateInterpolation(mOrientationHandler.getChildStart(page), mPageSpacing);
            mScrollState.updateInterpolation(mOrientationHandler.getChildStartWithTranslation(page),
                    mPageSpacing);
            ((PageCallbacks) page).onPageScroll(mScrollState);
        }
    }
@@ -1236,7 +1237,7 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl
        /**
         * Updates linearInterpolation for the provided child position
         */
        public void updateInterpolation(int childStart, int pageSpacing) {
        public void updateInterpolation(float childStart, int pageSpacing) {
            float pageCenter = childStart + halfPageSize;
            float distanceFromScreenCenter = screenCenter - pageCenter;
            float distanceToReachEdge = halfScreenSize + halfPageSize + pageSpacing;
+7 −7
Original line number Diff line number Diff line
@@ -65,11 +65,11 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler {
    }

    @Override
    public void getCurveProperties(PagedView view, Rect mInsets, CurveProperties out) {
    public void getCurveProperties(PagedView view, Rect insets, CurveProperties out) {
        out.scroll = view.getScrollY();
        out.halfPageSize = view.getNormalChildHeight() / 2;
        out.halfScreenSize = view.getMeasuredHeight() / 2;
        out.screenCenter = mInsets.top + view.getPaddingTop() + out.scroll + out.halfPageSize;
        out.screenCenter = insets.top + view.getPaddingTop() + out.scroll + out.halfPageSize;
    }

    @Override
@@ -156,11 +156,6 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler {
        view.setTranslationY(translation);
    }

    @Override
    public float getViewCenterPosition(View view) {
        return view.getTop() + view.getTranslationY();
    }

    @Override
    public int getPrimaryScroll(View view) {
        return view.getScrollY();
@@ -204,6 +199,11 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler {
        return view.getTop();
    }

    @Override
    public float getChildStartWithTranslation(View view) {
        return view.getTop() + view.getTranslationY();
    }

    @Override
    public int getCenterForPage(View view, Rect insets) {
        return (view.getPaddingLeft() + view.getMeasuredWidth() + insets.left
+2 −2
Original line number Diff line number Diff line
@@ -65,10 +65,10 @@ public interface PagedOrientationHandler {
    FloatProperty<View> getPrimaryViewTranslate();
    FloatProperty<View> getSecondaryViewTranslate();
    void setPrimaryAndResetSecondaryTranslate(View view, float translation);
    float getViewCenterPosition(View view);
    int getPrimaryScroll(View view);
    float getPrimaryScale(View view);
    int getChildStart(View view);
    float getChildStartWithTranslation(View view);
    int getCenterForPage(View view, Rect insets);
    int getScrollOffsetStart(View view, Rect insets);
    int getScrollOffsetEnd(View view, Rect insets);
@@ -87,7 +87,7 @@ public interface PagedOrientationHandler {
    void delegateScrollTo(PagedView pagedView, int primaryScroll);
    void delegateScrollBy(PagedView pagedView, int unboundedScroll, int x, int y);
    void scrollerStartScroll(OverScroller scroller, int newPosition);
    void getCurveProperties(PagedView view, Rect mInsets, CurveProperties out);
    void getCurveProperties(PagedView view, Rect insets, CurveProperties out);
    boolean isGoingUp(float displacement);

    /**
+7 −7
Original line number Diff line number Diff line
@@ -65,11 +65,11 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler {
    }

    @Override
    public void getCurveProperties(PagedView view, Rect mInsets, CurveProperties out) {
    public void getCurveProperties(PagedView view, Rect insets, CurveProperties out) {
        out.scroll = view.getScrollX();
        out.halfPageSize = view.getNormalChildWidth() / 2;
        out.halfScreenSize = view.getMeasuredWidth() / 2;
        out.screenCenter = mInsets.left + view.getPaddingLeft() + out.scroll + out.halfPageSize;
        out.screenCenter = insets.left + view.getPaddingLeft() + out.scroll + out.halfPageSize;
    }

    @Override
@@ -154,11 +154,6 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler {
        view.setTranslationY(0);
    }

    @Override
    public float getViewCenterPosition(View view) {
        return view.getLeft() + view.getTranslationX();
    }

    @Override
    public int getPrimaryScroll(View view) {
        return view.getScrollX();
@@ -202,6 +197,11 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler {
        return view.getLeft();
    }

    @Override
    public float getChildStartWithTranslation(View view) {
        return view.getLeft() + view.getTranslationX();
    }

    @Override
    public int getCenterForPage(View view, Rect insets) {
        return (view.getPaddingTop() + view.getMeasuredHeight() + insets.top