From dc48fc4f84a4c9b85b3a30d612e7b4f84070e1d2 Mon Sep 17 00:00:00 2001 From: Becky Qiu Date: Tue, 12 May 2020 15:21:10 -0700 Subject: [PATCH] [Overview Actions] Adjust the select mode taskview UI. It will have a 30dp horizontal paddings and vertically in the middle of the screen. Test: local Bug: 155444014 Change-Id: I4f3d627008b2c114cc4921bf683919c6044926e4 --- .../states/OverviewModalTaskState.java | 9 +-- .../quickstep/views/OverviewActionsView.java | 4 +- .../android/quickstep/views/RecentsView.java | 17 ++--- quickstep/res/values/dimens.xml | 2 +- .../quickstep/util/WindowSizeStrategy.java | 74 ++++++++++++++++--- 5 files changed, 74 insertions(+), 32 deletions(-) diff --git a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewModalTaskState.java b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewModalTaskState.java index 414d38954e..0be248691e 100644 --- a/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewModalTaskState.java +++ b/quickstep/recents_ui_overrides/src/com/android/launcher3/uioverrides/states/OverviewModalTaskState.java @@ -21,7 +21,6 @@ import android.graphics.Rect; import com.android.launcher3.BaseDraggingActivity; import com.android.launcher3.Launcher; -import com.android.launcher3.R; import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType; import com.android.quickstep.views.RecentsView; @@ -64,10 +63,10 @@ public class OverviewModalTaskState extends OverviewState { Rect out = new Rect(); activity.getOverviewPanel().getTaskSize(out); int taskHeight = out.height(); - float topMargin = res.getDimension(R.dimen.task_thumbnail_top_margin); - float bottomMargin = res.getDimension(R.dimen.overview_actions_top_margin); - float newHeight = taskHeight + topMargin + bottomMargin; - float scale = newHeight / taskHeight; + activity.getOverviewPanel().getModalTaskSize(out); + int newHeight = out.height(); + + float scale = (float) newHeight / taskHeight; return new float[] {scale, NO_OFFSET}; } diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/OverviewActionsView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/OverviewActionsView.java index 7201b02ce0..f06a6a4182 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/OverviewActionsView.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/OverviewActionsView.java @@ -145,8 +145,6 @@ public class OverviewActionsView extends FrameLayo /** Updates vertical margins for different navigation mode. */ public void updateVerticalMarginForNavModeChange(Mode mode) { - int topMargin = getResources() - .getDimensionPixelSize(R.dimen.overview_actions_top_margin); int bottomMargin = 0; if (mode == Mode.THREE_BUTTONS) { bottomMargin = getResources() @@ -157,6 +155,6 @@ public class OverviewActionsView extends FrameLayo } LayoutParams params = (LayoutParams) getLayoutParams(); params.setMargins( - params.leftMargin, topMargin, params.rightMargin, bottomMargin); + params.leftMargin, params.topMargin, params.rightMargin, bottomMargin); } } diff --git a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java index 979e3ef15f..44dbaece05 100644 --- a/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java +++ b/quickstep/recents_ui_overrides/src/com/android/quickstep/views/RecentsView.java @@ -839,6 +839,11 @@ public abstract class RecentsView extends PagedView impl mSizeStrategy.calculateTaskSize(mActivity, mActivity.getDeviceProfile(), outRect); } + /** Gets the task size for modal state. */ + public void getModalTaskSize(Rect outRect) { + mSizeStrategy.calculateModalTaskSize(mActivity, mActivity.getDeviceProfile(), outRect); + } + @Override protected boolean computeScrollHelper() { boolean scrolling = super.computeScrollHelper(); @@ -2155,18 +2160,6 @@ public abstract class RecentsView extends PagedView impl updatePageOffsets(); if (getCurrentPageTaskView() != null) { getCurrentPageTaskView().setModalness(modalness); - TaskView tv = getCurrentPageTaskView(); - - // Move the task view up as it scales... - // ...the icon on taskview is hidden in modal state, so consider the top of the task - mTempFloatPoint[0] = 0; - mTempFloatPoint[1] = tv.getTop() + mTaskTopMargin; - // ...find the top after the transformation - getMatrix().mapPoints(mTempFloatPoint); - - // ...make it match the top inset - float calcOffset = (mInsets.top - mTempFloatPoint[1]) * mTaskModalness; - tv.setTranslationY(calcOffset); } } diff --git a/quickstep/res/values/dimens.xml b/quickstep/res/values/dimens.xml index 6c521fcb77..72275c81b1 100644 --- a/quickstep/res/values/dimens.xml +++ b/quickstep/res/values/dimens.xml @@ -24,7 +24,6 @@ 66dp - 44dp 16dp 8dp 16dp @@ -64,6 +63,7 @@ 0dp 136dp 96dp + 60dp 200dp 100dp