am 31e8624c: Merge "Fixing widget minResizeWidth/Height interpretation (Issue 5327589)" into ics-factoryrom

* commit '31e8624c4535e995d80d3df47823c1981ef71b70':
  Fixing widget minResizeWidth/Height interpretation (Issue 5327589)
This commit is contained in:
Adam Cohen
2011-09-18 16:02:28 -07:00
committed by Android Git Automerger
2 changed files with 9 additions and 3 deletions
@@ -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;
}
+4
View File
@@ -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);
}