diff options
author | Luca Stefani <luca.stefani.ge1@gmail.com> | 2020-03-07 13:43:59 +0100 |
---|---|---|
committer | Luca Stefani <luca.stefani.ge1@gmail.com> | 2020-03-07 13:43:59 +0100 |
commit | 0007a046cf4f4bfed563aa52ffab9ec5e94ee6f0 (patch) | |
tree | 2bc4acf2f54df560a34dcc7b7844d9d18cc58131 /src/com/android/launcher3/LauncherAppWidgetHost.java | |
parent | 744d192669a148bde24d36bef02deb05c2f7a1fa (diff) | |
parent | 02826bbe04d9dc1e6111f5d6ffd8706ac1f8f908 (diff) | |
download | android_packages_apps_Trebuchet-0007a046cf4f4bfed563aa52ffab9ec5e94ee6f0.tar.gz android_packages_apps_Trebuchet-0007a046cf4f4bfed563aa52ffab9ec5e94ee6f0.tar.bz2 android_packages_apps_Trebuchet-0007a046cf4f4bfed563aa52ffab9ec5e94ee6f0.zip |
Merge tag 'android-10.0.0_r31' into HEAD
Android 10.0.0 release 31
* tag 'android-10.0.0_r31': (218 commits)
Increase drag distance threshold when drag starts from deep press
Fix shortcut componentname in workspace layout logging
Fix shortcut componentname in workspace layout logging
perform accessbility focus when the recyclerview doesn't gain focus after fragment replacement in SettingsActivity
Persist predicted items when dragged to workspace
Import translations. DO NOT MERGE
Import translations. DO NOT MERGE
Align badging logic with platform IconDrawableFactory.
Fix bug where icon remains invisible after returning home.
Fix quick switch from home biased towards returning home
Fix recents scale sometimes lagging behind window scale
Fix folder open/close animation when grid size is small.
fix custom shortcut test
Improve quick switch from home by tracking both x and y motion
Move shelf peeking anim code to ShelfPeekAnim class
Fix folder available height calculation
Tapl: AllApps: ensuring a minimal vertical size of an icon
Enable a11y scrolling with item drag
disable custom shortcut test in oop
include predicted_rank in app launch logging
...
Change-Id: Id824c350cd133c4c8fa91de0f8793faed9003393
Diffstat (limited to 'src/com/android/launcher3/LauncherAppWidgetHost.java')
-rw-r--r-- | src/com/android/launcher3/LauncherAppWidgetHost.java | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/src/com/android/launcher3/LauncherAppWidgetHost.java b/src/com/android/launcher3/LauncherAppWidgetHost.java index 7f5ac5276..1215d4321 100644 --- a/src/com/android/launcher3/LauncherAppWidgetHost.java +++ b/src/com/android/launcher3/LauncherAppWidgetHost.java @@ -27,14 +27,15 @@ import android.content.Context; import android.content.Intent; import android.os.Handler; import android.util.SparseArray; -import android.view.LayoutInflater; import android.widget.Toast; import com.android.launcher3.config.FeatureFlags; import com.android.launcher3.widget.DeferredAppWidgetHostView; import com.android.launcher3.widget.LauncherAppWidgetHostView; +import com.android.launcher3.widget.custom.CustomWidgetManager; import java.util.ArrayList; +import java.util.function.IntConsumer; /** @@ -56,9 +57,17 @@ public class LauncherAppWidgetHost extends AppWidgetHost { private final Context mContext; private int mFlags = FLAG_RESUMED; + private IntConsumer mAppWidgetRemovedCallback = null; + public LauncherAppWidgetHost(Context context) { + this(context, null); + } + + public LauncherAppWidgetHost(Context context, + IntConsumer appWidgetRemovedCallback) { super(context, APPWIDGET_HOST_ID); mContext = context; + mAppWidgetRemovedCallback = appWidgetRemovedCallback; } @Override @@ -105,6 +114,10 @@ public class LauncherAppWidgetHost extends AppWidgetHost { super.stopListening(); } + public boolean isListening() { + return (mFlags & FLAG_LISTENING) != 0; + } + /** * Updates the resumed state of the host. * When a host is not resumed, it defers calls to startListening until host is resumed again. @@ -180,10 +193,8 @@ public class LauncherAppWidgetHost extends AppWidgetHost { LauncherAppWidgetProviderInfo appWidget) { if (appWidget.isCustomWidget()) { LauncherAppWidgetHostView lahv = new LauncherAppWidgetHostView(context); - LayoutInflater inflater = (LayoutInflater) - context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); - inflater.inflate(appWidget.initialLayout, lahv); lahv.setAppWidget(0, appWidget); + CustomWidgetManager.INSTANCE.get(context).onViewCreated(lahv); return lahv; } else if ((mFlags & FLAG_LISTENING) == 0) { DeferredAppWidgetHostView view = new DeferredAppWidgetHostView(context); @@ -207,7 +218,7 @@ public class LauncherAppWidgetHost extends AppWidgetHost { } view.setAppWidget(appWidgetId, appWidget); view.switchToErrorView(); - return view; + return view; } } } @@ -225,6 +236,18 @@ public class LauncherAppWidgetHost extends AppWidgetHost { info.initSpans(mContext); } + /** + * Called on an appWidget is removed for a widgetId + * @param appWidgetId + * TODO: make this override when SDK is updated + */ + public void onAppWidgetRemoved(int appWidgetId) { + if (mAppWidgetRemovedCallback == null) { + return; + } + mAppWidgetRemovedCallback.accept(appWidgetId); + } + @Override public void deleteAppWidgetId(int appWidgetId) { super.deleteAppWidgetId(appWidgetId); |