mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-28 07:46:55 +00:00
Move most of the functions in LauncherAppWidgetHost to LauncherWidgetHolder
Test: N/A Bug: 235358918 Change-Id: I343419376491203a195154f2766b12e5def38879
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
package com.android.launcher3;
|
||||
|
||||
import android.appwidget.AppWidgetHost;
|
||||
import android.appwidget.AppWidgetManager;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
@@ -55,9 +54,9 @@ public class DefaultLayoutParser extends AutoInstallsLayout {
|
||||
private static final String ACTION_APPWIDGET_DEFAULT_WORKSPACE_CONFIGURE =
|
||||
"com.android.launcher.action.APPWIDGET_DEFAULT_WORKSPACE_CONFIGURE";
|
||||
|
||||
public DefaultLayoutParser(Context context, AppWidgetHost appWidgetHost,
|
||||
public DefaultLayoutParser(Context context, LauncherWidgetHolder appWidgetHolder,
|
||||
LayoutParserCallback callback, Resources sourceRes, int layoutId) {
|
||||
super(context, appWidgetHost, callback, sourceRes, layoutId, TAG_FAVORITES);
|
||||
super(context, appWidgetHolder, callback, sourceRes, layoutId, TAG_FAVORITES);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -336,11 +335,11 @@ public class DefaultLayoutParser extends AutoInstallsLayout {
|
||||
final AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(mContext);
|
||||
int insertedId = -1;
|
||||
try {
|
||||
int appWidgetId = mAppWidgetHost.allocateAppWidgetId();
|
||||
int appWidgetId = mAppWidgetHolder.allocateAppWidgetId();
|
||||
|
||||
if (!appWidgetManager.bindAppWidgetIdIfAllowed(appWidgetId, cn)) {
|
||||
Log.e(TAG, "Unable to bind app widget id " + cn);
|
||||
mAppWidgetHost.deleteAppWidgetId(appWidgetId);
|
||||
mAppWidgetHolder.deleteAppWidgetId(appWidgetId);
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -349,7 +348,7 @@ public class DefaultLayoutParser extends AutoInstallsLayout {
|
||||
mValues.put(Favorites._ID, mCallback.generateNewItemId());
|
||||
insertedId = mCallback.insertAndCheck(mDb, mValues);
|
||||
if (insertedId < 0) {
|
||||
mAppWidgetHost.deleteAppWidgetId(appWidgetId);
|
||||
mAppWidgetHolder.deleteAppWidgetId(appWidgetId);
|
||||
return insertedId;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user