use of com.android.launcher3.widget.WidgetSections.NO_CATEGORY in project android_packages_apps_404Launcher by P-404.
the class IconCache method getTitleAndIconForApp.
/**
* Fill in {@param infoInOut} with the corresponding icon and label.
*/
public synchronized void getTitleAndIconForApp(PackageItemInfo infoInOut, boolean useLowResIcon) {
CacheEntry entry = getEntryForPackageLocked(infoInOut.packageName, infoInOut.user, useLowResIcon);
applyCacheEntry(entry, infoInOut);
if (infoInOut.widgetCategory != NO_CATEGORY) {
WidgetSection widgetSection = WidgetSections.getWidgetSections(mContext).get(infoInOut.widgetCategory);
infoInOut.title = mContext.getString(widgetSection.mSectionTitle);
infoInOut.contentDescription = mPackageManager.getUserBadgedLabel(infoInOut.title, infoInOut.user);
}
}
use of com.android.launcher3.widget.WidgetSections.NO_CATEGORY in project android_packages_apps_404Launcher by P-404.
the class PackageUserKeyTest method fromPackageItemInfo_shouldCreateExpectedObject.
@Test
public void fromPackageItemInfo_shouldCreateExpectedObject() {
PackageUserKey packageUserKey = PackageUserKey.fromPackageItemInfo(new PackageItemInfo(TEST_PACKAGE, UserHandle.CURRENT));
assertThat(packageUserKey.mPackageName).isEqualTo(TEST_PACKAGE);
assertThat(packageUserKey.mWidgetCategory).isEqualTo(NO_CATEGORY);
assertThat(packageUserKey.mUser).isEqualTo(UserHandle.CURRENT);
}
use of com.android.launcher3.widget.WidgetSections.NO_CATEGORY in project android_packages_apps_Launcher3 by AOSPA.
the class WidgetsModel method getPackageUserKeys.
private List<PackageUserKey> getPackageUserKeys(Context context, WidgetItem item) {
Map<ComponentName, IntSet> widgetsToCategories = WidgetSections.getWidgetsToCategory(context);
IntSet categories = widgetsToCategories.get(item.componentName);
if (categories == null || categories.isEmpty()) {
return Arrays.asList(new PackageUserKey(item.componentName.getPackageName(), item.user));
}
List<PackageUserKey> packageUserKeys = new ArrayList<>();
categories.forEach(category -> {
if (category == NO_CATEGORY) {
packageUserKeys.add(new PackageUserKey(item.componentName.getPackageName(), item.user));
} else {
packageUserKeys.add(new PackageUserKey(category, item.user));
}
});
return packageUserKeys;
}
use of com.android.launcher3.widget.WidgetSections.NO_CATEGORY in project android_packages_apps_Launcher3 by AOSPA.
the class WidgetsListHeader method setIcon.
private void setIcon(PackageItemInfo info) {
Drawable icon;
if (info.widgetCategory == NO_CATEGORY) {
icon = info.newIcon(getContext());
} else {
WidgetSection widgetSection = WidgetSections.getWidgetSections(getContext()).get(info.widgetCategory);
icon = getContext().getDrawable(widgetSection.mSectionDrawable);
}
applyDrawables(icon);
mIconDrawable = icon;
if (mIconDrawable != null) {
mIconDrawable.setVisible(/* visible= */
getWindowVisibility() == VISIBLE && isShown(), /* restart= */
false);
}
}
use of com.android.launcher3.widget.WidgetSections.NO_CATEGORY in project android_packages_apps_Launcher3 by ArrowOS.
the class WidgetsModel method getPackageUserKeys.
private List<PackageUserKey> getPackageUserKeys(Context context, WidgetItem item) {
Map<ComponentName, IntSet> widgetsToCategories = WidgetSections.getWidgetsToCategory(context);
IntSet categories = widgetsToCategories.get(item.componentName);
if (categories == null || categories.isEmpty()) {
return Arrays.asList(new PackageUserKey(item.componentName.getPackageName(), item.user));
}
List<PackageUserKey> packageUserKeys = new ArrayList<>();
categories.forEach(category -> {
if (category == NO_CATEGORY) {
packageUserKeys.add(new PackageUserKey(item.componentName.getPackageName(), item.user));
} else {
packageUserKeys.add(new PackageUserKey(category, item.user));
}
});
return packageUserKeys;
}
Aggregations