use of com.android.settingslib.core.AbstractPreferenceController in project android_packages_apps_Settings by DirtyUnicorns.
the class DashboardFragment method onPreferenceTreeClick.
@Override
public boolean onPreferenceTreeClick(Preference preference) {
Collection<AbstractPreferenceController> controllers = mPreferenceControllers.values();
// If preference contains intent, log it before handling.
mMetricsFeatureProvider.logDashboardStartIntent(getContext(), preference.getIntent(), getMetricsCategory());
// Give all controllers a chance to handle click.
for (AbstractPreferenceController controller : controllers) {
if (controller.handlePreferenceTreeClick(preference)) {
return true;
}
}
return super.onPreferenceTreeClick(preference);
}
use of com.android.settingslib.core.AbstractPreferenceController in project android_packages_apps_Settings by DirtyUnicorns.
the class DisplaySettingsTest method testPreferenceControllers_getPreferenceKeys_existInPreferenceScreen.
@Test
@Config(shadows = ShadowPowerManagerWrapper.class)
public void testPreferenceControllers_getPreferenceKeys_existInPreferenceScreen() {
final Context context = RuntimeEnvironment.application;
// PowerManager wrapper = mock(PowerManager.class);
// doReturn(wrapper).when(context).getSystemService(Context.POWER_SERVICE);
final DisplaySettings fragment = new DisplaySettings();
final List<String> preferenceScreenKeys = XmlTestUtils.getKeysFromPreferenceXml(context, fragment.getPreferenceScreenResId());
final List<String> preferenceKeys = new ArrayList<>();
for (AbstractPreferenceController controller : fragment.getPreferenceControllers(context)) {
preferenceKeys.add(controller.getPreferenceKey());
}
// Nightmode is currently hidden
preferenceKeys.remove("night_mode");
assertThat(preferenceScreenKeys).containsAllIn(preferenceKeys);
}
use of com.android.settingslib.core.AbstractPreferenceController in project android_packages_apps_Settings by DirtyUnicorns.
the class DefaultAppSettings method buildPreferenceControllers.
private static List<AbstractPreferenceController> buildPreferenceControllers(Context context) {
final List<AbstractPreferenceController> controllers = new ArrayList<>();
controllers.add(new DefaultAssistPreferenceController(context, KEY_ASSIST_VOICE_INPUT, false));
controllers.add(new DefaultBrowserPreferenceController(context));
controllers.add(new DefaultWorkBrowserPreferenceController(context));
controllers.add(new DefaultPhonePreferenceController(context));
controllers.add(new DefaultWorkPhonePreferenceController(context));
controllers.add(new DefaultSmsPreferenceController(context));
controllers.add(new DefaultEmergencyPreferenceController(context));
controllers.add(new DefaultHomePreferenceController(context));
controllers.add(new DefaultPaymentSettingsPreferenceController(context));
return controllers;
}
use of com.android.settingslib.core.AbstractPreferenceController in project android_packages_apps_Settings by crdroidandroid.
the class BluetoothSettings method getPreferenceControllers.
@Override
protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
final List<AbstractPreferenceController> controllers = new ArrayList<>();
final Lifecycle lifecycle = getLifecycle();
mDeviceNamePrefController = new BluetoothDeviceNamePreferenceController(context, lifecycle);
mPairingPrefController = new BluetoothPairingPreferenceController(context, this, (SettingsActivity) getActivity());
controllers.add(mDeviceNamePrefController);
controllers.add(mPairingPrefController);
controllers.add(new BluetoothFilesPreferenceController(context));
controllers.add(new BluetoothDeviceRenamePreferenceController(context, this, lifecycle));
return controllers;
}
use of com.android.settingslib.core.AbstractPreferenceController in project android_packages_apps_Settings by crdroidandroid.
the class ConnectedDeviceDashboardFragment method getPreferenceControllers.
@Override
protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
final List<AbstractPreferenceController> controllers = new ArrayList<>();
final Lifecycle lifecycle = getLifecycle();
final NfcPreferenceController nfcPreferenceController = new NfcPreferenceController(context);
lifecycle.addObserver(nfcPreferenceController);
controllers.add(nfcPreferenceController);
mUsbPrefController = new UsbModePreferenceController(context, new UsbBackend(context));
lifecycle.addObserver(mUsbPrefController);
controllers.add(mUsbPrefController);
final BluetoothMasterSwitchPreferenceController bluetoothPreferenceController = new BluetoothMasterSwitchPreferenceController(context, Utils.getLocalBtManager(context), this, (SettingsActivity) getActivity());
lifecycle.addObserver(bluetoothPreferenceController);
controllers.add(bluetoothPreferenceController);
SmsMirroringFeatureProvider smsMirroringFeatureProvider = FeatureFactory.getFactory(context).getSmsMirroringFeatureProvider();
AbstractPreferenceController smsMirroringController = smsMirroringFeatureProvider.getController(context);
controllers.add(smsMirroringController);
return controllers;
}
Aggregations