use of com.android.settingslib.core.AbstractPreferenceController in project android_packages_apps_Settings by SudaMod.
the class DashboardFragment method displayResourceTiles.
/**
* Displays resource based tiles.
*/
private void displayResourceTiles() {
final int resId = getPreferenceScreenResId();
if (resId <= 0) {
return;
}
addPreferencesFromResource(resId);
final PreferenceScreen screen = getPreferenceScreen();
Collection<AbstractPreferenceController> controllers = mPreferenceControllers.values();
for (AbstractPreferenceController controller : controllers) {
controller.displayPreference(screen);
}
}
use of com.android.settingslib.core.AbstractPreferenceController in project android_packages_apps_Settings by SudaMod.
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 android_packages_apps_Settings by SudaMod.
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 SudaMod.
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);
}
}
use of com.android.settingslib.core.AbstractPreferenceController in project android_packages_apps_Settings by SudaMod.
the class StorageProfileFragment method getPreferenceControllers.
@Override
protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
final List<AbstractPreferenceController> controllers = new ArrayList<>();
final StorageManager sm = context.getSystemService(StorageManager.class);
mPreferenceController = new StorageItemPreferenceController(context, this, mVolume, new StorageManagerVolumeProvider(sm), /* isWorkProfile */
true);
controllers.add(mPreferenceController);
return controllers;
}
Aggregations