summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/CellLayout.java
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2015-05-21 20:46:33 -0700
committerSunny Goyal <sunnygoyal@google.com>2015-05-22 08:46:41 -0700
commitc6205603efe1f2987caf96504c87d720a25b5a94 (patch)
tree19a1c13def0784a3f3edc1e69aab87251820cbcf /src/com/android/launcher3/CellLayout.java
parent2805e639cdea6ae0051155611d122ed27556e658 (diff)
downloadandroid_packages_apps_Trebuchet-c6205603efe1f2987caf96504c87d720a25b5a94.tar.gz
android_packages_apps_Trebuchet-c6205603efe1f2987caf96504c87d720a25b5a94.tar.bz2
android_packages_apps_Trebuchet-c6205603efe1f2987caf96504c87d720a25b5a94.zip
Creating landscape and portrait device profiles at app initialization
Change-Id: Ide9d007adc36b348e19b05cdf49e87f8b02db60e
Diffstat (limited to 'src/com/android/launcher3/CellLayout.java')
-rw-r--r--src/com/android/launcher3/CellLayout.java14
1 files changed, 5 insertions, 9 deletions
diff --git a/src/com/android/launcher3/CellLayout.java b/src/com/android/launcher3/CellLayout.java
index 4bf862d0d..2b1cfe0e4 100644
--- a/src/com/android/launcher3/CellLayout.java
+++ b/src/com/android/launcher3/CellLayout.java
@@ -821,8 +821,6 @@ public class CellLayout extends ViewGroup implements BubbleTextShadowHandler {
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
- DeviceProfile grid = mLauncher.getDeviceProfile();
-
int widthSpecMode = MeasureSpec.getMode(widthMeasureSpec);
int heightSpecMode = MeasureSpec.getMode(heightMeasureSpec);
int widthSize = MeasureSpec.getSize(widthMeasureSpec);
@@ -830,8 +828,8 @@ public class CellLayout extends ViewGroup implements BubbleTextShadowHandler {
int childWidthSize = widthSize - (getPaddingLeft() + getPaddingRight());
int childHeightSize = heightSize - (getPaddingTop() + getPaddingBottom());
if (mFixedCellWidth < 0 || mFixedCellHeight < 0) {
- int cw = grid.calculateCellWidth(childWidthSize, mCountX);
- int ch = grid.calculateCellHeight(childHeightSize, mCountY);
+ int cw = DeviceProfile.calculateCellWidth(childWidthSize, mCountX);
+ int ch = DeviceProfile.calculateCellHeight(childHeightSize, mCountY);
if (cw != mCellWidth || ch != mCellHeight) {
mCellWidth = cw;
mCellHeight = ch;
@@ -2714,16 +2712,14 @@ public class CellLayout extends ViewGroup implements BubbleTextShadowHandler {
* @param result An array of length 2 in which to store the result (may be null).
*/
public static int[] rectToCell(Launcher launcher, int width, int height, int[] result) {
- LauncherAppState app = LauncherAppState.getInstance();
DeviceProfile grid = launcher.getDeviceProfile();
- Rect padding = grid.getWorkspacePadding(grid.isLandscape ?
- CellLayout.LANDSCAPE : CellLayout.PORTRAIT);
+ Rect padding = grid.getWorkspacePadding(Utilities.isRtl(launcher.getResources()));
// Always assume we're working with the smallest span to make sure we
// reserve enough space in both orientations.
- int parentWidth = grid.calculateCellWidth(grid.widthPx
+ int parentWidth = DeviceProfile.calculateCellWidth(grid.widthPx
- padding.left - padding.right, (int) grid.inv.numColumns);
- int parentHeight = grid.calculateCellHeight(grid.heightPx
+ int parentHeight = DeviceProfile.calculateCellHeight(grid.heightPx
- padding.top - padding.bottom, (int) grid.inv.numRows);
int smallerSize = Math.min(parentWidth, parentHeight);