Update drop target button alignment across devices
- Partial re-land of http://ag/18520765
- Layout the buttons from center of screen for two panels, or from center of workspace for all other cases
Bug: 229789612
Fix: 231706480
Fix: 232063941
Fix: 232283628
Test: manual
Change-Id: Icbc9e2a19140ce3127d5dfe9f798a8ada336cea8
diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java
index 4bb6f78..3ddc90e 100644
--- a/src/com/android/launcher3/DeviceProfile.java
+++ b/src/com/android/launcher3/DeviceProfile.java
@@ -108,6 +108,7 @@
public float workspaceSpringLoadShrunkTop;
public float workspaceSpringLoadShrunkBottom;
public final int workspaceSpringLoadedBottomSpace;
+ public final int workspaceSpringLoadedMinNextPageVisiblePx;
private final int extraSpace;
public int workspaceTopPadding;
@@ -344,6 +345,8 @@
workspaceSpringLoadedBottomSpace =
res.getDimensionPixelSize(R.dimen.dynamic_grid_min_spring_loaded_space);
+ workspaceSpringLoadedMinNextPageVisiblePx = res.getDimensionPixelSize(
+ R.dimen.dynamic_grid_spring_loaded_min_next_space_visible);
workspaceCellPaddingXPx = res.getDimensionPixelSize(R.dimen.dynamic_grid_cell_padding_x);
@@ -499,7 +502,7 @@
*/
private int calculateQsbWidth() {
if (isQsbInline) {
- int columns = isTwoPanels ? inv.numColumns * 2 : inv.numColumns;
+ int columns = getPanelCount() * inv.numColumns;
return getIconToIconWidthForColumns(columns)
- iconSizePx * numShownHotseatIcons
- hotseatBorderSpace * numShownHotseatIcons;
@@ -952,13 +955,6 @@
}
/**
- * Gets the minimum visible amount of the next workspace page when in the spring-loaded state.
- */
- private float getWorkspaceSpringLoadedMinimumNextPageVisible() {
- return getCellSize().x / 2f;
- }
-
- /**
* Gets the scale of the workspace for the spring-loaded edit state.
*/
public float getWorkspaceSpringLoadScale() {
@@ -969,8 +965,7 @@
// Reduce scale if next pages would not be visible after scaling the workspace
int workspaceWidth = availableWidthPx;
float scaledWorkspaceWidth = workspaceWidth * scale;
- float maxAvailableWidth =
- workspaceWidth - (2 * getWorkspaceSpringLoadedMinimumNextPageVisible());
+ float maxAvailableWidth = workspaceWidth - (2 * workspaceSpringLoadedMinNextPageVisiblePx);
if (scaledWorkspaceWidth > maxAvailableWidth) {
scale *= maxAvailableWidth / scaledWorkspaceWidth;
}
@@ -1414,6 +1409,10 @@
prefix + pxToDpStr("workspaceSpringLoadShrunkTop", workspaceSpringLoadShrunkTop));
writer.println(prefix + pxToDpStr("workspaceSpringLoadShrunkBottom",
workspaceSpringLoadShrunkBottom));
+ writer.println(prefix + pxToDpStr("workspaceSpringLoadedBottomSpace",
+ workspaceSpringLoadedBottomSpace));
+ writer.println(prefix + pxToDpStr("workspaceSpringLoadedMinNextPageVisiblePx",
+ workspaceSpringLoadedMinNextPageVisiblePx));
writer.println(
prefix + pxToDpStr("getWorkspaceSpringLoadScale()", getWorkspaceSpringLoadScale()));
}