mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-02 17:06:49 +00:00
Fixing custom widgets support:
> Moving the definitions to xml so that it is easier to override in derivative projects > Fixing verious bind and save logic for custom widgets > Adding feature flag to easily disable custom widgets Change-Id: I0e278bc7dd415713029364060ef10842da990be9
This commit is contained in:
@@ -24,10 +24,13 @@ import android.os.Bundle;
|
||||
import android.os.UserHandle;
|
||||
import android.support.annotation.Nullable;
|
||||
|
||||
import com.android.launcher3.LauncherAppWidgetInfo;
|
||||
import com.android.launcher3.LauncherAppWidgetProviderInfo;
|
||||
import com.android.launcher3.Utilities;
|
||||
import com.android.launcher3.config.FeatureFlags;
|
||||
import com.android.launcher3.util.ComponentKey;
|
||||
import com.android.launcher3.util.PackageUserKey;
|
||||
import com.android.launcher3.widget.custom.CustomWidgetParser;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -58,12 +61,13 @@ public abstract class AppWidgetManagerCompat {
|
||||
mAppWidgetManager = AppWidgetManager.getInstance(context);
|
||||
}
|
||||
|
||||
public AppWidgetProviderInfo getAppWidgetInfo(int appWidgetId) {
|
||||
return mAppWidgetManager.getAppWidgetInfo(appWidgetId);
|
||||
}
|
||||
|
||||
public LauncherAppWidgetProviderInfo getLauncherAppWidgetInfo(int appWidgetId) {
|
||||
AppWidgetProviderInfo info = getAppWidgetInfo(appWidgetId);
|
||||
if (FeatureFlags.ENABLE_CUSTOM_WIDGETS
|
||||
&& appWidgetId <= LauncherAppWidgetInfo.CUSTOM_WIDGET_ID) {
|
||||
return CustomWidgetParser.getWidgetProvider(mContext, appWidgetId);
|
||||
}
|
||||
|
||||
AppWidgetProviderInfo info = mAppWidgetManager.getAppWidgetInfo(appWidgetId);
|
||||
return info == null ? null : LauncherAppWidgetProviderInfo.fromProviderInfo(mContext, info);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user