Use percentage scaling for overview thumbnail size

- Limit overview to screen ratio to be at max 70%
- Tuned row spacing and page spacing
- Added 2 more test activities to testOverviewForTablet to avoid dismissing tasks at end of grid, as more grid tasks are now shown

Bug: 207350366
Test: manual
Change-Id: Id04871464bdb3ef2d6b046977b0ffd9bd51bc230
Merged-In: Id04871464bdb3ef2d6b046977b0ffd9bd51bc230
This commit is contained in:
Alex Chau 2021-12-06 13:04:57 +00:00
parent 3d206ca917
commit 992db75dae
7 changed files with 56 additions and 18 deletions

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?><!--
* Copyright (c) 2021, 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>
<dimen name="overview_grid_row_spacing">44dp</dimen>
<dimen name="overview_page_spacing_grid_portrait">44dp</dimen>
<dimen name="overview_page_spacing_grid_landscape">44dp</dimen>
</resources>

View File

@ -36,6 +36,7 @@
<dimen name="overview_task_margin">16dp</dimen>
<dimen name="overview_task_margin_focused">12dp</dimen>
<dimen name="overview_task_margin_grid">4dp</dimen>
<item name="overview_max_scale" format="float" type="dimen">0.7</item>
<!-- Overrideable in overlay that provides the Overview Actions. -->
<dimen name="overview_actions_height">48dp</dimen>
@ -51,9 +52,10 @@
<dimen name="overview_grid_side_margin_portrait">60dp</dimen>
<dimen name="overview_grid_side_margin_landscape">52dp</dimen>
<dimen name="overview_grid_row_spacing_portrait">17.13dp</dimen>
<dimen name="overview_grid_row_spacing_landscape">13.38dp</dimen>
<dimen name="overview_grid_focus_vertical_margin">0dp</dimen>
<dimen name="overview_grid_row_spacing">36dp</dimen>
<dimen name="overview_page_spacing">16dp</dimen>
<dimen name="overview_page_spacing_grid_portrait">36dp</dimen>
<dimen name="overview_page_spacing_grid_landscape">38dp</dimen>
<!-- These speeds are in dp/s -->
<dimen name="max_task_dismiss_drag_velocity">2.25dp</dimen>
@ -61,8 +63,6 @@
<dimen name="default_task_dismiss_drag_velocity_grid">1dp</dimen>
<dimen name="default_task_dismiss_drag_velocity_grid_focus_task">5dp</dimen>
<dimen name="recents_page_spacing">16dp</dimen>
<dimen name="recents_page_spacing_grid">36dp</dimen>
<dimen name="recents_clear_all_deadzone_vertical_margin">70dp</dimen>
<!-- The speed in dp/s at which the user needs to be scrolling in recents such that we start

View File

@ -221,6 +221,7 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T
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);

View File

@ -324,14 +324,14 @@ public class TaplTestsQuickstep extends AbstractQuickStepTest {
if (!mLauncher.isTablet()) {
return;
}
for (int i = 2; i <= 12; i++) {
for (int i = 2; i <= 14; i++) {
startTestActivity(i);
}
Overview overview = mLauncher.pressHome().switchToOverview();
executeOnLauncher(
launcher -> assertTrue("Don't have at least 11 tasks",
getTaskCount(launcher) >= 11));
launcher -> assertTrue("Don't have at least 13 tasks",
getTaskCount(launcher) >= 13));
// Test scroll the first task off screen
overview.scrollCurrentTaskOffScreen();

View File

@ -342,10 +342,10 @@
<dimen name="overview_actions_margin_three_button">0dp</dimen>
<dimen name="overview_grid_side_margin_portrait">0dp</dimen>
<dimen name="overview_grid_side_margin_landscape">0dp</dimen>
<dimen name="overview_grid_row_spacing_portrait">0dp</dimen>
<dimen name="overview_grid_row_spacing_landscape">0dp</dimen>
<dimen name="recents_page_spacing">0dp</dimen>
<dimen name="recents_page_spacing_grid">0dp</dimen>
<dimen name="overview_grid_row_spacing">0dp</dimen>
<dimen name="overview_page_spacing">0dp</dimen>
<dimen name="overview_page_spacing_grid_portrait">0dp</dimen>
<dimen name="overview_page_spacing_grid_landscape">0dp</dimen>
<dimen name="split_placeholder_size">110dp</dimen>
<dimen name="task_menu_width_grid">200dp</dimen>

View File

@ -372,11 +372,15 @@ public class DeviceProfile {
R.dimen.overview_actions_top_margin_gesture_grid_landscape);
overviewActionsBottomMarginGesturePx = res.getDimensionPixelSize(
R.dimen.overview_actions_bottom_margin_gesture_grid_landscape);
overviewPageSpacing = res.getDimensionPixelSize(
R.dimen.overview_page_spacing_grid_landscape);
} else {
overviewActionsTopMarginGesturePx = res.getDimensionPixelSize(
R.dimen.overview_actions_top_margin_gesture_grid_portrait);
overviewActionsBottomMarginGesturePx = res.getDimensionPixelSize(
R.dimen.overview_actions_bottom_margin_gesture_grid_portrait);
overviewPageSpacing = res.getDimensionPixelSize(
R.dimen.overview_page_spacing_grid_portrait);
}
overviewActionsButtonSpacing = res.getDimensionPixelSize(
R.dimen.overview_actions_button_spacing_grid);
@ -386,15 +390,11 @@ public class DeviceProfile {
overviewActionsBottomMarginGesturePx = overviewActionsTopMarginGesturePx;
overviewActionsButtonSpacing = res.getDimensionPixelSize(
R.dimen.overview_actions_button_spacing);
overviewPageSpacing = res.getDimensionPixelSize(R.dimen.overview_page_spacing);
}
overviewActionsMarginThreeButtonPx = res.getDimensionPixelSize(
R.dimen.overview_actions_margin_three_button);
overviewPageSpacing = overviewShowAsGrid
? res.getDimensionPixelSize(R.dimen.recents_page_spacing_grid)
: res.getDimensionPixelSize(R.dimen.recents_page_spacing);
overviewRowSpacing = isLandscape
? res.getDimensionPixelSize(R.dimen.overview_grid_row_spacing_landscape)
: res.getDimensionPixelSize(R.dimen.overview_grid_row_spacing_portrait);
overviewRowSpacing = res.getDimensionPixelSize(R.dimen.overview_grid_row_spacing);
overviewGridSideMargin = isLandscape
? res.getDimensionPixelSize(R.dimen.overview_grid_side_margin_landscape)
: res.getDimensionPixelSize(R.dimen.overview_grid_side_margin_portrait);

View File

@ -250,5 +250,21 @@
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity-alias>
<activity-alias android:name="Activity13" android:exported="true"
android:label="TestActivity13"
android:targetActivity="com.android.launcher3.testcomponent.OtherBaseTestingActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity-alias>
<activity-alias android:name="Activity14" android:exported="true"
android:label="TestActivity14"
android:targetActivity="com.android.launcher3.testcomponent.OtherBaseTestingActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity-alias>
</application>
</manifest>