use of com.android.launcher3.model.data.AppInfo in project android_packages_apps_Trebuchet by LineageOS.
the class LoggerUtils method newItemTarget.
public static Target newItemTarget(ItemInfo info, InstantAppResolver instantAppResolver) {
Target t = newTarget(Target.Type.ITEM);
switch(info.itemType) {
case LauncherSettings.Favorites.ITEM_TYPE_APPLICATION:
t.itemType = (instantAppResolver != null && info instanceof AppInfo && instantAppResolver.isInstantApp(((AppInfo) info))) ? ItemType.WEB_APP : ItemType.APP_ICON;
t.predictedRank = DEFAULT_PREDICTED_RANK;
break;
case LauncherSettings.Favorites.ITEM_TYPE_SHORTCUT:
t.itemType = ItemType.SHORTCUT;
t.predictedRank = DEFAULT_PREDICTED_RANK;
break;
case LauncherSettings.Favorites.ITEM_TYPE_FOLDER:
t.itemType = ItemType.FOLDER_ICON;
break;
case LauncherSettings.Favorites.ITEM_TYPE_APPWIDGET:
t.itemType = ItemType.WIDGET;
break;
case LauncherSettings.Favorites.ITEM_TYPE_DEEP_SHORTCUT:
t.itemType = ItemType.DEEPSHORTCUT;
t.predictedRank = DEFAULT_PREDICTED_RANK;
break;
}
return t;
}
use of com.android.launcher3.model.data.AppInfo in project Neo-Launcher by NeoApplications.
the class IconPreview method applyPreviewIcons.
private void applyPreviewIcons() {
for (int i = 0; i < 5; i++) {
BubbleTextView icon = (BubbleTextView) mLauncher.getLayoutInflater().inflate(R.layout.all_apps_icon, this, false);
LayoutParams lp = (LayoutParams) icon.getLayoutParams();
lp.height = mLauncher.getDeviceProfile().allAppsCellHeightPx;
lp.width = 0;
lp.weight = 1;
addView(icon);
}
for (int i = 0; i < 5; i++) {
BubbleTextView icon = (BubbleTextView) getChildAt(i);
icon.reset();
icon.setVisibility(View.VISIBLE);
icon.applyFromApplicationInfo((AppInfo) mPreviewApps.get(getRandomApp()));
icon.setTextColor(mIconTextColor);
}
mLauncher.reapplyUi();
}
use of com.android.launcher3.model.data.AppInfo in project Neo-Launcher by NeoApplications.
the class AppSearchProvider method listToCursor.
private Cursor listToCursor(final List<AppInfo> list) {
final MatrixCursor matrixCursor = new MatrixCursor(AppSearchProvider.eK, list.size());
final UserManagerCompat instance = UserManagerCompat.getInstance(this.getContext());
int n = 0;
for (AppInfo appInfo : list) {
final String uri = buildUri(appInfo, instance).toString();
final MatrixCursor.RowBuilder row = matrixCursor.newRow();
row.add(n++).add(appInfo.title.toString()).add(uri).add("com.google.android.apps.nexuslauncher.search.APP_LAUNCH").add(uri);
}
return matrixCursor;
}
use of com.android.launcher3.model.data.AppInfo in project Neo-Launcher by NeoApplications.
the class PredictionUiStateManager method updateDependencies.
private void updateDependencies(PredictionState state) {
if (!state.isEnabled || mAppsView == null) {
return;
}
IconCache iconCache = LauncherAppState.getInstance(mContext).getIconCache();
List<String> instantAppsToLoad = new ArrayList<>();
List<ShortcutKey> shortcutsToLoad = new ArrayList<>();
int total = state.apps.size();
for (int i = 0, count = 0; i < total && count < mMaxIconsPerRow; i++) {
ComponentKeyMapper mapper = state.apps.get(i);
// Update instant apps
if (COMPONENT_CLASS_MARKER.equals(mapper.getComponentClass())) {
instantAppsToLoad.add(mapper.getPackage());
count++;
} else if (mapper.getComponentKey() instanceof ShortcutKey) {
shortcutsToLoad.add((ShortcutKey) mapper.getComponentKey());
count++;
} else {
// Reload high res icon
AppInfo info = (AppInfo) mapper.getApp(mAppsView.getAppsStore());
if (info != null) {
if (info.usingLowResIcon()) {
// TODO: Update icon cache to support null callbacks.
iconCache.updateIconInBackground(this, info);
}
count++;
}
}
}
mDynamicItemCache.cacheItems(shortcutsToLoad, instantAppsToLoad);
}
use of com.android.launcher3.model.data.AppInfo in project Neo-Launcher by NeoApplications.
the class CacheDataUpdatedTaskTest method testCacheUpdate_update_apps.
@Test
// b/131115553
@Ignore("This test fails with resource errors")
public void testCacheUpdate_update_apps() throws Exception {
// Clear all icons from apps list so that its easy to check what was updated
for (AppInfo info : allAppsList.data) {
info.iconBitmap = null;
}
executeTaskForTest(newTask(CacheDataUpdatedTask.OP_CACHE_UPDATE, "app1"));
// Verify that only the app icons of app1 (id 1 & 2) are updated. Custom shortcut (id 7)
// is not updated
verifyUpdate(1, 2);
// Verify that only app1 var updated in allAppsList
assertFalse(allAppsList.data.isEmpty());
for (AppInfo info : allAppsList.data) {
if (info.componentName.getPackageName().equals("app1")) {
assertNotNull(info.iconBitmap);
} else {
assertNull(info.iconBitmap);
}
}
}
Aggregations