From 9a5f99bfe6cd7541205404a5c7ce6335ea24457f Mon Sep 17 00:00:00 2001 From: Alex Chau Date: Thu, 25 Nov 2021 19:06:06 +0000 Subject: [PATCH] Resets taskSplitTranslation of inactive orientation Fix: 204185003 Test: manual Change-Id: I10e49994e8a9723f39d7f9159de7c1f8216ea77f --- .../uioverrides/BaseRecentsViewStateController.java | 11 +++++++---- .../launcher3/touch/LandscapePagedViewHandler.java | 7 ++++--- .../launcher3/touch/PagedOrientationHandler.java | 5 +++-- .../launcher3/touch/PortraitPagedViewHandler.java | 11 ++++++----- 4 files changed, 20 insertions(+), 14 deletions(-) diff --git a/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java b/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java index d74b6c5f1d..c85b2566a7 100644 --- a/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java +++ b/quickstep/src/com/android/launcher3/uioverrides/BaseRecentsViewStateController.java @@ -34,6 +34,7 @@ import static com.android.quickstep.views.RecentsView.TASK_SECONDARY_SPLIT_TRANS import static com.android.quickstep.views.RecentsView.TASK_SECONDARY_TRANSLATION; import android.util.FloatProperty; +import android.util.Pair; import androidx.annotation.NonNull; @@ -101,11 +102,13 @@ public abstract class BaseRecentsViewStateController config.getInterpolator(ANIM_OVERVIEW_TRANSLATE_Y, LINEAR)); PagedOrientationHandler orientationHandler = ((RecentsView) mLauncher.getOverviewPanel()).getPagedOrientationHandler(); - FloatProperty taskViewsFloat = orientationHandler.getSplitSelectTaskOffset( - TASK_PRIMARY_SPLIT_TRANSLATION, TASK_SECONDARY_SPLIT_TRANSLATION, - mLauncher.getDeviceProfile()); - setter.setFloat(mRecentsView, taskViewsFloat, + Pair taskViewsFloat = + orientationHandler.getSplitSelectTaskOffset( + TASK_PRIMARY_SPLIT_TRANSLATION, TASK_SECONDARY_SPLIT_TRANSLATION, + mLauncher.getDeviceProfile()); + setter.setFloat(mRecentsView, taskViewsFloat.first, toState.getSplitSelectTranslation(mLauncher), LINEAR); + setter.setFloat(mRecentsView, taskViewsFloat.second, 0, LINEAR); setter.setFloat(mRecentsView, getContentAlphaProperty(), toState.overviewUi ? 1 : 0, config.getInterpolator(ANIM_OVERVIEW_FADE, AGGRESSIVE_EASE_IN_OUT)); diff --git a/src/com/android/launcher3/touch/LandscapePagedViewHandler.java b/src/com/android/launcher3/touch/LandscapePagedViewHandler.java index e127074f54..c2552250df 100644 --- a/src/com/android/launcher3/touch/LandscapePagedViewHandler.java +++ b/src/com/android/launcher3/touch/LandscapePagedViewHandler.java @@ -36,6 +36,7 @@ import android.graphics.Rect; import android.graphics.RectF; import android.graphics.drawable.ShapeDrawable; import android.util.FloatProperty; +import android.util.Pair; import android.view.MotionEvent; import android.view.Surface; import android.view.VelocityTracker; @@ -462,8 +463,8 @@ public class LandscapePagedViewHandler implements PagedOrientationHandler { } @Override - public FloatProperty getSplitSelectTaskOffset(FloatProperty primary, FloatProperty secondary, - DeviceProfile deviceProfile) { - return primary; + public Pair getSplitSelectTaskOffset(FloatProperty primary, + FloatProperty secondary, DeviceProfile deviceProfile) { + return new Pair<>(primary, secondary); } } diff --git a/src/com/android/launcher3/touch/PagedOrientationHandler.java b/src/com/android/launcher3/touch/PagedOrientationHandler.java index d954552000..54b30fbec8 100644 --- a/src/com/android/launcher3/touch/PagedOrientationHandler.java +++ b/src/com/android/launcher3/touch/PagedOrientationHandler.java @@ -24,6 +24,7 @@ import android.graphics.Rect; import android.graphics.RectF; import android.graphics.drawable.ShapeDrawable; import android.util.FloatProperty; +import android.util.Pair; import android.view.MotionEvent; import android.view.VelocityTracker; import android.view.View; @@ -113,8 +114,8 @@ public interface PagedOrientationHandler { float getSecondaryValue(float x, float y); boolean isLayoutNaturalToLauncher(); - FloatProperty getSplitSelectTaskOffset(FloatProperty primary, FloatProperty secondary, - DeviceProfile deviceProfile); + Pair getSplitSelectTaskOffset(FloatProperty primary, + FloatProperty secondary, DeviceProfile deviceProfile); int getDistanceToBottomOfRect(DeviceProfile dp, Rect rect); List getSplitPositionOptions(DeviceProfile dp); /** diff --git a/src/com/android/launcher3/touch/PortraitPagedViewHandler.java b/src/com/android/launcher3/touch/PortraitPagedViewHandler.java index fbc335c56e..e69944abef 100644 --- a/src/com/android/launcher3/touch/PortraitPagedViewHandler.java +++ b/src/com/android/launcher3/touch/PortraitPagedViewHandler.java @@ -35,6 +35,7 @@ import android.graphics.Rect; import android.graphics.RectF; import android.graphics.drawable.ShapeDrawable; import android.util.FloatProperty; +import android.util.Pair; import android.view.MotionEvent; import android.view.Surface; import android.view.VelocityTracker; @@ -571,12 +572,12 @@ public class PortraitPagedViewHandler implements PagedOrientationHandler { } @Override - public FloatProperty getSplitSelectTaskOffset(FloatProperty primary, FloatProperty secondary, - DeviceProfile dp) { - if (dp.isLandscape) { // or seascape - return primary; + public Pair getSplitSelectTaskOffset(FloatProperty primary, + FloatProperty secondary, DeviceProfile deviceProfile) { + if (deviceProfile.isLandscape) { // or seascape + return new Pair<>(primary, secondary); } else { - return secondary; + return new Pair<>(secondary, primary); } } }