use of com.android.settingslib.core.AbstractPreferenceController in project android_packages_apps_Settings by crdroidandroid.
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 platform_packages_apps_Settings by BlissRoms.
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 platform_packages_apps_Settings by BlissRoms.
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;
}
use of com.android.settingslib.core.AbstractPreferenceController in project platform_packages_apps_Settings by BlissRoms.
the class StorageDashboardFragment method getPreferenceControllers.
@Override
protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
final List<AbstractPreferenceController> controllers = new ArrayList<>();
mSummaryController = new StorageSummaryDonutPreferenceController(context);
controllers.add(mSummaryController);
StorageManager sm = context.getSystemService(StorageManager.class);
mPreferenceController = new StorageItemPreferenceController(context, this, mVolume, new StorageManagerVolumeProvider(sm));
controllers.add(mPreferenceController);
UserManagerWrapper userManager = new UserManagerWrapperImpl(context.getSystemService(UserManager.class));
mSecondaryUsers = SecondaryUserController.getSecondaryUserControllers(context, userManager);
controllers.addAll(mSecondaryUsers);
final AutomaticStorageManagementSwitchPreferenceController asmController = new AutomaticStorageManagementSwitchPreferenceController(context, mMetricsFeatureProvider, getFragmentManager());
getLifecycle().addObserver(asmController);
controllers.add(asmController);
return controllers;
}
use of com.android.settingslib.core.AbstractPreferenceController in project platform_packages_apps_Settings by BlissRoms.
the class StorageDashboardFragment method onReceivedSizes.
private void onReceivedSizes() {
if (mStorageInfo != null) {
long privateUsedBytes = mStorageInfo.totalBytes - mStorageInfo.freeBytes;
mSummaryController.updateBytes(privateUsedBytes, mStorageInfo.totalBytes);
mPreferenceController.setVolume(mVolume);
mPreferenceController.setUsedSize(privateUsedBytes);
mPreferenceController.setTotalSize(mStorageInfo.totalBytes);
for (int i = 0, size = mSecondaryUsers.size(); i < size; i++) {
AbstractPreferenceController controller = mSecondaryUsers.get(i);
if (controller instanceof SecondaryUserController) {
SecondaryUserController userController = (SecondaryUserController) controller;
userController.setTotalSize(mStorageInfo.totalBytes);
}
}
}
if (mAppsResult == null) {
return;
}
mPreferenceController.onLoadFinished(mAppsResult, UserHandle.myUserId());
updateSecondaryUserControllers(mSecondaryUsers, mAppsResult);
// setLoading always causes a flicker, so let's avoid doing it.
if (getView().findViewById(R.id.loading_container).getVisibility() == View.VISIBLE) {
setLoading(false, true);
}
}
Aggregations