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:
commit
54962bc981
|
@ -15,7 +15,6 @@
|
|||
*/
|
||||
-->
|
||||
<resources>
|
||||
<!-- Overview actions -->
|
||||
<dimen name="overview_actions_top_margin">12dp</dimen>
|
||||
<dimen name="overview_grid_side_margin">52dp</dimen>
|
||||
<dimen name="overview_page_spacing">38dp</dimen>
|
||||
</resources>
|
||||
|
|
|
@ -17,11 +17,13 @@
|
|||
<resources>
|
||||
<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_grid">4dp</dimen>
|
||||
<dimen name="overview_actions_button_spacing">36dp</dimen>
|
||||
<dimen name="overview_grid_side_margin">60dp</dimen>
|
||||
<dimen name="overview_grid_row_spacing">36dp</dimen>
|
||||
<dimen name="task_thumbnail_icon_drawable_size_grid">44dp</dimen>
|
||||
<dimen name="overview_task_margin_grid">12dp</dimen>
|
||||
<dimen name="overview_grid_row_spacing">28dp</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>
|
||||
|
|
|
@ -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>
|
|
@ -15,11 +15,13 @@
|
|||
*/
|
||||
-->
|
||||
<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="task_thumbnail_icon_drawable_size_grid">44dp</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_page_spacing">44dp</dimen>
|
||||
<dimen name="task_thumbnail_icon_drawable_size">44dp</dimen>
|
||||
<dimen name="task_thumbnail_icon_drawable_size_grid">44dp</dimen>
|
||||
<dimen name="overview_grid_side_margin">64dp</dimen>
|
||||
</resources>
|
||||
|
|
|
@ -15,8 +15,6 @@
|
|||
-->
|
||||
|
||||
<resources>
|
||||
<dimen name="task_thumbnail_icon_size">48dp</dimen>
|
||||
<dimen name="task_thumbnail_icon_drawable_size">48dp</dimen>
|
||||
<!-- For screens without rounded corners -->
|
||||
<dimen name="task_corner_radius_small">2dp</dimen>
|
||||
<!-- 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_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_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_modal_max_scale" format="float" type="dimen">1.1</item>
|
||||
|
||||
<!-- 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_horizontal_margin">16dp</dimen>
|
||||
|
||||
<dimen name="overview_page_spacing">16dp</dimen>
|
||||
<dimen name="overview_actions_height">48dp</dimen>
|
||||
<dimen name="overview_actions_button_spacing">36dp</dimen>
|
||||
|
||||
<!-- These speeds are in dp/s -->
|
||||
<dimen name="max_task_dismiss_drag_velocity">2.25dp</dimen>
|
||||
|
|
|
@ -222,32 +222,27 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T
|
|||
*/
|
||||
public final void calculateTaskSize(Context context, DeviceProfile dp, Rect outRect) {
|
||||
Resources res = context.getResources();
|
||||
float maxScale = res.getFloat(R.dimen.overview_max_scale);
|
||||
if (dp.isTablet) {
|
||||
Rect gridRect = new Rect();
|
||||
calculateGridSize(dp, gridRect);
|
||||
|
||||
PointF taskDimension = getTaskDimension(context, dp);
|
||||
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);
|
||||
calculateTaskSizeInternal(context, dp, gridRect, maxScale, Gravity.CENTER, outRect);
|
||||
} else {
|
||||
int taskMargin = dp.overviewTaskMarginPx;
|
||||
calculateTaskSizeInternal(context, dp,
|
||||
dp.overviewTaskThumbnailTopMarginPx,
|
||||
dp.getOverviewActionsClaimedSpace(),
|
||||
res.getDimensionPixelSize(R.dimen.overview_minimum_next_prev_size) + taskMargin,
|
||||
maxScale,
|
||||
Gravity.CENTER,
|
||||
outRect);
|
||||
}
|
||||
}
|
||||
|
||||
private void calculateTaskSizeInternal(Context context, DeviceProfile dp, int claimedSpaceAbove,
|
||||
int claimedSpaceBelow, int minimumHorizontalPadding, int gravity, Rect outRect) {
|
||||
PointF taskDimension = getTaskDimension(context, dp);
|
||||
int claimedSpaceBelow, int minimumHorizontalPadding, float maxScale, int gravity,
|
||||
Rect outRect) {
|
||||
Rect insets = dp.getInsets();
|
||||
|
||||
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,
|
||||
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(
|
||||
potentialTaskRect.width() / taskDimension.x,
|
||||
potentialTaskRect.height() / taskDimension.y);
|
||||
scale = Math.min(scale, maxScale);
|
||||
int outWidth = Math.round(scale * taskDimension.x);
|
||||
int outHeight = Math.round(scale * taskDimension.y);
|
||||
|
||||
|
@ -359,6 +362,7 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T
|
|||
dp.overviewTaskMarginPx,
|
||||
dp.heightPx - outRect.bottom - dp.getInsets().bottom,
|
||||
Math.round((dp.availableWidthPx - outRect.width() * maxScale) / 2),
|
||||
1f /*maxScale*/,
|
||||
Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM,
|
||||
outRect);
|
||||
}
|
||||
|
|
|
@ -1160,7 +1160,7 @@ public class DeviceProfile {
|
|||
return ((taskbarSize - overviewActionsHeight) / 2) + getTaskbarOffsetY();
|
||||
}
|
||||
|
||||
return 0;
|
||||
return isTaskbarPresent ? stashedTaskbarSize : mInsets.bottom;
|
||||
}
|
||||
|
||||
/** Gets the space that the overview actions will take, including bottom margin. */
|
||||
|
|
Loading…
Reference in New Issue