Search in sources :

Example 1 with IconDrawableFactory

use of android.util.IconDrawableFactory in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class ApplicationListPreferenceController method onListOfAppsResult.

@Override
public void onListOfAppsResult(List<UserAppInfo> result) {
    final PreferenceScreen screen = mParent.getPreferenceScreen();
    if (screen == null) {
        return;
    }
    final IconDrawableFactory iconDrawableFactory = IconDrawableFactory.newInstance(mContext);
    final Context prefContext = mParent.getPreferenceManager().getContext();
    for (int position = 0; position < result.size(); position++) {
        final UserAppInfo item = result.get(position);
        final Preference preference = new AppPreference(prefContext);
        preference.setTitle(item.appInfo.loadLabel(mPm));
        preference.setIcon(iconDrawableFactory.getBadgedIcon(item.appInfo));
        preference.setOrder(position);
        preference.setSelectable(false);
        screen.addPreference(preference);
    }
}
Also used : Context(android.content.Context) PreferenceScreen(androidx.preference.PreferenceScreen) AppPreference(com.android.settingslib.widget.apppreference.AppPreference) Preference(androidx.preference.Preference) AppPreference(com.android.settingslib.widget.apppreference.AppPreference) UserAppInfo(com.android.settings.applications.UserAppInfo) IconDrawableFactory(android.util.IconDrawableFactory)

Example 2 with IconDrawableFactory

use of android.util.IconDrawableFactory in project android_packages_apps_Settings by omnirom.

the class DomainAppPreferenceController method rebuildAppList.

private void rebuildAppList(PreferenceGroup group, ArrayList<AppEntry> apps) {
    cacheAllPrefs(group);
    final int size = apps.size();
    final Context context = group.getContext();
    final IconDrawableFactory iconDrawableFactory = IconDrawableFactory.newInstance(context);
    for (int i = 0; i < size; i++) {
        final AppEntry entry = apps.get(i);
        final String key = entry.info.packageName + "|" + entry.info.uid;
        DomainAppPreference preference = (DomainAppPreference) getCachedPreference(key);
        if (preference == null) {
            preference = new DomainAppPreference(context, iconDrawableFactory, entry);
            preference.setKey(key);
            group.addPreference(preference);
        } else {
            preference.reuse();
        }
        preference.setOrder(i);
    }
    removeCachedPrefs(group);
}
Also used : Context(android.content.Context) AppEntry(com.android.settingslib.applications.ApplicationsState.AppEntry) IconDrawableFactory(android.util.IconDrawableFactory)

Example 3 with IconDrawableFactory

use of android.util.IconDrawableFactory in project Resurrection_packages_apps_Settings by ResurrectionRemix.

the class DomainAppPreferenceController method rebuildAppList.

private void rebuildAppList(PreferenceGroup group, ArrayList<AppEntry> apps) {
    cacheAllPrefs(group);
    final int size = apps.size();
    final Context context = group.getContext();
    final IconDrawableFactory iconDrawableFactory = IconDrawableFactory.newInstance(context);
    for (int i = 0; i < size; i++) {
        final AppEntry entry = apps.get(i);
        final String key = entry.info.packageName + "|" + entry.info.uid;
        DomainAppPreference preference = (DomainAppPreference) getCachedPreference(key);
        if (preference == null) {
            preference = new DomainAppPreference(context, iconDrawableFactory, entry);
            preference.setKey(key);
            group.addPreference(preference);
        } else {
            preference.reuse();
        }
        preference.setOrder(i);
    }
    removeCachedPrefs(group);
}
Also used : Context(android.content.Context) AppEntry(com.android.settingslib.applications.ApplicationsState.AppEntry) IconDrawableFactory(android.util.IconDrawableFactory)

Example 4 with IconDrawableFactory

use of android.util.IconDrawableFactory in project android_packages_apps_Settings by omnirom.

the class ApplicationListPreferenceController method onListOfAppsResult.

@Override
public void onListOfAppsResult(List<UserAppInfo> result) {
    final PreferenceScreen screen = mParent.getPreferenceScreen();
    if (screen == null) {
        return;
    }
    final IconDrawableFactory iconDrawableFactory = IconDrawableFactory.newInstance(mContext);
    final Context prefContext = mParent.getPreferenceManager().getContext();
    for (int position = 0; position < result.size(); position++) {
        final UserAppInfo item = result.get(position);
        final Preference preference = new AppPreference(prefContext);
        preference.setTitle(item.appInfo.loadLabel(mPm));
        preference.setIcon(iconDrawableFactory.getBadgedIcon(item.appInfo));
        preference.setOrder(position);
        preference.setSelectable(false);
        screen.addPreference(preference);
    }
}
Also used : Context(android.content.Context) PreferenceScreen(androidx.preference.PreferenceScreen) AppPreference(com.android.settingslib.widget.AppPreference) Preference(androidx.preference.Preference) AppPreference(com.android.settingslib.widget.AppPreference) UserAppInfo(com.android.settings.applications.UserAppInfo) IconDrawableFactory(android.util.IconDrawableFactory)

Aggregations

Context (android.content.Context)4 IconDrawableFactory (android.util.IconDrawableFactory)4 Preference (androidx.preference.Preference)2 PreferenceScreen (androidx.preference.PreferenceScreen)2 UserAppInfo (com.android.settings.applications.UserAppInfo)2 AppEntry (com.android.settingslib.applications.ApplicationsState.AppEntry)2 AppPreference (com.android.settingslib.widget.AppPreference)1 AppPreference (com.android.settingslib.widget.apppreference.AppPreference)1