use of com.android.settings.applications.EnterpriseDefaultApps in project android_packages_apps_Settings by crdroidandroid.
the class EnterpriseSetDefaultAppsListPreferenceController method createPreferences.
private void createPreferences(Context prefContext, PreferenceGroup group, EnumMap<EnterpriseDefaultApps, List<ApplicationInfo>> apps) {
if (group == null) {
return;
}
for (EnterpriseDefaultApps typeOfDefault : EnterpriseDefaultApps.values()) {
final List<ApplicationInfo> appsForCategory = apps.get(typeOfDefault);
if (appsForCategory == null || appsForCategory.isEmpty()) {
continue;
}
final Preference preference = new Preference(prefContext);
preference.setTitle(getTitle(prefContext, typeOfDefault, appsForCategory.size()));
preference.setSummary(buildSummaryString(prefContext, appsForCategory));
preference.setOrder(typeOfDefault.ordinal());
preference.setSelectable(false);
group.addPreference(preference);
}
}
use of com.android.settings.applications.EnterpriseDefaultApps in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class EnterpriseSetDefaultAppsListPreferenceController method createPreferences.
private void createPreferences(Context prefContext, PreferenceGroup group, EnumMap<EnterpriseDefaultApps, List<ApplicationInfo>> apps) {
if (group == null) {
return;
}
for (EnterpriseDefaultApps typeOfDefault : EnterpriseDefaultApps.values()) {
final List<ApplicationInfo> appsForCategory = apps.get(typeOfDefault);
if (appsForCategory == null || appsForCategory.isEmpty()) {
continue;
}
final Preference preference = new Preference(prefContext);
preference.setTitle(getTitle(prefContext, typeOfDefault, appsForCategory.size()));
preference.setSummary(buildSummaryString(prefContext, appsForCategory));
preference.setOrder(typeOfDefault.ordinal());
preference.setSelectable(false);
group.addPreference(preference);
}
}
use of com.android.settings.applications.EnterpriseDefaultApps in project android_packages_apps_Settings by omnirom.
the class EnterpriseSetDefaultAppsListPreferenceController method buildAppList.
/**
* Builds data for UI. Updates mUsers and mApps so that they contain non-empty list.
*/
private void buildAppList() {
mUsers = new ArrayList<>();
mApps = new ArrayList<>();
for (UserHandle user : mUserFeatureProvider.getUserProfiles()) {
boolean hasDefaultsForUser = false;
EnumMap<EnterpriseDefaultApps, List<ApplicationInfo>> userMap = null;
for (EnterpriseDefaultApps typeOfDefault : EnterpriseDefaultApps.values()) {
List<UserAppInfo> apps = mApplicationFeatureProvider.findPersistentPreferredActivities(user.getIdentifier(), typeOfDefault.getIntents());
if (apps.isEmpty()) {
continue;
}
if (!hasDefaultsForUser) {
hasDefaultsForUser = true;
mUsers.add(apps.get(0).userInfo);
userMap = new EnumMap<>(EnterpriseDefaultApps.class);
mApps.add(userMap);
}
ArrayList<ApplicationInfo> applicationInfos = new ArrayList<>();
for (UserAppInfo userAppInfo : apps) {
applicationInfos.add(userAppInfo.appInfo);
}
userMap.put(typeOfDefault, applicationInfos);
}
}
ThreadUtils.postOnMainThread(() -> updateUi());
}
use of com.android.settings.applications.EnterpriseDefaultApps in project android_packages_apps_Settings by omnirom.
the class EnterpriseSetDefaultAppsListPreferenceController method createPreferences.
private void createPreferences(Context prefContext, PreferenceGroup group, EnumMap<EnterpriseDefaultApps, List<ApplicationInfo>> apps) {
if (group == null) {
return;
}
for (EnterpriseDefaultApps typeOfDefault : EnterpriseDefaultApps.values()) {
final List<ApplicationInfo> appsForCategory = apps.get(typeOfDefault);
if (appsForCategory == null || appsForCategory.isEmpty()) {
continue;
}
final Preference preference = new Preference(prefContext);
preference.setTitle(getTitle(prefContext, typeOfDefault, appsForCategory.size()));
preference.setSummary(buildSummaryString(prefContext, appsForCategory));
preference.setOrder(typeOfDefault.ordinal());
preference.setSelectable(false);
group.addPreference(preference);
}
}
Aggregations