summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoe Onorato <joeo@android.com>2009-09-21 15:23:04 -0400
committerJoe Onorato <joeo@android.com>2009-09-21 15:23:04 -0400
commit79e56263dbcbe85dc434df372bc6e6730aa13477 (patch)
treee7443cc4e9234c7d369fbabbf4a53f717e70e2f8
parentc91f928a8ac645b4c4746f946e8ea71299fca092 (diff)
downloadandroid_packages_apps_Trebuchet-79e56263dbcbe85dc434df372bc6e6730aa13477.tar.gz
android_packages_apps_Trebuchet-79e56263dbcbe85dc434df372bc6e6730aa13477.tar.bz2
android_packages_apps_Trebuchet-79e56263dbcbe85dc434df372bc6e6730aa13477.zip
Fix the way Home computes the cell span of widgets.
This was causing problem on some WVGA devices. Change-Id: Ic02c0c70fabad7e9c4a7425d6a98cceb7803538f
-rw-r--r--res/values-land/dimens.xml5
-rw-r--r--src/com/android/launcher2/CellLayout.java9
2 files changed, 10 insertions, 4 deletions
diff --git a/res/values-land/dimens.xml b/res/values-land/dimens.xml
index a9d5082f7..d2d31c27a 100644
--- a/res/values-land/dimens.xml
+++ b/res/values-land/dimens.xml
@@ -16,5 +16,8 @@
<resources>
<dimen name="workspace_cell_width">106dip</dimen>
- <dimen name="workspace_cell_height">73dip</dimen>
+ <dimen name="workspace_cell_height">74dip</dimen>
+ <dimen name="search_widget_inset">19dip</dimen>
+ <dimen name="gesture_thumbnail_inset">8dip</dimen>
+ <dimen name="gesture_thumbnail_size">64dip</dimen>
</resources>
diff --git a/src/com/android/launcher2/CellLayout.java b/src/com/android/launcher2/CellLayout.java
index b8d44a150..84e3766d7 100644
--- a/src/com/android/launcher2/CellLayout.java
+++ b/src/com/android/launcher2/CellLayout.java
@@ -18,6 +18,7 @@ package com.android.launcher2;
import android.content.Context;
import android.content.res.TypedArray;
+import android.content.res.Resources;
import android.graphics.Rect;
import android.graphics.RectF;
import android.util.AttributeSet;
@@ -685,13 +686,15 @@ public class CellLayout extends ViewGroup {
public int[] rectToCell(int width, int height) {
// Always assume we're working with the smallest span to make sure we
// reserve enough space in both orientations.
- int actualWidth = mCellWidth + mWidthGap;
- int actualHeight = mCellHeight + mHeightGap;
+ final Resources resources = getResources();
+ int actualWidth = resources.getDimensionPixelSize(R.dimen.workspace_cell_width);
+ int actualHeight = resources.getDimensionPixelSize(R.dimen.workspace_cell_height);
int smallerSize = Math.min(actualWidth, actualHeight);
-
+
// Always round up to next largest cell
int spanX = (width + smallerSize) / smallerSize;
int spanY = (height + smallerSize) / smallerSize;
+
return new int[] { spanX, spanY };
}