summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/LauncherAppWidgetHostView.java
diff options
context:
space:
mode:
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;