summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAdam Cohen <adamcohen@google.com>2011-09-16 17:32:37 -0700
committerAdam Cohen <adamcohen@google.com>2011-09-16 17:40:50 -0700
commitcbf47e38e24cc0d63b4bd3f345c050216f06f404 (patch)
treef8185fc7ba0868d89c8c2227a4d0758c08a925e0 /src
parent446e940fc8839173de12f1299b8c24f318d53a3f (diff)
downloadandroid_packages_apps_Trebuchet-cbf47e38e24cc0d63b4bd3f345c050216f06f404.tar.gz
android_packages_apps_Trebuchet-cbf47e38e24cc0d63b4bd3f345c050216f06f404.tar.bz2
android_packages_apps_Trebuchet-cbf47e38e24cc0d63b4bd3f345c050216f06f404.zip
Fixing widget minResizeWidth/Height interpretation (Issue 5327589)
Change-Id: I16bf9bb20baad4fa1e0676d98bb93de758af0ebc
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher2/AppWidgetResizeFrame.java8
-rw-r--r--src/com/android/launcher2/Launcher.java4
2 files changed, 9 insertions, 3 deletions
diff --git a/src/com/android/launcher2/AppWidgetResizeFrame.java b/src/com/android/launcher2/AppWidgetResizeFrame.java
index c7dbc0f77..476219374 100644
--- a/src/com/android/launcher2/AppWidgetResizeFrame.java
+++ b/src/com/android/launcher2/AppWidgetResizeFrame.java
@@ -64,11 +64,13 @@ public class AppWidgetResizeFrame extends FrameLayout {
public static final int RIGHT = 2;
public static final int BOTTOM = 3;
+ private Launcher mLauncher;
+
public AppWidgetResizeFrame(Context context, ItemInfo itemInfo,
LauncherAppWidgetHostView widgetView, CellLayout cellLayout, DragLayer dragLayer) {
super(context);
- mContext = context;
+ mLauncher = (Launcher) context;
mItemInfo = itemInfo;
mCellLayout = cellLayout;
mWidgetView = widgetView;
@@ -77,7 +79,7 @@ public class AppWidgetResizeFrame extends FrameLayout {
mWorkspace = (Workspace) dragLayer.findViewById(R.id.workspace);
final AppWidgetProviderInfo info = widgetView.getAppWidgetInfo();
- int[] result = mCellLayout.rectToCell(info.minResizeWidth, info.minResizeHeight, null);
+ int[] result = mLauncher.getMinResizeSpanForWidget(info, null);
mMinHSpan = result[0];
mMinVSpan = result[1];
@@ -123,7 +125,7 @@ public class AppWidgetResizeFrame extends FrameLayout {
mRightHandle.setVisibility(GONE);
}
- final float density = mContext.getResources().getDisplayMetrics().density;
+ final float density = mLauncher.getResources().getDisplayMetrics().density;
mBackgroundPadding = (int) Math.ceil(density * BACKGROUND_PADDING);
mTouchTargetWidth = 2 * mBackgroundPadding;
}
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index c3edb9974..b6393ca01 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -902,6 +902,10 @@ public final class Launcher extends Activity
return getSpanForWidget(info.provider, info.minWidth, info.minHeight, spanXY);
}
+ int[] getMinResizeSpanForWidget(AppWidgetProviderInfo info, int[] spanXY) {
+ return getSpanForWidget(info.provider, info.minResizeWidth, info.minResizeHeight, spanXY);
+ }
+
int[] getSpanForWidget(PendingAddWidgetInfo info, int[] spanXY) {
return getSpanForWidget(info.componentName, info.minWidth, info.minHeight, spanXY);
}