mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-27 15:26:58 +00:00
Add margins to top and bottom when grid only overview enabled
Fix: 299100244 Test: OverviewImageTest and dump tests Flag: ACONFIG com.android.launcher3.enable_grid_only_overview TEAMFOOD Change-Id: I22ebced5bf1e27974036d6e2ef72d2b8d63df824
This commit is contained in:
@@ -84,4 +84,5 @@
|
||||
|
||||
<dimen name="keyboard_quick_switch_taskview_width">205dp</dimen>
|
||||
<dimen name="keyboard_quick_switch_taskview_height">119dp</dimen>
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -27,4 +27,10 @@
|
||||
<dimen name="gesture_tutorial_menu_done_button_top_spacing">40dp</dimen>
|
||||
<dimen name="gesture_tutorial_menu_back_shape_bottom_margin">49dp</dimen>
|
||||
|
||||
<!-- Grid Only Overview -->
|
||||
<!-- The top margin above the top row of tasks in grid only overview -->
|
||||
<dimen name="overview_top_margin_grid_only">24dp</dimen>
|
||||
<!-- The bottom margin above the bottom row of tasks in grid only overview -->
|
||||
<dimen name="overview_bottom_margin_grid_only">40dp</dimen>
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -33,6 +33,10 @@
|
||||
<dimen name="overview_page_spacing">36dp</dimen>
|
||||
<!-- The space to the left and to the right of the "Clear all" button -->
|
||||
<dimen name="overview_grid_side_margin">64dp</dimen>
|
||||
<!-- The top margin above the top row of tasks in grid only overview -->
|
||||
<dimen name="overview_top_margin_grid_only">80dp</dimen>
|
||||
<!-- The bottom margin above the bottom row of tasks in grid only overview -->
|
||||
<dimen name="overview_bottom_margin_grid_only">80dp</dimen>
|
||||
<!-- Overview actions -->
|
||||
<dimen name="overview_actions_top_margin">24dp</dimen>
|
||||
|
||||
|
||||
@@ -267,7 +267,7 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T
|
||||
Resources res = context.getResources();
|
||||
float maxScale = res.getFloat(R.dimen.overview_max_scale);
|
||||
Rect gridRect = new Rect();
|
||||
calculateGridSize(dp, gridRect);
|
||||
calculateGridSize(dp, context, gridRect);
|
||||
calculateTaskSizeInternal(context, dp, gridRect, maxScale, Gravity.CENTER, outRect);
|
||||
}
|
||||
|
||||
@@ -321,10 +321,16 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T
|
||||
/**
|
||||
* Calculates the overview grid size for the provided device configuration.
|
||||
*/
|
||||
public final void calculateGridSize(DeviceProfile dp, Rect outRect) {
|
||||
public final void calculateGridSize(DeviceProfile dp, Context context, Rect outRect) {
|
||||
Rect insets = dp.getInsets();
|
||||
int topMargin = dp.overviewTaskThumbnailTopMarginPx;
|
||||
int bottomMargin = dp.getOverviewActionsClaimedSpace();
|
||||
if (dp.isTaskbarPresent && Flags.enableGridOnlyOverview()) {
|
||||
topMargin += context.getResources().getDimensionPixelSize(
|
||||
R.dimen.overview_top_margin_grid_only);
|
||||
bottomMargin += context.getResources().getDimensionPixelSize(
|
||||
R.dimen.overview_bottom_margin_grid_only);
|
||||
}
|
||||
int sideMargin = dp.overviewGridSideMargin;
|
||||
|
||||
outRect.set(0, 0, dp.widthPx, dp.heightPx);
|
||||
@@ -340,7 +346,7 @@ public abstract class BaseActivityInterface<STATE_TYPE extends BaseState<STATE_T
|
||||
Resources res = context.getResources();
|
||||
Rect potentialTaskRect = new Rect();
|
||||
if (Flags.enableGridOnlyOverview()) {
|
||||
calculateGridSize(dp, potentialTaskRect);
|
||||
calculateGridSize(dp, context, potentialTaskRect);
|
||||
} else {
|
||||
calculateFocusTaskSize(context, dp, potentialTaskRect);
|
||||
}
|
||||
|
||||
@@ -2064,7 +2064,7 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
|
||||
dp.widthPx - mInsets.right - mTempRect.right,
|
||||
dp.heightPx - mInsets.bottom - mTempRect.bottom);
|
||||
|
||||
mSizeStrategy.calculateGridSize(mActivity.getDeviceProfile(),
|
||||
mSizeStrategy.calculateGridSize(mActivity.getDeviceProfile(), mActivity,
|
||||
mLastComputedGridSize);
|
||||
mSizeStrategy.calculateGridTaskSize(mActivity, mActivity.getDeviceProfile(),
|
||||
mLastComputedGridTaskSize, mOrientationHandler);
|
||||
|
||||
@@ -412,6 +412,9 @@
|
||||
<dimen name="overview_grid_side_margin">0dp</dimen>
|
||||
<dimen name="overview_grid_row_spacing">0dp</dimen>
|
||||
<dimen name="overview_page_spacing">0dp</dimen>
|
||||
<dimen name="overview_top_margin_grid_only">0dp</dimen>
|
||||
<dimen name="overview_bottom_margin_grid_only">0dp</dimen>
|
||||
|
||||
<dimen name="split_placeholder_size">72dp</dimen>
|
||||
<dimen name="split_placeholder_inset">16dp</dimen>
|
||||
<dimen name="split_placeholder_icon_size">44dp</dimen>
|
||||
@@ -423,7 +426,7 @@
|
||||
<dimen name="split_instructions_drawable_padding">10dp</dimen>
|
||||
<dimen name="split_instructions_bottom_margin_phone_landscape">24dp</dimen>
|
||||
<dimen name="split_instructions_bottom_margin_phone_portrait">60dp</dimen>
|
||||
|
||||
|
||||
<!-- Workspace grid visualization parameters -->
|
||||
<dimen name="grid_visualization_rounding_radius">28dp</dimen>
|
||||
<dimen name="grid_visualization_horizontal_cell_spacing">6dp</dimen>
|
||||
|
||||
@@ -299,6 +299,7 @@ public class DeviceProfile {
|
||||
public final int stashedTaskbarHeight;
|
||||
public final int taskbarBottomMargin;
|
||||
public final int taskbarIconSize;
|
||||
private final int mTransientTaskbarClaimedSpace;
|
||||
// If true, used to layout taskbar in 3 button navigation mode.
|
||||
public final boolean startAlignTaskbar;
|
||||
public final boolean isTransientTaskbar;
|
||||
@@ -370,18 +371,23 @@ public class DeviceProfile {
|
||||
}
|
||||
|
||||
this.isTransientTaskbar = isTransientTaskbar;
|
||||
int transientTaskbarIconSize = pxFromDp(inv.transientTaskbarIconSize[mTypeIndex], mMetrics);
|
||||
int transientTaskbarBottomMargin =
|
||||
res.getDimensionPixelSize(R.dimen.transient_taskbar_bottom_margin);
|
||||
int transientTaskbarHeight =
|
||||
Math.round((transientTaskbarIconSize * ICON_VISIBLE_AREA_FACTOR)
|
||||
+ (2 * res.getDimensionPixelSize(R.dimen.transient_taskbar_padding)));
|
||||
mTransientTaskbarClaimedSpace = transientTaskbarHeight + 2 * transientTaskbarBottomMargin;
|
||||
|
||||
if (!isTaskbarPresent) {
|
||||
taskbarIconSize = taskbarHeight = stashedTaskbarHeight = taskbarBottomMargin = 0;
|
||||
startAlignTaskbar = false;
|
||||
} else if (isTransientTaskbar) {
|
||||
float invTransientIconSizeDp = inv.transientTaskbarIconSize[mTypeIndex];
|
||||
taskbarIconSize = pxFromDp(invTransientIconSizeDp, mMetrics);
|
||||
taskbarHeight = Math.round((taskbarIconSize * ICON_VISIBLE_AREA_FACTOR)
|
||||
+ (2 * res.getDimensionPixelSize(R.dimen.transient_taskbar_padding)));
|
||||
taskbarIconSize = transientTaskbarIconSize;
|
||||
taskbarHeight = transientTaskbarHeight;
|
||||
stashedTaskbarHeight =
|
||||
res.getDimensionPixelSize(R.dimen.transient_taskbar_stashed_height);
|
||||
taskbarBottomMargin =
|
||||
res.getDimensionPixelSize(R.dimen.transient_taskbar_bottom_margin);
|
||||
taskbarBottomMargin = transientTaskbarBottomMargin;
|
||||
startAlignTaskbar = false;
|
||||
} else {
|
||||
taskbarIconSize = pxFromDp(ResourcesCompat.getFloat(res, R.dimen.taskbar_icon_size),
|
||||
@@ -1760,14 +1766,9 @@ public class DeviceProfile {
|
||||
return getHotseatBarBottomPadding() + launcherIconBottomSpace - taskbarIconBottomSpace;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of pixels required below OverviewActions excluding insets.
|
||||
*/
|
||||
/** Returns the number of pixels required below OverviewActions. */
|
||||
public int getOverviewActionsClaimedSpaceBelow() {
|
||||
if (isTaskbarPresent) {
|
||||
return taskbarHeight + taskbarBottomMargin * 2;
|
||||
}
|
||||
return mInsets.bottom;
|
||||
return isTaskbarPresent ? mTransientTaskbarClaimedSpace : mInsets.bottom;
|
||||
}
|
||||
|
||||
/** Gets the space that the overview actions will take, including bottom margin. */
|
||||
|
||||
@@ -40,19 +40,14 @@ filegroup {
|
||||
"src/com/android/launcher3/ui/PortraitLandscapeRunner.java",
|
||||
"src/com/android/launcher3/ui/TestViewHelpers.java",
|
||||
"src/com/android/launcher3/util/LauncherLayoutBuilder.java",
|
||||
"src/com/android/launcher3/util/ModelTestExtensions.kt",
|
||||
"src/com/android/launcher3/util/TestConstants.java",
|
||||
"src/com/android/launcher3/util/TestUtil.java",
|
||||
"src/com/android/launcher3/util/Wait.java",
|
||||
"src/com/android/launcher3/util/WidgetUtils.java",
|
||||
"src/com/android/launcher3/util/rule/FailureWatcher.java",
|
||||
"src/com/android/launcher3/util/rule/ViewCaptureRule.kt",
|
||||
"src/com/android/launcher3/util/rule/*.java",
|
||||
"src/com/android/launcher3/util/rule/*.kt",
|
||||
"src/com/android/launcher3/util/viewcapture_analysis/*.java",
|
||||
"src/com/android/launcher3/util/rule/SamplerRule.java",
|
||||
"src/com/android/launcher3/util/rule/ScreenRecordRule.java",
|
||||
"src/com/android/launcher3/util/rule/ShellCommandRule.java",
|
||||
"src/com/android/launcher3/util/rule/TestIsolationRule.java",
|
||||
"src/com/android/launcher3/util/rule/TestStabilityRule.java",
|
||||
"src/com/android/launcher3/util/ModelTestExtensions.kt",
|
||||
"src/com/android/launcher3/testcomponent/*.java",
|
||||
"src/com/android/launcher3/testcomponent/*.kt",
|
||||
],
|
||||
|
||||
23
tests/src/com/android/launcher3/util/rule/SetFlagsRuleExt.kt
Normal file
23
tests/src/com/android/launcher3/util/rule/SetFlagsRuleExt.kt
Normal file
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* Copyright (C) 2008 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.
|
||||
*/
|
||||
|
||||
package com.android.launcher3.util.rule
|
||||
|
||||
import android.platform.test.flag.junit.SetFlagsRule
|
||||
|
||||
fun SetFlagsRule.setFlags(enabled: Boolean, vararg flagName: String) {
|
||||
if (enabled) enableFlags(*flagName) else disableFlags(*flagName)
|
||||
}
|
||||
Reference in New Issue
Block a user