Merge "Tune overview icon size and paddings" into tm-dev am: f4c8da6263

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Launcher3/+/18231547

Change-Id: Ib981483fa77b6150314968b6a0f3a3a76cb21b40
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Alex Chau 2022-05-12 17:13:07 +00:00 committed by Automerger Merge Worker
commit 54962bc981
7 changed files with 56 additions and 29 deletions

View File

@ -15,7 +15,6 @@
*/ */
--> -->
<resources> <resources>
<!-- Overview actions -->
<dimen name="overview_actions_top_margin">12dp</dimen> <dimen name="overview_actions_top_margin">12dp</dimen>
<dimen name="overview_grid_side_margin">52dp</dimen>
<dimen name="overview_page_spacing">38dp</dimen>
</resources> </resources>

View File

@ -17,11 +17,13 @@
<resources> <resources>
<dimen name="navigation_key_padding">25dp</dimen> <dimen name="navigation_key_padding">25dp</dimen>
<!-- Task View -->
<dimen name="task_thumbnail_icon_size">48dp</dimen>
<dimen name="task_thumbnail_icon_drawable_size">44dp</dimen>
<dimen name="overview_task_margin">12dp</dimen> <dimen name="overview_task_margin">12dp</dimen>
<dimen name="overview_task_margin_grid">4dp</dimen> <dimen name="task_thumbnail_icon_drawable_size_grid">44dp</dimen>
<dimen name="overview_actions_button_spacing">36dp</dimen> <dimen name="overview_task_margin_grid">12dp</dimen>
<dimen name="overview_grid_side_margin">60dp</dimen> <dimen name="overview_grid_row_spacing">28dp</dimen>
<dimen name="overview_grid_row_spacing">36dp</dimen>
<dimen name="overview_page_spacing">36dp</dimen> <dimen name="overview_page_spacing">36dp</dimen>
<dimen name="task_thumbnail_icon_drawable_size_grid">32dp</dimen> <dimen name="overview_grid_side_margin">64dp</dimen>
</resources> </resources>

View File

@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?><!--
* Copyright (c) 2022, The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<resources>
<!-- Overview actions -->
<dimen name="overview_actions_top_margin">20dp</dimen>
</resources>

View File

@ -15,11 +15,13 @@
*/ */
--> -->
<resources> <resources>
<!-- Task View -->
<dimen name="task_thumbnail_icon_size">48dp</dimen>
<dimen name="task_thumbnail_icon_drawable_size">44dp</dimen>
<dimen name="overview_task_margin">16dp</dimen> <dimen name="overview_task_margin">16dp</dimen>
<dimen name="task_thumbnail_icon_drawable_size_grid">44dp</dimen>
<dimen name="overview_task_margin_grid">16dp</dimen> <dimen name="overview_task_margin_grid">16dp</dimen>
<dimen name="overview_grid_side_margin">64dp</dimen>
<dimen name="overview_grid_row_spacing">36dp</dimen> <dimen name="overview_grid_row_spacing">36dp</dimen>
<dimen name="overview_page_spacing">44dp</dimen> <dimen name="overview_page_spacing">44dp</dimen>
<dimen name="task_thumbnail_icon_drawable_size">44dp</dimen> <dimen name="overview_grid_side_margin">64dp</dimen>
<dimen name="task_thumbnail_icon_drawable_size_grid">44dp</dimen>
</resources> </resources>

View File

@ -15,8 +15,6 @@
--> -->
<resources> <resources>
<dimen name="task_thumbnail_icon_size">48dp</dimen>
<dimen name="task_thumbnail_icon_drawable_size">48dp</dimen>
<!-- For screens without rounded corners --> <!-- For screens without rounded corners -->
<dimen name="task_corner_radius_small">2dp</dimen> <dimen name="task_corner_radius_small">2dp</dimen>
<!-- For Launchers that want to override the default dialog corner radius --> <!-- For Launchers that want to override the default dialog corner radius -->
@ -32,18 +30,20 @@
<dimen name="overview_proactive_row_bottom_margin">16dp</dimen> <dimen name="overview_proactive_row_bottom_margin">16dp</dimen>
<dimen name="overview_minimum_next_prev_size">50dp</dimen> <dimen name="overview_minimum_next_prev_size">50dp</dimen>
<!-- Task View -->
<dimen name="task_thumbnail_icon_size">48dp</dimen>
<dimen name="task_thumbnail_icon_drawable_size">44dp</dimen>
<dimen name="overview_task_margin">16dp</dimen> <dimen name="overview_task_margin">16dp</dimen>
<dimen name="overview_task_margin_grid">0dp</dimen> <dimen name="overview_page_spacing">16dp</dimen>
<item name="overview_max_scale" format="float" type="dimen">0.7</item> <item name="overview_max_scale" format="float" type="dimen">0.7</item>
<item name="overview_modal_max_scale" format="float" type="dimen">1.1</item> <item name="overview_modal_max_scale" format="float" type="dimen">1.1</item>
<!-- Overrideable in overlay that provides the Overview Actions. --> <!-- Overrideable in overlay that provides the Overview Actions. -->
<dimen name="overview_actions_height">48dp</dimen>
<dimen name="overview_actions_button_spacing">32dp</dimen>
<dimen name="overview_actions_top_margin">24dp</dimen> <dimen name="overview_actions_top_margin">24dp</dimen>
<dimen name="overview_actions_horizontal_margin">16dp</dimen> <dimen name="overview_actions_height">48dp</dimen>
<dimen name="overview_actions_button_spacing">36dp</dimen>
<dimen name="overview_page_spacing">16dp</dimen>
<!-- These speeds are in dp/s --> <!-- These speeds are in dp/s -->
<dimen name="max_task_dismiss_drag_velocity">2.25dp</dimen> <dimen name="max_task_dismiss_drag_velocity">2.25dp</dimen>

View File

@ -222,32 +222,27 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T
*/ */
public final void calculateTaskSize(Context context, DeviceProfile dp, Rect outRect) { public final void calculateTaskSize(Context context, DeviceProfile dp, Rect outRect) {
Resources res = context.getResources(); Resources res = context.getResources();
float maxScale = res.getFloat(R.dimen.overview_max_scale);
if (dp.isTablet) { if (dp.isTablet) {
Rect gridRect = new Rect(); Rect gridRect = new Rect();
calculateGridSize(dp, gridRect); calculateGridSize(dp, gridRect);
PointF taskDimension = getTaskDimension(context, dp); calculateTaskSizeInternal(context, dp, gridRect, maxScale, Gravity.CENTER, outRect);
float scale = gridRect.height() / taskDimension.y;
scale = Math.min(scale, res.getFloat(R.dimen.overview_max_scale));
int outWidth = Math.round(scale * taskDimension.x);
int outHeight = Math.round(scale * taskDimension.y);
int gravity = Gravity.CENTER;
Gravity.apply(gravity, outWidth, outHeight, gridRect, outRect);
} else { } else {
int taskMargin = dp.overviewTaskMarginPx; int taskMargin = dp.overviewTaskMarginPx;
calculateTaskSizeInternal(context, dp, calculateTaskSizeInternal(context, dp,
dp.overviewTaskThumbnailTopMarginPx, dp.overviewTaskThumbnailTopMarginPx,
dp.getOverviewActionsClaimedSpace(), dp.getOverviewActionsClaimedSpace(),
res.getDimensionPixelSize(R.dimen.overview_minimum_next_prev_size) + taskMargin, res.getDimensionPixelSize(R.dimen.overview_minimum_next_prev_size) + taskMargin,
maxScale,
Gravity.CENTER, Gravity.CENTER,
outRect); outRect);
} }
} }
private void calculateTaskSizeInternal(Context context, DeviceProfile dp, int claimedSpaceAbove, private void calculateTaskSizeInternal(Context context, DeviceProfile dp, int claimedSpaceAbove,
int claimedSpaceBelow, int minimumHorizontalPadding, int gravity, Rect outRect) { int claimedSpaceBelow, int minimumHorizontalPadding, float maxScale, int gravity,
PointF taskDimension = getTaskDimension(context, dp); Rect outRect) {
Rect insets = dp.getInsets(); Rect insets = dp.getInsets();
Rect potentialTaskRect = new Rect(0, 0, dp.widthPx, dp.heightPx); Rect potentialTaskRect = new Rect(0, 0, dp.widthPx, dp.heightPx);
@ -258,9 +253,17 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T
minimumHorizontalPadding, minimumHorizontalPadding,
claimedSpaceBelow); claimedSpaceBelow);
calculateTaskSizeInternal(context, dp, potentialTaskRect, maxScale, gravity, outRect);
}
private void calculateTaskSizeInternal(Context context, DeviceProfile dp,
Rect potentialTaskRect, float maxScale, int gravity, Rect outRect) {
PointF taskDimension = getTaskDimension(context, dp);
float scale = Math.min( float scale = Math.min(
potentialTaskRect.width() / taskDimension.x, potentialTaskRect.width() / taskDimension.x,
potentialTaskRect.height() / taskDimension.y); potentialTaskRect.height() / taskDimension.y);
scale = Math.min(scale, maxScale);
int outWidth = Math.round(scale * taskDimension.x); int outWidth = Math.round(scale * taskDimension.x);
int outHeight = Math.round(scale * taskDimension.y); int outHeight = Math.round(scale * taskDimension.y);
@ -359,6 +362,7 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T
dp.overviewTaskMarginPx, dp.overviewTaskMarginPx,
dp.heightPx - outRect.bottom - dp.getInsets().bottom, dp.heightPx - outRect.bottom - dp.getInsets().bottom,
Math.round((dp.availableWidthPx - outRect.width() * maxScale) / 2), Math.round((dp.availableWidthPx - outRect.width() * maxScale) / 2),
1f /*maxScale*/,
Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM, Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM,
outRect); outRect);
} }

View File

@ -1160,7 +1160,7 @@ public class DeviceProfile {
return ((taskbarSize - overviewActionsHeight) / 2) + getTaskbarOffsetY(); return ((taskbarSize - overviewActionsHeight) / 2) + getTaskbarOffsetY();
} }
return 0; return isTaskbarPresent ? stashedTaskbarSize : mInsets.bottom;
} }
/** Gets the space that the overview actions will take, including bottom margin. */ /** Gets the space that the overview actions will take, including bottom margin. */