Search in sources :

Example 1 with AllAppsStore

use of com.android.launcher3.allapps.AllAppsStore in project android_packages_apps_Trebuchet by LineageOS.

the class HotseatPredictionController method mapToWorkspaceItemInfo.

private List<WorkspaceItemInfo> mapToWorkspaceItemInfo(List<ComponentKeyMapper> components) {
    AllAppsStore allAppsStore = mLauncher.getAppsView().getAppsStore();
    if (allAppsStore.getApps().length == 0) {
        return Collections.emptyList();
    }
    List<WorkspaceItemInfo> predictedApps = new ArrayList<>();
    for (ComponentKeyMapper mapper : components) {
        ItemInfoWithIcon info = mapper.getApp(allAppsStore);
        if (info instanceof AppInfo) {
            WorkspaceItemInfo predictedApp = new WorkspaceItemInfo((AppInfo) info);
            predictedApp.container = LauncherSettings.Favorites.CONTAINER_HOTSEAT_PREDICTION;
            predictedApps.add(predictedApp);
        } else if (info instanceof WorkspaceItemInfo) {
            WorkspaceItemInfo predictedApp = new WorkspaceItemInfo((WorkspaceItemInfo) info);
            predictedApp.container = LauncherSettings.Favorites.CONTAINER_HOTSEAT_PREDICTION;
            predictedApps.add(predictedApp);
        } else {
            if (DEBUG) {
                Log.e(TAG, "Predicted app not found: " + mapper);
            }
        }
        // Stop at the number of hotseat items
        if (predictedApps.size() == mHotSeatItemsCount) {
            break;
        }
    }
    return predictedApps;
}
Also used : ArrayList(java.util.ArrayList) AllAppsStore(com.android.launcher3.allapps.AllAppsStore) ComponentKeyMapper(com.android.launcher3.appprediction.ComponentKeyMapper) ItemInfoWithIcon(com.android.launcher3.model.data.ItemInfoWithIcon) WorkspaceItemInfo(com.android.launcher3.model.data.WorkspaceItemInfo) AppInfo(com.android.launcher3.model.data.AppInfo)

Aggregations

AllAppsStore (com.android.launcher3.allapps.AllAppsStore)1 ComponentKeyMapper (com.android.launcher3.appprediction.ComponentKeyMapper)1 AppInfo (com.android.launcher3.model.data.AppInfo)1 ItemInfoWithIcon (com.android.launcher3.model.data.ItemInfoWithIcon)1 WorkspaceItemInfo (com.android.launcher3.model.data.WorkspaceItemInfo)1 ArrayList (java.util.ArrayList)1