Search in sources :

Example 86 with PreferenceCategory

use of androidx.preference.PreferenceCategory in project android_packages_apps_Settings by omnirom.

the class ToggleFeaturePreferenceFragment method initSettingsPreference.

protected void initSettingsPreference() {
    if (mSettingsTitle == null || mSettingsIntent == null) {
        return;
    }
    // Show the "Settings" menu as if it were a preference screen.
    mSettingsPreference = new Preference(getPrefContext());
    mSettingsPreference.setTitle(mSettingsTitle);
    mSettingsPreference.setIconSpaceReserved(false);
    mSettingsPreference.setIntent(mSettingsIntent);
    final PreferenceCategory generalCategory = findPreference(KEY_GENERAL_CATEGORY);
    generalCategory.addPreference(mSettingsPreference);
}
Also used : SettingsMainSwitchPreference(com.android.settings.widget.SettingsMainSwitchPreference) IllustrationPreference(com.android.settingslib.widget.IllustrationPreference) Preference(androidx.preference.Preference) PreferenceCategory(androidx.preference.PreferenceCategory)

Example 87 with PreferenceCategory

use of androidx.preference.PreferenceCategory in project android_packages_apps_Settings by omnirom.

the class ToggleFeaturePreferenceFragment method initGeneralCategory.

private void initGeneralCategory() {
    final PreferenceCategory generalCategory = new PreferenceCategory(getPrefContext());
    generalCategory.setKey(KEY_GENERAL_CATEGORY);
    generalCategory.setTitle(R.string.accessibility_screen_option);
    getPreferenceScreen().addPreference(generalCategory);
}
Also used : PreferenceCategory(androidx.preference.PreferenceCategory)

Example 88 with PreferenceCategory

use of androidx.preference.PreferenceCategory in project android_packages_apps_Settings by omnirom.

the class ToggleReduceBrightColorsPreferenceFragment method updateGeneralCategoryOrder.

private void updateGeneralCategoryOrder() {
    final PreferenceCategory generalCategory = findPreference(KEY_GENERAL_CATEGORY);
    final SeekBarPreference intensity = findPreference(KEY_INTENSITY);
    getPreferenceScreen().removePreference(intensity);
    intensity.setOrder(mShortcutPreference.getOrder() - 2);
    generalCategory.addPreference(intensity);
    final SwitchPreference persist = findPreference(KEY_PERSIST);
    getPreferenceScreen().removePreference(persist);
    persist.setOrder(mShortcutPreference.getOrder() - 1);
    generalCategory.addPreference(persist);
}
Also used : PreferenceCategory(androidx.preference.PreferenceCategory) SwitchPreference(androidx.preference.SwitchPreference) SettingsMainSwitchPreference(com.android.settings.widget.SettingsMainSwitchPreference) SeekBarPreference(com.android.settings.widget.SeekBarPreference)

Example 89 with PreferenceCategory

use of androidx.preference.PreferenceCategory in project android_packages_apps_Settings by omnirom.

the class SimStatusPreferenceController method displayPreference.

@Override
public void displayPreference(PreferenceScreen screen) {
    super.displayPreference(screen);
    final Preference preference = screen.findPreference(getPreferenceKey());
    if (!isAvailable() || preference == null || !preference.isVisible()) {
        return;
    }
    final PreferenceCategory category = screen.findPreference(KEY_PREFERENCE_CATEGORY);
    mPreferenceList.add(preference);
    final int simStatusOrder = preference.getOrder();
    // Add additional preferences for each sim in the device
    for (int simSlotNumber = 1; simSlotNumber < mTelephonyManager.getPhoneCount(); simSlotNumber++) {
        final Preference multiSimPreference = createNewPreference(screen.getContext());
        multiSimPreference.setOrder(simStatusOrder + simSlotNumber);
        multiSimPreference.setKey(KEY_SIM_STATUS + simSlotNumber);
        category.addPreference(multiSimPreference);
        mPreferenceList.add(multiSimPreference);
    }
}
Also used : Preference(androidx.preference.Preference) PreferenceCategory(androidx.preference.PreferenceCategory)

Example 90 with PreferenceCategory

use of androidx.preference.PreferenceCategory in project android_packages_apps_Settings by omnirom.

the class ImeiInfoPreferenceController method displayPreference.

@Override
public void displayPreference(PreferenceScreen screen) {
    super.displayPreference(screen);
    final Preference preference = screen.findPreference(getPreferenceKey());
    final PreferenceCategory category = screen.findPreference(KEY_PREFERENCE_CATEGORY);
    mPreferenceList.add(preference);
    updatePreference(preference, 0);
    final int imeiPreferenceOrder = preference.getOrder();
    // Add additional preferences for each sim in the device
    for (int simSlotNumber = 1; simSlotNumber < mTelephonyManager.getPhoneCount(); simSlotNumber++) {
        final Preference multiSimPreference = createNewPreference(screen.getContext());
        multiSimPreference.setOrder(imeiPreferenceOrder + simSlotNumber);
        multiSimPreference.setKey(getPreferenceKey() + simSlotNumber);
        category.addPreference(multiSimPreference);
        mPreferenceList.add(multiSimPreference);
        updatePreference(multiSimPreference, simSlotNumber);
    }
}
Also used : Preference(androidx.preference.Preference) PreferenceCategory(androidx.preference.PreferenceCategory)

Aggregations

PreferenceCategory (androidx.preference.PreferenceCategory)111 Preference (androidx.preference.Preference)38 PreferenceManager (androidx.preference.PreferenceManager)24 Before (org.junit.Before)24 PreferenceScreen (androidx.preference.PreferenceScreen)22 Test (org.junit.Test)19 SwitchPreference (androidx.preference.SwitchPreference)13 NotificationChannel (android.app.NotificationChannel)11 ArrayList (java.util.ArrayList)11 NotificationChannelGroup (android.app.NotificationChannelGroup)9 ShortcutInfo (android.content.pm.ShortcutInfo)9 Context (android.content.Context)8 ConversationChannel (android.app.people.ConversationChannel)7 View (android.view.View)7 PreferenceViewHolder (androidx.preference.PreferenceViewHolder)7 Lifecycle (com.android.settingslib.core.lifecycle.Lifecycle)7 ListPreference (androidx.preference.ListPreference)6 ComponentName (android.content.ComponentName)5 ContentResolver (android.content.ContentResolver)5 Bundle (android.os.Bundle)5