Adjust workspace grid and cellLayout paddings.
This is a partial revert of ag/17540098 Bug: 202971709 Test: manual Change-Id: Ia49e48f336bcca906aae6b014d88f10421b83d0c
This commit is contained in:
@@ -22,8 +22,10 @@
|
||||
<dimen name="fastscroll_popup_text_size">24dp</dimen>
|
||||
|
||||
<!-- Dynamic grid -->
|
||||
<dimen name="dynamic_grid_edge_margin">15.28dp</dimen>
|
||||
<dimen name="dynamic_grid_icon_drawable_padding">4dp</dimen>
|
||||
<dimen name="dynamic_grid_drop_target_size">36dp</dimen>
|
||||
<dimen name="cell_layout_padding">20dp</dimen>
|
||||
|
||||
<!-- Hotseat -->
|
||||
<dimen name="dynamic_grid_hotseat_side_padding">16dp</dimen>
|
||||
|
||||
@@ -16,10 +16,17 @@
|
||||
-->
|
||||
|
||||
<resources>
|
||||
<!-- Hotseat -->
|
||||
<!-- Hotseat -->
|
||||
<dimen name="spring_loaded_hotseat_top_margin">44dp</dimen>
|
||||
|
||||
<!-- Dragging -->
|
||||
<!-- Dragging -->
|
||||
<dimen name="drop_target_top_margin">0dp</dimen>
|
||||
<dimen name="drop_target_bottom_margin">16dp</dimen>
|
||||
|
||||
<!-- Dynamic grid -->
|
||||
<dimen name="dynamic_grid_edge_margin">11.33dp</dimen>
|
||||
<dimen name="cell_layout_padding">11.33dp</dimen>
|
||||
|
||||
<!-- AllApps -->
|
||||
<dimen name="all_apps_bottom_sheet_horizontal_padding">52dp</dimen>
|
||||
</resources>
|
||||
|
||||
@@ -32,7 +32,9 @@
|
||||
<dimen name="fastscroll_popup_text_size">32dp</dimen>
|
||||
|
||||
<!-- Dynamic grid -->
|
||||
<dimen name="dynamic_grid_edge_margin">9dp</dimen>
|
||||
<dimen name="dynamic_grid_icon_drawable_padding">7dp</dimen>
|
||||
<dimen name="cell_layout_padding">9dp</dimen>
|
||||
|
||||
<!-- Hotseat -->
|
||||
<dimen name="dynamic_grid_hotseat_side_padding">0dp</dimen>
|
||||
|
||||
@@ -15,6 +15,13 @@
|
||||
-->
|
||||
|
||||
<resources>
|
||||
<!-- Dynamic grid -->
|
||||
<dimen name="dynamic_grid_edge_margin">21.93dp</dimen>
|
||||
<dimen name="cell_layout_padding">29.33dp</dimen>
|
||||
|
||||
<!-- AllApps -->
|
||||
<dimen name="all_apps_bottom_sheet_horizontal_padding">32dp</dimen>
|
||||
|
||||
<!-- Dragging-->
|
||||
<dimen name="drop_target_top_margin">0dp</dimen>
|
||||
<dimen name="drop_target_bottom_margin">32dp</dimen>
|
||||
|
||||
@@ -16,7 +16,11 @@
|
||||
|
||||
<resources>
|
||||
<!-- AllApps -->
|
||||
<dimen name="all_apps_bottom_sheet_horizontal_padding">65dp</dimen>
|
||||
<dimen name="all_apps_bottom_sheet_horizontal_padding">28dp</dimen>
|
||||
|
||||
<!-- Dynamic grid -->
|
||||
<dimen name="dynamic_grid_edge_margin">27.59dp</dimen>
|
||||
<dimen name="cell_layout_padding">36dp</dimen>
|
||||
|
||||
<!-- Dragging -->
|
||||
<dimen name="drop_target_text_size">20sp</dimen>
|
||||
|
||||
@@ -19,14 +19,14 @@
|
||||
<dimen name="click_shadow_elevation">4dp</dimen>
|
||||
|
||||
<!-- Dynamic Grid -->
|
||||
<dimen name="dynamic_grid_edge_margin">8dp</dimen>
|
||||
<dimen name="dynamic_grid_edge_margin">10.77dp</dimen>
|
||||
<dimen name="dynamic_grid_left_right_margin">8dp</dimen>
|
||||
<dimen name="dynamic_grid_icon_drawable_padding">7dp</dimen>
|
||||
<!-- Minimum space between workspace and hotseat in spring loaded mode -->
|
||||
<dimen name="dynamic_grid_min_spring_loaded_space">8dp</dimen>
|
||||
|
||||
<dimen name="dynamic_grid_cell_border_spacing">16dp</dimen>
|
||||
<dimen name="dynamic_grid_cell_layout_padding">5.5dp</dimen>
|
||||
<dimen name="cell_layout_padding">10.77dp</dimen>
|
||||
<dimen name="dynamic_grid_cell_padding_x">8dp</dimen>
|
||||
|
||||
<!-- Hotseat -->
|
||||
|
||||
@@ -97,16 +97,13 @@ public class DeviceProfile {
|
||||
private static final float TALL_DEVICE_EXTRA_SPACE_THRESHOLD_DP = 252;
|
||||
private static final float TALL_DEVICE_MORE_EXTRA_SPACE_THRESHOLD_DP = 268;
|
||||
|
||||
// To evenly space the icons, increase the left/right margins for tablets in portrait mode.
|
||||
private static final int PORTRAIT_TABLET_LEFT_RIGHT_PADDING_MULTIPLIER = 4;
|
||||
|
||||
// Workspace
|
||||
public final int desiredWorkspaceHorizontalMarginOriginalPx;
|
||||
public int desiredWorkspaceHorizontalMarginPx;
|
||||
public Point cellLayoutBorderSpaceOriginalPx;
|
||||
public Point cellLayoutBorderSpacePx;
|
||||
public final int cellLayoutPaddingLeftRightPx;
|
||||
public final int cellLayoutBottomPaddingPx;
|
||||
public Rect cellLayoutPaddingPx = new Rect();
|
||||
|
||||
public final int edgeMarginPx;
|
||||
public float workspaceSpringLoadShrunkTop;
|
||||
public float workspaceSpringLoadShrunkBottom;
|
||||
@@ -328,23 +325,6 @@ public class DeviceProfile {
|
||||
folderCellLayoutBorderSpacePx = new Point(folderCellLayoutBorderSpaceOriginalPx,
|
||||
folderCellLayoutBorderSpaceOriginalPx);
|
||||
|
||||
int cellLayoutPaddingLeftRightMultiplier = !isVerticalBarLayout() && isTablet
|
||||
? PORTRAIT_TABLET_LEFT_RIGHT_PADDING_MULTIPLIER : 1;
|
||||
int cellLayoutPadding = isScalableGrid
|
||||
? 0
|
||||
: res.getDimensionPixelSize(R.dimen.dynamic_grid_cell_layout_padding);
|
||||
|
||||
if (isTwoPanels) {
|
||||
cellLayoutPaddingLeftRightPx = 0;
|
||||
cellLayoutBottomPaddingPx = 0;
|
||||
} else if (isLandscape) {
|
||||
cellLayoutPaddingLeftRightPx = 0;
|
||||
cellLayoutBottomPaddingPx = cellLayoutPadding;
|
||||
} else {
|
||||
cellLayoutPaddingLeftRightPx = cellLayoutPaddingLeftRightMultiplier * cellLayoutPadding;
|
||||
cellLayoutBottomPaddingPx = 0;
|
||||
}
|
||||
|
||||
workspacePageIndicatorHeight = res.getDimensionPixelSize(
|
||||
R.dimen.workspace_page_indicator_height);
|
||||
mWorkspacePageIndicatorOverlapWorkspace =
|
||||
@@ -498,6 +478,12 @@ public class DeviceProfile {
|
||||
// Recalculate the available dimensions using the new hotseat size.
|
||||
updateAvailableDimensions(res);
|
||||
}
|
||||
|
||||
int cellLayoutPadding =
|
||||
isTwoPanels ? cellLayoutBorderSpacePx.x / 2 : res.getDimensionPixelSize(
|
||||
R.dimen.cell_layout_padding);
|
||||
cellLayoutPaddingPx = new Rect(cellLayoutPadding, cellLayoutPadding, cellLayoutPadding,
|
||||
cellLayoutPadding);
|
||||
updateWorkspacePadding();
|
||||
|
||||
flingToDeleteThresholdVelocity = res.getDimensionPixelSize(
|
||||
@@ -610,7 +596,6 @@ public class DeviceProfile {
|
||||
float appWidgetScaleX = (float) profile.getCellSize().x / getCellSize().x;
|
||||
float appWidgetScaleY = (float) profile.getCellSize().y / getCellSize().y;
|
||||
profile.appWidgetScale.set(appWidgetScaleX, appWidgetScaleY);
|
||||
profile.updateWorkspacePadding();
|
||||
|
||||
return profile;
|
||||
}
|
||||
@@ -645,18 +630,19 @@ public class DeviceProfile {
|
||||
}
|
||||
|
||||
private void updateAllAppsContainerWidth(Resources res) {
|
||||
|
||||
int cellLayoutHorizontalPadding =
|
||||
(cellLayoutPaddingPx.left + cellLayoutPaddingPx.right) / 2;
|
||||
if (isTablet) {
|
||||
allAppsLeftRightPadding =
|
||||
res.getDimensionPixelSize(R.dimen.all_apps_bottom_sheet_horizontal_padding)
|
||||
+ cellLayoutPaddingLeftRightPx;
|
||||
res.getDimensionPixelSize(R.dimen.all_apps_bottom_sheet_horizontal_padding);
|
||||
|
||||
int usedWidth = (allAppsCellWidthPx * numShownAllAppsColumns)
|
||||
+ (allAppsBorderSpacePx.x * (numShownAllAppsColumns - 1))
|
||||
+ allAppsLeftRightPadding * 2;
|
||||
allAppsLeftRightMargin = Math.max(1, (availableWidthPx - usedWidth) / 2);
|
||||
} else {
|
||||
allAppsLeftRightPadding =
|
||||
desiredWorkspaceHorizontalMarginPx + cellLayoutPaddingLeftRightPx;
|
||||
desiredWorkspaceHorizontalMarginPx + cellLayoutHorizontalPadding;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -666,11 +652,12 @@ public class DeviceProfile {
|
||||
private int updateAvailableDimensions(Resources res) {
|
||||
updateIconSize(1f, res);
|
||||
|
||||
updateWorkspacePadding();
|
||||
Point workspacePadding = getTotalWorkspacePadding();
|
||||
|
||||
// Check to see if the icons fit within the available height.
|
||||
float usedHeight = getCellLayoutHeight();
|
||||
final int maxHeight = availableHeightPx - workspacePadding.y;
|
||||
final int maxHeight = getWorkspaceHeight(workspacePadding);
|
||||
float extraHeight = Math.max(0, maxHeight - usedHeight);
|
||||
float scaleY = maxHeight / usedHeight;
|
||||
boolean shouldScale = scaleY < 1f;
|
||||
@@ -680,10 +667,7 @@ public class DeviceProfile {
|
||||
// We scale to fit the cellWidth and cellHeight in the available space.
|
||||
// The benefit of scalable grids is that we can get consistent aspect ratios between
|
||||
// devices.
|
||||
int numColumns = isTwoPanels ? inv.numColumns * 2 : inv.numColumns;
|
||||
float usedWidth = (cellWidthPx * numColumns)
|
||||
+ (cellLayoutBorderSpacePx.x * (numColumns - 1))
|
||||
+ (desiredWorkspaceHorizontalMarginPx * 2);
|
||||
float usedWidth = getCellLayoutWidth() + (desiredWorkspaceHorizontalMarginPx * 2);
|
||||
// We do not subtract padding here, as we also scale the workspace padding if needed.
|
||||
scaleX = availableWidthPx / usedWidth;
|
||||
shouldScale = true;
|
||||
@@ -700,7 +684,14 @@ public class DeviceProfile {
|
||||
}
|
||||
|
||||
private int getCellLayoutHeight() {
|
||||
return (cellHeightPx * inv.numRows) + (cellLayoutBorderSpacePx.y * (inv.numRows - 1));
|
||||
return (cellHeightPx * inv.numRows) + (cellLayoutBorderSpacePx.y * (inv.numRows - 1))
|
||||
+ cellLayoutPaddingPx.top + cellLayoutPaddingPx.bottom;
|
||||
}
|
||||
|
||||
private int getCellLayoutWidth() {
|
||||
int numColumns = isTwoPanels ? inv.numColumns * 2 : inv.numColumns;
|
||||
return (cellWidthPx * numColumns) + (cellLayoutBorderSpacePx.x * (numColumns - 1))
|
||||
+ cellLayoutPaddingPx.left + cellLayoutPaddingPx.right;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -869,7 +860,6 @@ public class DeviceProfile {
|
||||
|
||||
public void updateInsets(Rect insets) {
|
||||
mInsets.set(insets);
|
||||
updateWorkspacePadding();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -896,8 +886,8 @@ public class DeviceProfile {
|
||||
int numColumns = isTwoPanels ? inv.numColumns * 2 : inv.numColumns;
|
||||
int screenWidthPx = getWorkspaceWidth(padding);
|
||||
result.x = calculateCellWidth(screenWidthPx, cellLayoutBorderSpacePx.x, numColumns);
|
||||
result.y = calculateCellHeight(availableHeightPx - padding.y
|
||||
- cellLayoutBottomPaddingPx, cellLayoutBorderSpacePx.y, inv.numRows);
|
||||
int screenHeightPx = getWorkspaceHeight(padding);
|
||||
result.y = calculateCellHeight(screenHeightPx, cellLayoutBorderSpacePx.y, inv.numRows);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -942,12 +932,16 @@ public class DeviceProfile {
|
||||
|
||||
public int getWorkspaceWidth(Point workspacePadding) {
|
||||
int cellLayoutTotalPadding =
|
||||
isTwoPanels ? 4 * cellLayoutPaddingLeftRightPx : 2 * cellLayoutPaddingLeftRightPx;
|
||||
(isTwoPanels ? 2 : 1) * (cellLayoutPaddingPx.left + cellLayoutPaddingPx.right);
|
||||
return availableWidthPx - workspacePadding.x - cellLayoutTotalPadding;
|
||||
}
|
||||
|
||||
private int getWorkspaceHeight(Point workspacePadding) {
|
||||
return availableHeightPx - workspacePadding.y - (cellLayoutPaddingPx.top
|
||||
+ cellLayoutPaddingPx.bottom);
|
||||
}
|
||||
|
||||
public Point getTotalWorkspacePadding() {
|
||||
updateWorkspacePadding();
|
||||
return new Point(workspacePadding.left + workspacePadding.right,
|
||||
workspacePadding.top + workspacePadding.bottom);
|
||||
}
|
||||
@@ -973,12 +967,26 @@ public class DeviceProfile {
|
||||
int hotseatTop = hotseatBarSizePx;
|
||||
int paddingBottom = hotseatTop + workspacePageIndicatorHeight
|
||||
+ workspaceBottomPadding - mWorkspacePageIndicatorOverlapWorkspace;
|
||||
int paddingTop = workspaceTopPadding + (isScalableGrid ? 0 : edgeMarginPx);
|
||||
int paddingSide = desiredWorkspaceHorizontalMarginPx;
|
||||
|
||||
padding.set(desiredWorkspaceHorizontalMarginPx,
|
||||
workspaceTopPadding + (isScalableGrid ? 0 : edgeMarginPx),
|
||||
desiredWorkspaceHorizontalMarginPx,
|
||||
paddingBottom);
|
||||
padding.set(paddingSide, paddingTop, paddingSide, paddingBottom);
|
||||
}
|
||||
insetPadding(workspacePadding, cellLayoutPaddingPx);
|
||||
}
|
||||
|
||||
private void insetPadding(Rect paddings, Rect insets) {
|
||||
insets.left = Math.min(insets.left, paddings.left);
|
||||
paddings.left -= insets.left;
|
||||
|
||||
insets.top = Math.min(insets.top, paddings.top);
|
||||
paddings.top -= insets.top;
|
||||
|
||||
insets.right = Math.min(insets.right, paddings.right);
|
||||
paddings.right -= insets.right;
|
||||
|
||||
insets.bottom = Math.min(insets.bottom, paddings.bottom);
|
||||
paddings.bottom -= insets.bottom;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -992,16 +1000,17 @@ public class DeviceProfile {
|
||||
// Workspace icons are moved up by a small factor. The variable diffOverlapFactor
|
||||
// is set to account for that difference.
|
||||
float diffOverlapFactor = iconSizePx * (ICON_OVERLAP_FACTOR - 1) / 2;
|
||||
int paddingTop = Math.max((int) (mInsets.top - diffOverlapFactor), 0);
|
||||
int paddingBottom = Math.max((int) (mInsets.bottom + cellLayoutBottomPaddingPx
|
||||
int paddingTop = Math.max((int) (mInsets.top + cellLayoutPaddingPx.top
|
||||
- diffOverlapFactor), 0);
|
||||
int paddingBottom = Math.max((int) (mInsets.bottom + cellLayoutPaddingPx.bottom
|
||||
+ diffOverlapFactor), 0);
|
||||
|
||||
if (isSeascape()) {
|
||||
mHotseatPadding.set(mInsets.left + hotseatBarSidePaddingStartPx,
|
||||
mInsets.top, hotseatBarSidePaddingEndPx, mInsets.bottom);
|
||||
mHotseatPadding.set(mInsets.left + hotseatBarSidePaddingStartPx, paddingTop,
|
||||
hotseatBarSidePaddingEndPx, paddingBottom);
|
||||
} else {
|
||||
mHotseatPadding.set(hotseatBarSidePaddingEndPx, mInsets.top,
|
||||
mInsets.right + hotseatBarSidePaddingStartPx, mInsets.bottom);
|
||||
mHotseatPadding.set(hotseatBarSidePaddingEndPx, paddingTop,
|
||||
mInsets.right + hotseatBarSidePaddingStartPx, paddingBottom);
|
||||
}
|
||||
} else if (isTaskbarPresent) {
|
||||
int hotseatHeight = workspacePadding.bottom;
|
||||
@@ -1040,14 +1049,12 @@ public class DeviceProfile {
|
||||
float workspaceCellWidth = (float) widthPx / inv.numColumns;
|
||||
float hotseatCellWidth = (float) widthPx / numShownHotseatIcons;
|
||||
int hotseatAdjustment = Math.round((workspaceCellWidth - hotseatCellWidth) / 2);
|
||||
mHotseatPadding.set(
|
||||
hotseatAdjustment + workspacePadding.left + cellLayoutPaddingLeftRightPx
|
||||
+ mInsets.left,
|
||||
hotseatBarTopPaddingPx,
|
||||
hotseatAdjustment + workspacePadding.right + cellLayoutPaddingLeftRightPx
|
||||
mHotseatPadding.set(hotseatAdjustment + workspacePadding.left + cellLayoutPaddingPx.left
|
||||
+ mInsets.left, hotseatBarTopPaddingPx,
|
||||
hotseatAdjustment + workspacePadding.right + cellLayoutPaddingPx.right
|
||||
+ mInsets.right,
|
||||
hotseatBarSizePx - hotseatCellHeightPx - hotseatBarTopPaddingPx
|
||||
+ cellLayoutBottomPaddingPx + mInsets.bottom);
|
||||
+ mInsets.bottom);
|
||||
}
|
||||
return mHotseatPadding;
|
||||
}
|
||||
@@ -1131,6 +1138,8 @@ public class DeviceProfile {
|
||||
.getInfo().rotation == Surface.ROTATION_270;
|
||||
if (mIsSeascape != isSeascape) {
|
||||
mIsSeascape = isSeascape;
|
||||
// Hotseat changing sides requires updating workspace left/right paddings
|
||||
updateWorkspacePadding();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1208,6 +1217,11 @@ public class DeviceProfile {
|
||||
cellLayoutBorderSpacePx.x));
|
||||
writer.println(prefix + pxToDpStr("cellLayoutBorderSpacePx Vertical",
|
||||
cellLayoutBorderSpacePx.y));
|
||||
writer.println(prefix + pxToDpStr("cellLayoutPaddingPx.left", cellLayoutPaddingPx.left));
|
||||
writer.println(prefix + pxToDpStr("cellLayoutPaddingPx.top", cellLayoutPaddingPx.top));
|
||||
writer.println(prefix + pxToDpStr("cellLayoutPaddingPx.right", cellLayoutPaddingPx.right));
|
||||
writer.println(
|
||||
prefix + pxToDpStr("cellLayoutPaddingPx.bottom", cellLayoutPaddingPx.bottom));
|
||||
|
||||
writer.println(prefix + pxToDpStr("iconSizePx", iconSizePx));
|
||||
writer.println(prefix + pxToDpStr("iconTextSizePx", iconTextSizePx));
|
||||
|
||||
@@ -325,37 +325,14 @@ public class Workspace extends PagedView<WorkspacePageIndicator>
|
||||
setPageSpacing(Math.max(maxInsets, maxPadding));
|
||||
}
|
||||
|
||||
updateWorkspaceScreensPadding();
|
||||
updateCellLayoutPadding();
|
||||
updateWorkspaceWidgetsSizes();
|
||||
}
|
||||
|
||||
private void updateWorkspaceScreensPadding() {
|
||||
DeviceProfile grid = mLauncher.getDeviceProfile();
|
||||
int paddingLeftRight = grid.cellLayoutPaddingLeftRightPx;
|
||||
int paddingBottom = grid.cellLayoutBottomPaddingPx;
|
||||
|
||||
int panelCount = getPanelCount();
|
||||
int rightPanelModulus = mIsRtl ? 0 : panelCount - 1;
|
||||
int leftPanelModulus = mIsRtl ? panelCount - 1 : 0;
|
||||
int numberOfScreens = mScreenOrder.size();
|
||||
for (int i = 0; i < numberOfScreens; i++) {
|
||||
int paddingLeft = paddingLeftRight;
|
||||
int paddingRight = paddingLeftRight;
|
||||
// Add missing cellLayout border in-between panels.
|
||||
if (panelCount > 1) {
|
||||
if (i % panelCount == leftPanelModulus) {
|
||||
paddingRight += grid.cellLayoutBorderSpacePx.x / 2;
|
||||
} else if (i % panelCount == rightPanelModulus) { // right side panel
|
||||
paddingLeft += grid.cellLayoutBorderSpacePx.x / 2;
|
||||
} else { // middle panel
|
||||
paddingLeft += grid.cellLayoutBorderSpacePx.x / 2;
|
||||
paddingRight += grid.cellLayoutBorderSpacePx.x / 2;
|
||||
}
|
||||
}
|
||||
// SparseArrayMap doesn't keep the order
|
||||
mWorkspaceScreens.get(mScreenOrder.get(i))
|
||||
.setPadding(paddingLeft, 0, paddingRight, paddingBottom);
|
||||
}
|
||||
private void updateCellLayoutPadding() {
|
||||
Rect padding = mLauncher.getDeviceProfile().cellLayoutPaddingPx;
|
||||
mWorkspaceScreens.forEach(
|
||||
s -> s.setPadding(padding.left, padding.top, padding.right, padding.bottom));
|
||||
}
|
||||
|
||||
private void updateWorkspaceWidgetsSizes() {
|
||||
@@ -653,7 +630,7 @@ public class Workspace extends PagedView<WorkspacePageIndicator>
|
||||
mLauncher.getStateManager().getState(), newScreen, insertIndex);
|
||||
|
||||
updatePageScrollValues();
|
||||
updateWorkspaceScreensPadding();
|
||||
updateCellLayoutPadding();
|
||||
return newScreen;
|
||||
}
|
||||
|
||||
|
||||
@@ -225,21 +225,21 @@ public class LauncherPreviewRenderer extends ContextWrapper
|
||||
mHotseat.resetLayout(false);
|
||||
|
||||
CellLayout firstScreen = mRootView.findViewById(R.id.workspace);
|
||||
firstScreen.setPadding(mDp.workspacePadding.left + mDp.cellLayoutPaddingLeftRightPx,
|
||||
mDp.workspacePadding.top,
|
||||
firstScreen.setPadding(mDp.workspacePadding.left + mDp.cellLayoutPaddingPx.left,
|
||||
mDp.workspacePadding.top + mDp.cellLayoutPaddingPx.top,
|
||||
(mDp.isTwoPanels ? mDp.cellLayoutBorderSpacePx.x / 2
|
||||
: mDp.workspacePadding.right) + mDp.cellLayoutPaddingLeftRightPx,
|
||||
mDp.workspacePadding.bottom
|
||||
: mDp.workspacePadding.right) + mDp.cellLayoutPaddingPx.right,
|
||||
mDp.workspacePadding.bottom + mDp.cellLayoutPaddingPx.bottom
|
||||
);
|
||||
mWorkspaceScreens.put(FIRST_SCREEN_ID, firstScreen);
|
||||
|
||||
if (mDp.isTwoPanels) {
|
||||
CellLayout rightPanel = mRootView.findViewById(R.id.workspace_right);
|
||||
rightPanel.setPadding(
|
||||
mDp.cellLayoutBorderSpacePx.x / 2 + mDp.cellLayoutPaddingLeftRightPx,
|
||||
mDp.workspacePadding.top,
|
||||
mDp.workspacePadding.right + mDp.cellLayoutPaddingLeftRightPx,
|
||||
mDp.workspacePadding.bottom
|
||||
mDp.cellLayoutBorderSpacePx.x / 2 + mDp.cellLayoutPaddingPx.left,
|
||||
mDp.workspacePadding.top + mDp.cellLayoutPaddingPx.top,
|
||||
mDp.workspacePadding.right + mDp.cellLayoutPaddingPx.right,
|
||||
mDp.workspacePadding.bottom + mDp.cellLayoutPaddingPx.bottom
|
||||
);
|
||||
mWorkspaceScreens.put(Workspace.SECOND_SCREEN_ID, rightPanel);
|
||||
}
|
||||
|
||||
@@ -113,13 +113,17 @@ public class SecondaryDragLayer extends BaseDragLayer<SecondaryDisplayLauncher>
|
||||
for (int i = 0; i < count; i++) {
|
||||
final View child = getChildAt(i);
|
||||
if (child == mAppsView) {
|
||||
int padding = 2 * (grid.desiredWorkspaceHorizontalMarginPx
|
||||
+ grid.cellLayoutPaddingLeftRightPx);
|
||||
int horizontalPadding = (2 * grid.desiredWorkspaceHorizontalMarginPx)
|
||||
+ grid.cellLayoutPaddingPx.left + grid.cellLayoutPaddingPx.right;
|
||||
int verticalPadding =
|
||||
grid.cellLayoutPaddingPx.top + grid.cellLayoutPaddingPx.bottom;
|
||||
|
||||
int maxWidth = grid.allAppsCellWidthPx * grid.numShownAllAppsColumns + padding;
|
||||
int maxWidth =
|
||||
grid.allAppsCellWidthPx * grid.numShownAllAppsColumns + horizontalPadding;
|
||||
int appsWidth = Math.min(width, maxWidth);
|
||||
|
||||
int maxHeight = grid.allAppsCellHeightPx * grid.numShownAllAppsColumns + padding;
|
||||
int maxHeight =
|
||||
grid.allAppsCellHeightPx * grid.numShownAllAppsColumns + verticalPadding;
|
||||
int appsHeight = Math.min(height, maxHeight);
|
||||
|
||||
mAppsView.measure(
|
||||
|
||||
Reference in New Issue
Block a user