Merge "Group weather widgets under the widget category" into sc-v2-dev

This commit is contained in:
Steven Ng
2021-10-01 10:17:47 +00:00
committed by Android (Google) Code Review
25 changed files with 507 additions and 142 deletions
@@ -17,7 +17,7 @@
package com.android.launcher3.widget;
import static com.android.launcher3.graphics.PreloadIconDrawable.newPendingIcon;
import static com.android.launcher3.model.data.PackageItemInfo.CONVERSATIONS;
import static com.android.launcher3.widget.WidgetSections.getWidgetSections;
import android.content.Context;
import android.graphics.Canvas;
@@ -89,8 +89,8 @@ public class PendingAppWidgetHostView extends LauncherAppWidgetHostView
setOnClickListener(ItemClickHandler.INSTANCE);
if (info.pendingItemInfo == null) {
info.pendingItemInfo = new PackageItemInfo(info.providerName.getPackageName());
info.pendingItemInfo.user = info.user;
info.pendingItemInfo = new PackageItemInfo(info.providerName.getPackageName(),
info.user);
cache.updateIconInBackground(this, info.pendingItemInfo);
} else {
reapplyItemInfo(info.pendingItemInfo);
@@ -338,10 +338,11 @@ public class PendingAppWidgetHostView extends LauncherAppWidgetHostView
*/
@Nullable
private Drawable getWidgetCategoryIcon() {
switch (mInfo.pendingItemInfo.category) {
case CONVERSATIONS:
return getContext().getDrawable(R.drawable.ic_conversations_widget_category);
if (mInfo.pendingItemInfo.widgetCategory == WidgetSections.NO_CATEGORY) {
return null;
}
return null;
Context context = getContext();
return context.getDrawable(getWidgetSections(context).get(
mInfo.pendingItemInfo.widgetCategory).mSectionDrawable);
}
}