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

Commit 48644c75 authored by Alex Chau's avatar Alex Chau Committed by Android (Google) Code Review
Browse files

Merge "Consider launching task's position on screen in pivot calculation" into sc-v2-dev

parents 953641e2 6499e83c
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -196,7 +196,8 @@ public final class TaskViewUtils {
        boolean showAsGrid = dp.overviewShowAsGrid;
        boolean parallaxCenterAndAdjacentTask =
                taskIndex != recentsView.getCurrentPage() && !showAsGrid;
        int startScroll = recentsView.getScrollOffset(taskIndex);
        int taskRectTranslationPrimary = recentsView.getScrollOffset(taskIndex);
        int taskRectTranslationSecondary = showAsGrid ? (int) v.getGridTranslationY() : 0;

        RemoteTargetHandle[] topMostSimulators = null;

@@ -213,9 +214,10 @@ public final class TaskViewUtils {

                tvsLocal.fullScreenProgress.value = 0;
                tvsLocal.recentsViewScale.value = 1;
                tvsLocal.setScroll(startScroll);
                tvsLocal.setIsGridTask(v.isGridTask());
                tvsLocal.setGridTranslationY(v.getGridTranslationY());
                tvsLocal.getOrientationState().getOrientationHandler().set(tvsLocal,
                        TaskViewSimulator::setTaskRectTranslation, taskRectTranslationPrimary,
                        taskRectTranslationSecondary);

                // Fade in the task during the initial 20% of the animation
                out.addFloat(targetHandle.getTransformParams(), TransformParams.TARGET_ALPHA, 0, 1,
+12 −14
Original line number Diff line number Diff line
@@ -102,7 +102,8 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy {
    private StagedSplitBounds mStagedSplitBounds;
    private boolean mDrawsBelowRecents;
    private boolean mIsGridTask;
    private float mGridTranslationY;
    private int mTaskRectTranslationX;
    private int mTaskRectTranslationY;

    public TaskViewSimulator(Context context, BaseActivityInterface sizeStrategy) {
        mContext = context;
@@ -157,15 +158,11 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy {
            fullTaskSize = new Rect(mTaskRect);
            mOrientationState.getOrientationHandler()
                    .setSplitTaskSwipeRect(mDp, mTaskRect, mStagedSplitBounds, mStagePosition);
            if (mIsGridTask) {
                mTaskRect.offset(0, (int) mGridTranslationY);
            }
            mTaskRect.offset(mTaskRectTranslationX, mTaskRectTranslationY);
        } else {
            fullTaskSize = mTaskRect;
        }
        if (mIsGridTask) {
            fullTaskSize.offset(0, (int) mGridTranslationY);
        }
        fullTaskSize.offset(mTaskRectTranslationX, mTaskRectTranslationY);
        return mOrientationState.getFullScreenScaleAndPivot(fullTaskSize, mDp, mPivot);
    }

@@ -225,10 +222,11 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy {
    }

    /**
     * Sets the y-translation when overview is in grid.
     * Apply translations on TaskRect's starting location.
     */
    public void setGridTranslationY(float gridTranslationY) {
        mGridTranslationY = gridTranslationY;
    public void setTaskRectTranslation(int taskRectTranslationX, int taskRectTranslationY) {
        mTaskRectTranslationX = taskRectTranslationX;
        mTaskRectTranslationY = taskRectTranslationY;
    }

    /**
@@ -336,19 +334,19 @@ public class TaskViewSimulator implements TransformParams.BuilderProxy {

        // Apply TaskView matrix: taskRect, translate
        mMatrix.postTranslate(mTaskRect.left, mTaskRect.top);
        mOrientationState.getOrientationHandler().set(mMatrix, MATRIX_POST_TRANSLATE,
        mOrientationState.getOrientationHandler().setPrimary(mMatrix, MATRIX_POST_TRANSLATE,
                taskPrimaryTranslation.value);
        mOrientationState.getOrientationHandler().setSecondary(mMatrix, MATRIX_POST_TRANSLATE,
                taskSecondaryTranslation.value);
        mOrientationState.getOrientationHandler().setPrimary(
                mMatrix, MATRIX_POST_TRANSLATE, recentsViewScroll.value);

        // Apply RecentsView matrix
        mMatrix.postScale(recentsViewScale.value, recentsViewScale.value, mPivot.x, mPivot.y);
        mOrientationState.getOrientationHandler().setSecondary(mMatrix, MATRIX_POST_TRANSLATE,
                recentsViewSecondaryTranslation.value);
        mOrientationState.getOrientationHandler().set(mMatrix, MATRIX_POST_TRANSLATE,
        mOrientationState.getOrientationHandler().setPrimary(mMatrix, MATRIX_POST_TRANSLATE,
                recentsViewPrimaryTranslation.value);
        mOrientationState.getOrientationHandler().set(
                mMatrix, MATRIX_POST_TRANSLATE, recentsViewScroll.value);
        applyWindowToHomeRotation(mMatrix);

        // Crop rect is the inverse of thumbnail matrix
+1 −1
Original line number Diff line number Diff line
@@ -747,7 +747,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T

            int primarySize = mOrientationHandler.getPrimaryValue(getWidth(), getHeight());
            int scroll = OverScroll.dampedScroll(getUndampedOverScrollShift(), primarySize);
            mOrientationHandler.set(canvas, CANVAS_TRANSLATE, scroll);
            mOrientationHandler.setPrimary(canvas, CANVAS_TRANSLATE, scroll);

            if (mOverScrollShift != scroll) {
                mOverScrollShift = scroll;
+3 −3
Original line number Diff line number Diff line
@@ -252,7 +252,7 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
        if (0 <= mCurrentPage && mCurrentPage < getPageCount()) {
            newPosition = getScrollForPage(mCurrentPage) + mCurrentPageScrollDiff;
        }
        mOrientationHandler.set(this, VIEW_SCROLL_TO, newPosition);
        mOrientationHandler.setPrimary(this, VIEW_SCROLL_TO, newPosition);
        mScroller.startScroll(mScroller.getCurrX(), 0, newPosition - mScroller.getCurrX(), 0);
        forceFinishScroller();
    }
@@ -556,7 +556,7 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
            int oldPos = mOrientationHandler.getPrimaryScroll(this);
            int newPos = mScroller.getCurrX();
            if (oldPos != newPos) {
                mOrientationHandler.set(this, VIEW_SCROLL_TO, mScroller.getCurrX());
                mOrientationHandler.setPrimary(this, VIEW_SCROLL_TO, mScroller.getCurrX());
            }

            if (mAllowOverScroll) {
@@ -1280,7 +1280,7 @@ public abstract class PagedView<T extends View & PageIndicator> extends ViewGrou
                mLastMotionRemainder = delta - movedDelta;

                if (delta != 0) {
                    mOrientationHandler.set(this, VIEW_SCROLL_BY, movedDelta);
                    mOrientationHandler.setPrimary(this, VIEW_SCROLL_BY, movedDelta);

                    if (mAllowOverScroll) {
                        final float pulledToX = oldScroll + delta;
+8 −2
Original line number Diff line number Diff line
@@ -101,12 +101,12 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler {
    }

    @Override
    public <T> void set(T target, Int2DAction<T> action, int param) {
    public <T> void setPrimary(T target, Int2DAction<T> action, int param) {
        action.call(target, 0, param);
    }

    @Override
    public <T> void set(T target, Float2DAction<T> action, float param) {
    public <T> void setPrimary(T target, Float2DAction<T> action, float param) {
        action.call(target, 0, param);
    }

@@ -115,6 +115,12 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler {
        action.call(target, param, 0);
    }

    @Override
    public <T> void set(T target, Int2DAction<T> action, int primaryParam,
            int secondaryParam) {
        action.call(target, secondaryParam, primaryParam);
    }

    @Override
    public float getPrimaryDirection(MotionEvent event, int pointerIndex) {
        return event.getY(pointerIndex);
Loading