Removing some device profile dependencies in view contructors

Bug: 71709920
Change-Id: I13e33dceaeff71e3fb7bbb93f24be69c17d6da96
This commit is contained in:
Sunny Goyal
2018-01-16 14:17:20 -08:00
parent 000e0a1480
commit 12069e6cbf
5 changed files with 19 additions and 27 deletions

View File

@@ -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();