Search in sources :

Example 46 with PackageItemInfo

use of com.android.launcher3.model.PackageItemInfo in project android_packages_apps_404Launcher by P-404.

the class SimpleWidgetsSearchAlgorithmTest method createPackageItemInfo.

private PackageItemInfo createPackageItemInfo(String packageName, String appName, UserHandle userHandle) {
    PackageItemInfo pInfo = new PackageItemInfo(packageName, userHandle);
    pInfo.title = appName;
    pInfo.bitmap = BitmapInfo.of(Bitmap.createBitmap(10, 10, Bitmap.Config.ALPHA_8), 0);
    return pInfo;
}
Also used : PackageItemInfo(com.android.launcher3.model.data.PackageItemInfo)

Example 47 with PackageItemInfo

use of com.android.launcher3.model.PackageItemInfo in project android_packages_apps_404Launcher by P-404.

the class WidgetsListAdapter method shouldClearVisibleEntries.

/**
 * Returns {@code true} if there is a change in {@link #mAllEntries} that results in an
 * invalidation of {@link #mVisibleEntries}. e.g. there is change in the device language.
 */
private boolean shouldClearVisibleEntries() {
    Map<PackageUserKey, PackageItemInfo> packagesInfo = mAllEntries.stream().filter(entry -> entry instanceof WidgetsListHeaderEntry).map(entry -> entry.mPkgItem).collect(Collectors.toMap(entry -> PackageUserKey.fromPackageItemInfo(entry), entry -> entry));
    for (WidgetsListBaseEntry visibleEntry : mVisibleEntries) {
        PackageUserKey key = PackageUserKey.fromPackageItemInfo(visibleEntry.mPkgItem);
        PackageItemInfo packageItemInfo = packagesInfo.get(key);
        if (packageItemInfo != null && !visibleEntry.mPkgItem.title.equals(packageItemInfo.title)) {
            return true;
        }
    }
    return false;
}
Also used : POSITION_LAST(com.android.launcher3.recyclerview.ViewHolderBinder.POSITION_LAST) IntStream(java.util.stream.IntStream) Context(android.content.Context) Rect(android.graphics.Rect) Arrays(java.util.Arrays) NonNull(androidx.annotation.NonNull) LabelComparator(com.android.launcher3.util.LabelComparator) IconCache(com.android.launcher3.icons.IconCache) OptionalInt(java.util.OptionalInt) Process(android.os.Process) PackageItemInfo(com.android.launcher3.model.data.PackageItemInfo) ArrayList(java.util.ArrayList) POSITION_FIRST(com.android.launcher3.recyclerview.ViewHolderBinder.POSITION_FIRST) WidgetListSpaceEntry(com.android.launcher3.widget.model.WidgetListSpaceEntry) POSITION_DEFAULT(com.android.launcher3.recyclerview.ViewHolderBinder.POSITION_DEFAULT) Map(java.util.Map) View(android.view.View) ViewHolder(androidx.recyclerview.widget.RecyclerView.ViewHolder) RecyclerView(androidx.recyclerview.widget.RecyclerView) Log(android.util.Log) IntSupplier(java.util.function.IntSupplier) ActivityContext(com.android.launcher3.views.ActivityContext) WidgetsListHeaderEntry(com.android.launcher3.widget.model.WidgetsListHeaderEntry) LayoutInflater(android.view.LayoutInflater) Adapter(androidx.recyclerview.widget.RecyclerView.Adapter) WidgetsListContentEntry(com.android.launcher3.widget.model.WidgetsListContentEntry) Predicate(java.util.function.Predicate) LAUNCHER_WIDGETSTRAY_APP_EXPANDED(com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_WIDGETSTRAY_APP_EXPANDED) PackageUserKey(com.android.launcher3.util.PackageUserKey) WidgetsListSearchHeaderEntry(com.android.launcher3.widget.model.WidgetsListSearchHeaderEntry) Collectors(java.util.stream.Collectors) ViewGroup(android.view.ViewGroup) ViewHolderBinder(com.android.launcher3.recyclerview.ViewHolderBinder) SparseArray(android.util.SparseArray) List(java.util.List) Nullable(androidx.annotation.Nullable) WidgetsListBaseEntry(com.android.launcher3.widget.model.WidgetsListBaseEntry) R(com.android.launcher3.R) LayoutParams(androidx.recyclerview.widget.RecyclerView.LayoutParams) LinearLayoutManager(androidx.recyclerview.widget.LinearLayoutManager) Comparator(java.util.Comparator) OnLongClickListener(android.view.View.OnLongClickListener) Collections(java.util.Collections) OnClickListener(android.view.View.OnClickListener) WidgetsListBaseEntry(com.android.launcher3.widget.model.WidgetsListBaseEntry) PackageItemInfo(com.android.launcher3.model.data.PackageItemInfo) PackageUserKey(com.android.launcher3.util.PackageUserKey) WidgetsListHeaderEntry(com.android.launcher3.widget.model.WidgetsListHeaderEntry)

Example 48 with PackageItemInfo

use of com.android.launcher3.model.PackageItemInfo in project android_packages_apps_404Launcher by P-404.

the class WidgetsListHeader method applyIconAndLabel.

@UiThread
private void applyIconAndLabel(WidgetsListHeaderEntry entry) {
    PackageItemInfo info = entry.mPkgItem;
    setIcon(info);
    setTitles(entry);
    setExpanded(entry.isWidgetListShown());
    super.setTag(info);
    verifyHighRes();
}
Also used : PackageItemInfo(com.android.launcher3.model.data.PackageItemInfo) UiThread(androidx.annotation.UiThread)

Example 49 with PackageItemInfo

use of com.android.launcher3.model.PackageItemInfo in project android_packages_apps_404Launcher by P-404.

the class IconCache method getShortcutInfoBadge.

/**
 * Returns the badging info for the shortcut
 */
public BitmapInfo getShortcutInfoBadge(ShortcutInfo shortcutInfo) {
    ComponentName cn = shortcutInfo.getActivity();
    if (cn != null) {
        // Get the app info for the source activity.
        AppInfo appInfo = new AppInfo();
        appInfo.user = shortcutInfo.getUserHandle();
        appInfo.componentName = cn;
        appInfo.intent = new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_LAUNCHER).setComponent(cn);
        getTitleAndIcon(appInfo, false);
        return appInfo.bitmap;
    } else {
        PackageItemInfo pkgInfo = new PackageItemInfo(shortcutInfo.getPackage(), shortcutInfo.getUserHandle());
        getTitleAndIconForApp(pkgInfo, false);
        return pkgInfo.bitmap;
    }
}
Also used : PackageItemInfo(com.android.launcher3.model.data.PackageItemInfo) ComponentName(android.content.ComponentName) Intent(android.content.Intent) AppInfo(com.android.launcher3.model.data.AppInfo)

Example 50 with PackageItemInfo

use of com.android.launcher3.model.PackageItemInfo 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);
    }
}
Also used : WidgetSection(com.android.launcher3.widget.WidgetSections.WidgetSection)

Aggregations

PackageItemInfo (com.android.launcher3.model.data.PackageItemInfo)94 WidgetsListContentEntry (com.android.launcher3.widget.model.WidgetsListContentEntry)39 WidgetsListHeaderEntry (com.android.launcher3.widget.model.WidgetsListHeaderEntry)39 WidgetItem (com.android.launcher3.model.WidgetItem)28 ArrayList (java.util.ArrayList)28 WidgetsListBaseEntry (com.android.launcher3.widget.model.WidgetsListBaseEntry)24 Map (java.util.Map)22 HashMap (java.util.HashMap)20 ComponentName (android.content.ComponentName)19 List (java.util.List)19 IconCache (com.android.launcher3.icons.IconCache)17 Context (android.content.Context)16 AlphabeticIndexCompat (com.android.launcher3.compat.AlphabeticIndexCompat)16 PackageUserKey (com.android.launcher3.util.PackageUserKey)16 Log (android.util.Log)14 Nullable (androidx.annotation.Nullable)14 ArrayMap (androidx.collection.ArrayMap)14 ShortcutConfigActivityInfo.queryList (com.android.launcher3.pm.ShortcutConfigActivityInfo.queryList)14 Arrays (java.util.Arrays)14 Predicate (java.util.function.Predicate)14