use of androidx.preference.PreferenceCategory in project android_packages_apps_Settings by omnirom.
the class ChannelListPreferenceController method updateFullList.
/**
* Update the preferences group to match the
* @param groupPrefsList
* @param channelGroups
*/
void updateFullList(@NonNull PreferenceCategory groupPrefsList, @NonNull List<NotificationChannelGroup> channelGroups) {
if (channelGroups.isEmpty()) {
if (groupPrefsList.getPreferenceCount() == 1 && KEY_ZERO_CATEGORIES.equals(groupPrefsList.getPreference(0).getKey())) {
// Ensure the titles are correct for the current language, but otherwise leave alone
PreferenceGroup groupCategory = (PreferenceGroup) groupPrefsList.getPreference(0);
groupCategory.setTitle(R.string.notification_channels);
groupCategory.getPreference(0).setTitle(R.string.no_channels);
} else {
// Clear any contents and create the 'zero-categories' group.
groupPrefsList.removeAll();
PreferenceCategory groupCategory = new PreferenceCategory(mContext);
groupCategory.setTitle(R.string.notification_channels);
groupCategory.setKey(KEY_ZERO_CATEGORIES);
groupPrefsList.addPreference(groupCategory);
Preference empty = new Preference(mContext);
empty.setTitle(R.string.no_channels);
empty.setEnabled(false);
groupCategory.addPreference(empty);
}
} else {
updateGroupList(groupPrefsList, channelGroups);
}
}
use of androidx.preference.PreferenceCategory in project android_packages_apps_Settings by omnirom.
the class NetworkProviderSettingsTest method getConnectedWifiPreferenceCategory_internetWiFi_getConnectedAccessPoints.
@Test
public void getConnectedWifiPreferenceCategory_internetWiFi_getConnectedAccessPoints() {
doReturn(InternetUpdater.INTERNET_WIFI).when(mInternetUpdater).getInternetType();
final PreferenceCategory pc = mNetworkProviderSettings.getConnectedWifiPreferenceCategory();
assertThat(pc.getKey()).isEqualTo(NetworkProviderSettings.PREF_KEY_CONNECTED_ACCESS_POINTS);
}
use of androidx.preference.PreferenceCategory in project android_packages_apps_Settings by omnirom.
the class NetworkProviderSettingsTest method getConnectedWifiPreferenceCategory_internetCellular_getFirstAccessPoints.
@Test
public void getConnectedWifiPreferenceCategory_internetCellular_getFirstAccessPoints() {
doReturn(InternetUpdater.INTERNET_CELLULAR).when(mInternetUpdater).getInternetType();
final PreferenceCategory pc = mNetworkProviderSettings.getConnectedWifiPreferenceCategory();
assertThat(pc.getKey()).isEqualTo(NetworkProviderSettings.PREF_KEY_FIRST_ACCESS_POINTS);
}
use of androidx.preference.PreferenceCategory in project android_packages_apps_Settings by omnirom.
the class AccessibilitySettings method initializeAllPreferences.
private void initializeAllPreferences() {
for (int i = 0; i < CATEGORIES.length; i++) {
PreferenceCategory prefCategory = findPreference(CATEGORIES[i]);
mCategoryToPrefCategoryMap.put(CATEGORIES[i], prefCategory);
}
}
use of androidx.preference.PreferenceCategory in project android_packages_apps_Settings by omnirom.
the class AccessibilitySettings method initializePreBundledServicesMapFromArray.
private void initializePreBundledServicesMapFromArray(String categoryKey, int key) {
String[] services = getResources().getStringArray(key);
PreferenceCategory category = mCategoryToPrefCategoryMap.get(categoryKey);
for (int i = 0; i < services.length; i++) {
ComponentName component = ComponentName.unflattenFromString(services[i]);
mPreBundledServiceComponentToCategoryMap.put(component, category);
}
}
Aggregations