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
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java
index 2ac6098..2006ecc 100644
--- a/src/com/android/launcher3/DeviceProfile.java
+++ b/src/com/android/launcher3/DeviceProfile.java
@@ -299,6 +299,7 @@
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 @@
}
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 @@
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. */