[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
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 414d389..0be2486 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 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 @@
Rect out = new Rect();
activity.<RecentsView>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.<RecentsView>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 7201b02..f06a6a4 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 @@
/** 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 @@
}
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 979e3ef..44dbaec 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 @@
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 @@
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 6c521fc..72275c8 100644
--- a/quickstep/res/values/dimens.xml
+++ b/quickstep/res/values/dimens.xml
@@ -24,7 +24,6 @@
<!-- Overrideable in overlay that provides the Overview Actions. -->
<dimen name="overview_actions_height">66dp</dimen>
- <dimen name="overview_actions_top_margin">44dp</dimen>
<dimen name="overview_actions_bottom_margin_gesture">16dp</dimen>
<dimen name="overview_actions_bottom_margin_three_button">8dp</dimen>
<dimen name="overview_actions_horizontal_margin">16dp</dimen>
@@ -64,6 +63,7 @@
<dimen name="task_card_menu_horizontal_padding">0dp</dimen>
<dimen name="portrait_task_card_horz_space">136dp</dimen>
<dimen name="portrait_task_card_horz_space_big_overview">96dp</dimen>
+ <dimen name="portrait_modal_task_card_horz_space">60dp</dimen>
<dimen name="landscape_task_card_horz_space">200dp</dimen>
<dimen name="multi_window_task_card_horz_space">100dp</dimen>
<!-- Copied from framework resource:
diff --git a/quickstep/src/com/android/quickstep/util/WindowSizeStrategy.java b/quickstep/src/com/android/quickstep/util/WindowSizeStrategy.java
index 1557dfc..6639347 100644
--- a/quickstep/src/com/android/quickstep/util/WindowSizeStrategy.java
+++ b/quickstep/src/com/android/quickstep/util/WindowSizeStrategy.java
@@ -109,6 +109,68 @@
Math.round(x) + Math.round(outWidth), Math.round(y) + Math.round(outHeight));
}
+ /**
+ * Calculates the modal taskView size for the provided device configuration
+ */
+ public void calculateModalTaskSize(Context context, DeviceProfile dp, Rect outRect) {
+ float taskWidth, taskHeight, paddingHorz;
+ Resources res = context.getResources();
+ Rect insets = dp.getInsets();
+
+ if (dp.isMultiWindowMode) {
+ getMultiWindowSize(context, dp, mTempPoint);
+ taskWidth = mTempPoint.x;
+ taskHeight = mTempPoint.y;
+ paddingHorz = res.getDimension(R.dimen.multi_window_task_card_horz_space);
+ } else {
+ taskWidth = dp.availableWidthPx;
+ taskHeight = dp.availableHeightPx;
+
+ final int paddingResId;
+ if (dp.isVerticalBarLayout()) {
+ paddingResId = R.dimen.landscape_task_card_horz_space;
+ } else {
+ paddingResId = R.dimen.portrait_modal_task_card_horz_space;
+ }
+ paddingHorz = res.getDimension(paddingResId);
+ }
+
+ // Note this should be same as dp.availableWidthPx and dp.availableHeightPx unless
+ // we override the insets ourselves.
+ int launcherVisibleWidth = dp.widthPx - insets.left - insets.right;
+ int launcherVisibleHeight = dp.heightPx - insets.top - insets.bottom;
+
+ // Calculate for the overview height.
+ float overviewActionsHeight = getOverviewActionsHeight(context);
+ float availableHeight = launcherVisibleHeight - overviewActionsHeight;
+ float availableWidth = launcherVisibleWidth - paddingHorz;
+
+ float scale = Math.min(availableWidth / taskWidth, availableHeight / taskHeight);
+ float outWidth = scale * taskWidth;
+ float outHeight = scale * taskHeight;
+
+ // Center in the visible space
+ float x = insets.left + (launcherVisibleWidth - outWidth) / 2;
+ float y = insets.top + (launcherVisibleHeight - overviewActionsHeight - outHeight) / 2;
+ outRect.set(Math.round(x), Math.round(y),
+ Math.round(x) + Math.round(outWidth), Math.round(y) + Math.round(outHeight));
+ }
+
+ /** Gets the space that the overview actions will take, including margins. */
+ public float getOverviewActionsHeight(Context context) {
+ Resources res = context.getResources();
+ float actionsBottomMargin = 0;
+ if (getMode(context) == Mode.THREE_BUTTONS) {
+ actionsBottomMargin = res.getDimensionPixelSize(
+ R.dimen.overview_actions_bottom_margin_three_button);
+ } else {
+ actionsBottomMargin = res.getDimensionPixelSize(
+ R.dimen.overview_actions_bottom_margin_gesture);
+ }
+ float overviewActionsHeight = actionsBottomMargin
+ + res.getDimensionPixelSize(R.dimen.overview_actions_height);
+ return overviewActionsHeight;
+ }
public static final WindowSizeStrategy LAUNCHER_ACTIVITY_SIZE_STRATEGY =
new WindowSizeStrategy(true) {
@@ -138,17 +200,7 @@
if (showOverviewActions(context)) {
//TODO: this needs to account for the swipe gesture height and accessibility
// UI when shown.
- float actionsBottomMargin = 0;
- if (getMode(context) == Mode.THREE_BUTTONS) {
- actionsBottomMargin = res.getDimensionPixelSize(
- R.dimen.overview_actions_bottom_margin_three_button);
- } else {
- actionsBottomMargin = res.getDimensionPixelSize(
- R.dimen.overview_actions_bottom_margin_gesture);
- }
- float actionsHeight = actionsBottomMargin
- + res.getDimensionPixelSize(R.dimen.overview_actions_height);
- return actionsHeight;
+ return getOverviewActionsHeight(context);
} else {
return getDefaultSwipeHeight(context, dp) + dp.workspacePageIndicatorHeight
+ res.getDimensionPixelSize(