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));
}
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);
}
}
}
}
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);
}
}
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);
}
}
}
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);
}
Aggregations