Search in sources :

Example 91 with PreferenceCategory

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

the class PhysicalKeyboardFragment method onCreatePreferences.

@Override
public void onCreatePreferences(Bundle bundle, String s) {
    Activity activity = Preconditions.checkNotNull(getActivity());
    addPreferencesFromResource(R.xml.physical_keyboard_settings);
    mIm = Preconditions.checkNotNull(activity.getSystemService(InputManager.class));
    mKeyboardAssistanceCategory = Preconditions.checkNotNull((PreferenceCategory) findPreference(KEYBOARD_ASSISTANCE_CATEGORY));
    mShowVirtualKeyboardSwitch = Preconditions.checkNotNull((SwitchPreference) mKeyboardAssistanceCategory.findPreference(SHOW_VIRTUAL_KEYBOARD_SWITCH));
}
Also used : PreferenceCategory(androidx.preference.PreferenceCategory) SwitchPreference(androidx.preference.SwitchPreference) Activity(android.app.Activity)

Example 92 with PreferenceCategory

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

the class LocationInjectedServicesPreferenceController method injectLocationServices.

@Override
protected void injectLocationServices(PreferenceScreen screen) {
    final PreferenceCategory categoryLocationServices = screen.findPreference(getPreferenceKey());
    final Map<Integer, List<Preference>> prefs = getLocationServices();
    for (Map.Entry<Integer, List<Preference>> entry : prefs.entrySet()) {
        for (Preference pref : entry.getValue()) {
            if (pref instanceof RestrictedAppPreference) {
                ((RestrictedAppPreference) pref).checkRestrictionAndSetDisabled();
            }
        }
        if (entry.getKey() == UserHandle.myUserId()) {
            if (categoryLocationServices != null) {
                LocationSettings.addPreferencesSorted(entry.getValue(), categoryLocationServices);
            }
        }
    }
}
Also used : PreferenceCategory(androidx.preference.PreferenceCategory) RestrictedAppPreference(com.android.settings.widget.RestrictedAppPreference) Preference(androidx.preference.Preference) List(java.util.List) RestrictedAppPreference(com.android.settings.widget.RestrictedAppPreference) Map(java.util.Map)

Example 93 with PreferenceCategory

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

the class InternetResetHelper method suspendPreferences.

@UiThread
protected void suspendPreferences() {
    Log.d(TAG, "Suspend the subsystem preferences");
    if (mMobileNetworkController != null) {
        mMobileNetworkController.hidePreference(true, /* hide */
        true);
    }
    if (mWifiTogglePreferences != null) {
        mWifiTogglePreferences.setVisible(false);
    }
    for (PreferenceCategory pref : mWifiNetworkPreferences) {
        pref.removeAll();
        pref.setVisible(false);
    }
    if (mResettingPreference != null) {
        mResettingPreference.setVisible(true);
    }
}
Also used : PreferenceCategory(androidx.preference.PreferenceCategory) UiThread(androidx.annotation.UiThread)

Example 94 with PreferenceCategory

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

the class InternetResetHelper method resumePreferences.

@UiThread
protected void resumePreferences() {
    if (mIsRecoveryReady && mMobileNetworkController != null) {
        Log.d(TAG, "Resume the Mobile Network controller");
        mMobileNetworkController.hidePreference(false, /* hide */
        false);
    }
    if (mIsWifiReady && mWifiTogglePreferences != null) {
        Log.d(TAG, "Resume the Wi-Fi preferences");
        mWifiTogglePreferences.setVisible(true);
        for (PreferenceCategory pref : mWifiNetworkPreferences) {
            pref.setVisible(true);
        }
    }
    if (mIsRecoveryReady && mIsWifiReady) {
        mHandlerInjector.removeCallbacks(mTimeoutRunnable);
        if (mResettingPreference != null) {
            Log.d(TAG, "Resume the Resetting preference");
            mResettingPreference.setVisible(false);
        }
    }
}
Also used : PreferenceCategory(androidx.preference.PreferenceCategory) UiThread(androidx.annotation.UiThread)

Example 95 with PreferenceCategory

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

the class UsbDetailsFunctionsControllerTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    mContext = spy(RuntimeEnvironment.application);
    mLifecycle = new Lifecycle(() -> mLifecycle);
    mPreferenceManager = new PreferenceManager(mContext);
    mScreen = mPreferenceManager.createPreferenceScreen(mContext);
    when(mFragment.getActivity()).thenReturn(mActivity);
    when(mActivity.getApplicationContext()).thenReturn(mContext);
    when(mFragment.getContext()).thenReturn(mContext);
    when(mFragment.getPreferenceManager()).thenReturn(mPreferenceManager);
    when(mFragment.getPreferenceScreen()).thenReturn(mScreen);
    when(mContext.getSystemService(TetheringManager.class)).thenReturn(mTetheringManager);
    mDetailsFunctionsController = new UsbDetailsFunctionsController(mContext, mFragment, mUsbBackend);
    mPreferenceCategory = new PreferenceCategory(mContext);
    mPreferenceCategory.setKey(mDetailsFunctionsController.getPreferenceKey());
    mScreen.addPreference(mPreferenceCategory);
    mDetailsFunctionsController.displayPreference(mScreen);
    mRadioButtonPreference = new RadioButtonPreference(mContext);
}
Also used : PreferenceCategory(androidx.preference.PreferenceCategory) Lifecycle(com.android.settingslib.core.lifecycle.Lifecycle) PreferenceManager(androidx.preference.PreferenceManager) RadioButtonPreference(com.android.settingslib.widget.RadioButtonPreference) Before(org.junit.Before)

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