diff --git a/src/com/android/launcher3/DeviceProfile.java b/src/com/android/launcher3/DeviceProfile.java index a2796334e0..164efe54a7 100644 --- a/src/com/android/launcher3/DeviceProfile.java +++ b/src/com/android/launcher3/DeviceProfile.java @@ -102,8 +102,6 @@ public class DeviceProfile { // All apps public int allAppsCellHeightPx; - public int allAppsNumCols; - public int allAppsNumPredictiveCols; public int allAppsIconSizePx; public int allAppsIconDrawablePaddingPx; public float allAppsIconTextSizePx; @@ -385,10 +383,6 @@ public class DeviceProfile { return mInsets; } - public void updateAppsViewNumCols() { - allAppsNumCols = allAppsNumPredictiveCols = inv.numColumns; - } - public Point getCellSize() { Point result = new Point(); // Since we are only concerned with the overall padding, layout direction does diff --git a/src/com/android/launcher3/Hotseat.java b/src/com/android/launcher3/Hotseat.java index 1f5aa138ce..25eacb52f2 100644 --- a/src/com/android/launcher3/Hotseat.java +++ b/src/com/android/launcher3/Hotseat.java @@ -46,7 +46,7 @@ public class Hotseat extends FrameLayout implements LogContainerProvider, Insett private CellLayout mContent; @ViewDebug.ExportedProperty(category = "launcher") - private final boolean mHasVerticalHotseat; + private boolean mHasVerticalHotseat; public Hotseat(Context context) { this(context, null); @@ -59,7 +59,6 @@ public class Hotseat extends FrameLayout implements LogContainerProvider, Insett public Hotseat(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); mLauncher = Launcher.getLauncher(context); - mHasVerticalHotseat = mLauncher.getDeviceProfile().isVerticalBarLayout(); } public CellLayout getLayout() { @@ -91,13 +90,7 @@ public class Hotseat extends FrameLayout implements LogContainerProvider, Insett @Override protected void onFinishInflate() { super.onFinishInflate(); - DeviceProfile grid = mLauncher.getDeviceProfile(); - mContent = (CellLayout) findViewById(R.id.layout); - if (grid.isVerticalBarLayout()) { - mContent.setGridSize(1, grid.inv.numHotseatIcons); - } else { - mContent.setGridSize(grid.inv.numHotseatIcons, 1); - } + mContent = findViewById(R.id.layout); resetLayout(); } @@ -165,7 +158,11 @@ public class Hotseat extends FrameLayout implements LogContainerProvider, Insett public void setInsets(Rect insets) { FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) getLayoutParams(); DeviceProfile grid = mLauncher.getDeviceProfile(); + mHasVerticalHotseat = mLauncher.getDeviceProfile().isVerticalBarLayout(); + if (mHasVerticalHotseat) { + mContent.setGridSize(1, grid.inv.numHotseatIcons); + lp.height = ViewGroup.LayoutParams.MATCH_PARENT; if (insets.left > insets.right) { lp.gravity = Gravity.LEFT; @@ -180,6 +177,8 @@ public class Hotseat extends FrameLayout implements LogContainerProvider, Insett grid.hotseatBarSidePaddingPx, insets.top, insets.right, insets.bottom); } } else { + mContent.setGridSize(grid.inv.numHotseatIcons, 1); + lp.gravity = Gravity.BOTTOM; lp.width = ViewGroup.LayoutParams.MATCH_PARENT; lp.height = grid.hotseatBarSizePx + insets.bottom; diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java index 2a5f45399b..e3682b4ec9 100644 --- a/src/com/android/launcher3/Launcher.java +++ b/src/com/android/launcher3/Launcher.java @@ -2552,10 +2552,6 @@ public class Launcher extends BaseActivity return bounceAnim; } - public boolean useVerticalBarLayout() { - return mDeviceProfile.isVerticalBarLayout(); - } - /** * Add the icons for all apps. * diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index 893d8202b2..de3b09a4a0 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -207,7 +207,7 @@ public class Workspace extends PagedView private boolean mStripScreensOnPageStopMoving = false; private DragPreviewProvider mOutlineProvider = null; - private final boolean mWorkspaceFadeInAdjacentScreens; + private boolean mWorkspaceFadeInAdjacentScreens; final WallpaperOffsetInterpolator mWallpaperOffset; private boolean mUnlockWallpaperFromDefaultPageOnLayout; @@ -292,8 +292,6 @@ public class Workspace extends PagedView mLauncher = Launcher.getLauncher(context); mStateTransitionAnimation = new WorkspaceStateTransitionAnimation(mLauncher, this); - DeviceProfile grid = mLauncher.getDeviceProfile(); - mWorkspaceFadeInAdjacentScreens = grid.shouldFadeAdjacentWorkspaceScreens(); mWallpaperManager = WallpaperManager.getInstance(context); mWallpaperOffset = new WallpaperOffsetInterpolator(this); @@ -312,6 +310,9 @@ public class Workspace extends PagedView mInsets.set(insets); DeviceProfile grid = mLauncher.getDeviceProfile(); + mMaxDistanceForFolderCreation = (0.55f * grid.iconSizePx); + mWorkspaceFadeInAdjacentScreens = grid.shouldFadeAdjacentWorkspaceScreens(); + Rect padding = grid.workspacePadding; setPadding(padding.left, padding.top, padding.right, padding.bottom); @@ -324,6 +325,13 @@ public class Workspace extends PagedView // We assume symmetrical padding in portrait mode. setPageSpacing(Math.max(grid.defaultPageSpacingPx, padding.left + 1)); } + + int paddingLeftRight = grid.cellLayoutPaddingLeftRightPx; + int paddingBottom = grid.cellLayoutBottomPaddingPx; + for (int i = mWorkspaceScreens.size() - 1; i >= 0; i--) { + mWorkspaceScreens.valueAt(i) + .setPadding(paddingLeftRight, 0, paddingLeftRight, paddingBottom); + } } /** @@ -445,12 +453,9 @@ public class Workspace extends PagedView */ protected void initWorkspace() { mCurrentPage = DEFAULT_PAGE; - DeviceProfile grid = mLauncher.getDeviceProfile(); - setWillNotDraw(false); setClipToPadding(false); setupLayoutTransition(); - mMaxDistanceForFolderCreation = (0.55f * grid.iconSizePx); // Set the wallpaper dimensions when Launcher starts up setWallpaperDimension(); diff --git a/src/com/android/launcher3/allapps/AllAppsContainerView.java b/src/com/android/launcher3/allapps/AllAppsContainerView.java index a40f8b3809..079a11c890 100644 --- a/src/com/android/launcher3/allapps/AllAppsContainerView.java +++ b/src/com/android/launcher3/allapps/AllAppsContainerView.java @@ -275,8 +275,6 @@ public class AllAppsContainerView extends RelativeLayout implements DragSource, @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { DeviceProfile grid = mLauncher.getDeviceProfile(); - // Update the number of items in the grid before we measure the view - grid.updateAppsViewNumCols(); if (mNumAppsPerRow != grid.inv.numColumns || mNumPredictedAppsPerRow != grid.inv.numColumns) {