summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/LauncherAppWidgetHostView.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/LauncherAppWidgetHostView.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/LauncherAppWidgetHostView.java')
-rw-r--r--src/com/android/launcher3/LauncherAppWidgetHostView.java33
1 files changed, 5 insertions, 28 deletions
diff --git a/src/com/android/launcher3/LauncherAppWidgetHostView.java b/src/com/android/launcher3/LauncherAppWidgetHostView.java
index 7eb005255..e39727b17 100644
--- a/src/com/android/launcher3/LauncherAppWidgetHostView.java
+++ b/src/com/android/launcher3/LauncherAppWidgetHostView.java
@@ -18,7 +18,6 @@ package com.android.launcher3;
import android.appwidget.AppWidgetHostView;
import android.content.Context;
-import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
@@ -32,36 +31,22 @@ import com.android.launcher3.DragLayer.TouchCompleteListener;
* {@inheritDoc}
*/
public class LauncherAppWidgetHostView extends AppWidgetHostView implements TouchCompleteListener {
+
+ LayoutInflater mInflater;
+
private CheckLongPressHelper mLongPressHelper;
- private LayoutInflater mInflater;
private Context mContext;
private int mPreviousOrientation;
private DragLayer mDragLayer;
private float mSlop;
- private boolean mWidgetReady;
-
public LauncherAppWidgetHostView(Context context) {
- this(context, true);
- }
-
- public LauncherAppWidgetHostView(Context context, boolean widgetReady) {
super(context);
mContext = context;
mLongPressHelper = new CheckLongPressHelper(this);
mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
mDragLayer = ((Launcher) context).getDragLayer();
- mWidgetReady = widgetReady;
- }
-
- @Override
- public void updateAppWidgetSize(Bundle newOptions, int minWidth, int minHeight, int maxWidth,
- int maxHeight) {
- // If the widget is not yet ready, the app widget size cannot be updated.
- if (mWidgetReady) {
- super.updateAppWidgetSize(newOptions, minWidth, minHeight, maxWidth, maxHeight);
- }
}
@Override
@@ -70,22 +55,14 @@ public class LauncherAppWidgetHostView extends AppWidgetHostView implements Touc
}
@Override
- protected View getDefaultView() {
- if (mWidgetReady) {
- return super.getDefaultView();
- } else {
- return mInflater.inflate(R.layout.appwidget_not_ready, this, false);
- }
- }
-
- @Override
public void updateAppWidget(RemoteViews remoteViews) {
// Store the orientation in which the widget was inflated
mPreviousOrientation = mContext.getResources().getConfiguration().orientation;
super.updateAppWidget(remoteViews);
}
- public boolean orientationChangedSincedInflation() {
+ public boolean isReinflateRequired() {
+ // Re-inflate is required if the orientation has changed since last inflated.
int orientation = mContext.getResources().getConfiguration().orientation;
if (mPreviousOrientation != orientation) {
return true;