summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/AppsCustomizePagedView.java
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2014-07-23 13:58:07 -0700
committerSunny Goyal <sunnygoyal@google.com>2014-08-08 14:29:02 -0700
commitff572277112ec3d6a6a8c1be274d6fa1019e3648 (patch)
tree85212d0b7f7b217beb80892917ea88a7ac180947 /src/com/android/launcher3/AppsCustomizePagedView.java
parent6075170b838bfe7a040bbff25c2c22859b7d6ee5 (diff)
downloadandroid_packages_apps_Trebuchet-ff572277112ec3d6a6a8c1be274d6fa1019e3648.tar.gz
android_packages_apps_Trebuchet-ff572277112ec3d6a6a8c1be274d6fa1019e3648.tar.bz2
android_packages_apps_Trebuchet-ff572277112ec3d6a6a8c1be274d6fa1019e3648.zip
Adding support to restore widgets even for jelly beans.
> Show 'widget-not-ready' until the widget app is installed > Once the app is installed, bind a new widget id (not required on L if id-remap was received). **Remove the widget if bind failed > If the widget has no configuration screen, show the widget, otherwise show 'setup-widget'. > Clicking 'setup-widget' shows the config screen, and updates the widget on RESULT_OK. issue: 10779035 Change-Id: I2f8b06d09dd6acbc498cdd93edc59c26e5ce17af
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 0e9969697..5f2a36608 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;
@@ -540,26 +540,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;
}