summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/AppsCustomizePagedView.java
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2014-08-11 02:56:58 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-08-10 19:43:29 +0000
commitd3ad9828d15f9c8fa435f2d59cd5a18e9ebee100 (patch)
tree775b26f707ad5f5cf570f1d48a5a97b597b56473 /src/com/android/launcher3/AppsCustomizePagedView.java
parent77c1376c67ce7e259b8eca77bd5ba8f4fa7d4b86 (diff)
parentff572277112ec3d6a6a8c1be274d6fa1019e3648 (diff)
downloadandroid_packages_apps_Trebuchet-d3ad9828d15f9c8fa435f2d59cd5a18e9ebee100.tar.gz
android_packages_apps_Trebuchet-d3ad9828d15f9c8fa435f2d59cd5a18e9ebee100.tar.bz2
android_packages_apps_Trebuchet-d3ad9828d15f9c8fa435f2d59cd5a18e9ebee100.zip
Merge "Adding support to restore widgets even for jelly beans." into ub-now-porkchop
Diffstat (limited to 'src/com/android/launcher3/AppsCustomizePagedView.java')
-rw-r--r--src/com/android/launcher3/AppsCustomizePagedView.java20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/com/android/launcher3/AppsCustomizePagedView.java b/src/com/android/launcher3/AppsCustomizePagedView.java
index 98a06f1e1..b98a39196 100644
--- a/src/com/android/launcher3/AppsCustomizePagedView.java
+++ b/src/com/android/launcher3/AppsCustomizePagedView.java
@@ -148,6 +148,8 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
LauncherTransitionable {
static final String TAG = "AppsCustomizePagedView";
+ private static Rect sTmpRect = new Rect();
+
/**
* The different content types that this paged view can show.
*/
@@ -223,8 +225,6 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
private ArrayList<Runnable> mDeferredPrepareLoadWidgetPreviewsTasks =
new ArrayList<Runnable>();
- private Rect mTmpRect = new Rect();
-
WidgetPreviewLoader mWidgetPreviewLoader;
private boolean mInBulkBind;
@@ -538,26 +538,26 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
mLauncher.getWorkspace().beginDragShared(v, this);
}
- Bundle getDefaultOptionsForWidget(Launcher launcher, PendingAddWidgetInfo info) {
+ static Bundle getDefaultOptionsForWidget(Launcher launcher, PendingAddWidgetInfo info) {
Bundle options = null;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
- AppWidgetResizeFrame.getWidgetSizeRanges(mLauncher, info.spanX, info.spanY, mTmpRect);
- Rect padding = AppWidgetHostView.getDefaultPaddingForWidget(mLauncher,
+ AppWidgetResizeFrame.getWidgetSizeRanges(launcher, info.spanX, info.spanY, sTmpRect);
+ Rect padding = AppWidgetHostView.getDefaultPaddingForWidget(launcher,
info.componentName, null);
- float density = getResources().getDisplayMetrics().density;
+ float density = launcher.getResources().getDisplayMetrics().density;
int xPaddingDips = (int) ((padding.left + padding.right) / density);
int yPaddingDips = (int) ((padding.top + padding.bottom) / density);
options = new Bundle();
options.putInt(AppWidgetManager.OPTION_APPWIDGET_MIN_WIDTH,
- mTmpRect.left - xPaddingDips);
+ sTmpRect.left - xPaddingDips);
options.putInt(AppWidgetManager.OPTION_APPWIDGET_MIN_HEIGHT,
- mTmpRect.top - yPaddingDips);
+ sTmpRect.top - yPaddingDips);
options.putInt(AppWidgetManager.OPTION_APPWIDGET_MAX_WIDTH,
- mTmpRect.right - xPaddingDips);
+ sTmpRect.right - xPaddingDips);
options.putInt(AppWidgetManager.OPTION_APPWIDGET_MAX_HEIGHT,
- mTmpRect.bottom - yPaddingDips);
+ sTmpRect.bottom - yPaddingDips);
}
return options;
}