use of com.android.launcher3.util.ComponentKey in project android_packages_apps_Trebuchet by LineageOS.
the class PinnedAppsAdapter method parseComponentKey.
private ComponentKey parseComponentKey(String string) {
try {
String[] parts = string.split("#");
UserHandle user;
if (parts.length > 2) {
user = UserCache.INSTANCE.get(mLauncher).getUserForSerialNumber(Long.parseLong(parts[2]));
} else {
user = Process.myUserHandle();
}
ComponentName cn = ComponentName.unflattenFromString(parts[0]);
return new ComponentKey(cn, user);
} catch (Exception e) {
return null;
}
}
use of com.android.launcher3.util.ComponentKey in project android_packages_apps_Launcher3 by AOSPA.
the class PopupDataProvider method getRecommendedWidgets.
/**
* Returns a list of recommended widgets.
*/
public List<WidgetItem> getRecommendedWidgets() {
HashMap<ComponentKey, WidgetItem> allWidgetItems = new HashMap<>();
mAllWidgets.stream().filter(entry -> entry instanceof WidgetsListContentEntry).forEach(entry -> ((WidgetsListContentEntry) entry).mWidgets.forEach(widget -> allWidgetItems.put(new ComponentKey(widget.componentName, widget.user), widget)));
return mRecommendedWidgets.stream().map(recommendedWidget -> allWidgetItems.get(new ComponentKey(recommendedWidget.getTargetComponent(), recommendedWidget.user))).filter(Objects::nonNull).collect(Collectors.toList());
}
use of com.android.launcher3.util.ComponentKey in project android_packages_apps_Launcher3 by AOSPA.
the class PinnedAppsAdapter method parseComponentKey.
private ComponentKey parseComponentKey(String string) {
try {
String[] parts = string.split("#");
UserHandle user;
if (parts.length > 2) {
user = UserCache.INSTANCE.get(mLauncher).getUserForSerialNumber(Long.parseLong(parts[2]));
} else {
user = Process.myUserHandle();
}
ComponentName cn = ComponentName.unflattenFromString(parts[0]);
return new ComponentKey(cn, user);
} catch (Exception e) {
return null;
}
}
use of com.android.launcher3.util.ComponentKey in project android_packages_apps_Launcher3 by ArrowOS.
the class TaskView method getItemInfo.
protected WorkspaceItemInfo getItemInfo(Task task) {
ComponentKey componentKey = TaskUtils.getLaunchComponentKeyForTask(task.key);
WorkspaceItemInfo stubInfo = new WorkspaceItemInfo();
stubInfo.itemType = LauncherSettings.Favorites.ITEM_TYPE_TASK;
stubInfo.container = LauncherSettings.Favorites.CONTAINER_TASKSWITCHER;
stubInfo.user = componentKey.user;
stubInfo.intent = new Intent().setComponent(componentKey.componentName);
stubInfo.title = task.title;
if (getRecentsView() != null) {
stubInfo.screenId = getRecentsView().indexOfChild(this);
}
return stubInfo;
}
use of com.android.launcher3.util.ComponentKey in project android_packages_apps_Launcher3 by ArrowOS.
the class PopupDataProvider method getRecommendedWidgets.
/**
* Returns a list of recommended widgets.
*/
public List<WidgetItem> getRecommendedWidgets() {
HashMap<ComponentKey, WidgetItem> allWidgetItems = new HashMap<>();
mAllWidgets.stream().filter(entry -> entry instanceof WidgetsListContentEntry).forEach(entry -> ((WidgetsListContentEntry) entry).mWidgets.forEach(widget -> allWidgetItems.put(new ComponentKey(widget.componentName, widget.user), widget)));
return mRecommendedWidgets.stream().map(recommendedWidget -> allWidgetItems.get(new ComponentKey(recommendedWidget.getTargetComponent(), recommendedWidget.user))).filter(Objects::nonNull).collect(Collectors.toList());
}
Aggregations