diff options
author | Michael Jurka <mikejurka@google.com> | 2012-06-21 08:36:45 -0700 |
---|---|---|
committer | Michael Jurka <mikejurka@google.com> | 2012-06-21 09:40:20 -0700 |
commit | 8bc66c7fe4d8f7ac1715010806f49840194279a5 (patch) | |
tree | fff0555d3b022a73f8b9a19bd8e0ef6b9078a125 /src | |
parent | 915500da4876e97abb07de1dfe23403e9dc27494 (diff) | |
download | android_packages_apps_Trebuchet-8bc66c7fe4d8f7ac1715010806f49840194279a5.tar.gz android_packages_apps_Trebuchet-8bc66c7fe4d8f7ac1715010806f49840194279a5.tar.bz2 android_packages_apps_Trebuchet-8bc66c7fe4d8f7ac1715010806f49840194279a5.zip |
Use getCurrentSizeRange to determine cell dimensions
Change-Id: I7b50ad85594585a3c18838776652c3d873dbd82d
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/launcher2/Workspace.java | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java index 4e0c3472d..699a3af3c 100644 --- a/src/com/android/launcher2/Workspace.java +++ b/src/com/android/launcher2/Workspace.java @@ -273,6 +273,7 @@ public class Workspace extends SmoothPagedView // With workspace, data is available straight from the get-go setDataIsReady(); + mLauncher = (Launcher) context; final Resources res = getResources(); mWorkspaceFadeInAdjacentScreens = res.getBoolean(R.bool.config_workspaceFadeAdjacentScreens); mFadeInAdjacentScreens = false; @@ -291,20 +292,20 @@ public class Workspace extends SmoothPagedView // landscape TypedArray actionBarSizeTypedArray = context.obtainStyledAttributes(new int[] { android.R.attr.actionBarSize }); - DisplayMetrics displayMetrics = res.getDisplayMetrics(); final float actionBarHeight = actionBarSizeTypedArray.getDimension(0, 0f); - final float systemBarHeight = res.getDimension(R.dimen.status_bar_height); - final float smallestScreenDim = res.getConfiguration().smallestScreenWidthDp * - displayMetrics.density; + + Point minDims = new Point(); + Point maxDims = new Point(); + mLauncher.getWindowManager().getDefaultDisplay().getCurrentSizeRange(minDims, maxDims); cellCountX = 1; - while (CellLayout.widthInPortrait(res, cellCountX + 1) <= smallestScreenDim) { + while (CellLayout.widthInPortrait(res, cellCountX + 1) <= minDims.x) { cellCountX++; } cellCountY = 1; while (actionBarHeight + CellLayout.heightInLandscape(res, cellCountY + 1) - <= smallestScreenDim - systemBarHeight) { + <= minDims.y) { cellCountY++; } } @@ -326,7 +327,6 @@ public class Workspace extends SmoothPagedView LauncherModel.updateWorkspaceLayoutCells(cellCountX, cellCountY); setHapticFeedbackEnabled(false); - mLauncher = (Launcher) context; initWorkspace(); // Disable multitouch across the workspace/all apps/customize tray |