use of com.android.settingslib.core.AbstractPreferenceController in project android_packages_apps_Settings by crdroidandroid.
the class LanguageAndInputSettingsTest method testPreferenceControllers_getPreferenceKeys_existInPreferenceScreen.
@Test
public void testPreferenceControllers_getPreferenceKeys_existInPreferenceScreen() {
final Context context = RuntimeEnvironment.application;
final LanguageAndInputSettings fragment = new LanguageAndInputSettings();
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());
}
assertThat(preferenceScreenKeys).containsAllIn(preferenceKeys);
}
use of com.android.settingslib.core.AbstractPreferenceController in project android_packages_apps_Settings by crdroidandroid.
the class PowerUsageSummaryTest method testPreferenceControllers_getPreferenceKeys_existInPreferenceScreen.
@Test
public void testPreferenceControllers_getPreferenceKeys_existInPreferenceScreen() {
final Context context = RuntimeEnvironment.application;
final PowerUsageSummary fragment = new PowerUsageSummary();
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());
}
assertThat(preferenceScreenKeys).containsAllIn(preferenceKeys);
}
use of com.android.settingslib.core.AbstractPreferenceController in project android_packages_apps_Settings by crdroidandroid.
the class StorageDashboardFragment method updateSecondaryUserControllers.
/**
* Updates the secondary user controller sizes.
*/
private void updateSecondaryUserControllers(List<AbstractPreferenceController> controllers, SparseArray<StorageAsyncLoader.AppsStorageResult> stats) {
for (int i = 0, size = controllers.size(); i < size; i++) {
AbstractPreferenceController controller = controllers.get(i);
if (controller instanceof StorageAsyncLoader.ResultHandler) {
StorageAsyncLoader.ResultHandler userController = (StorageAsyncLoader.ResultHandler) controller;
userController.handleResult(stats);
}
}
}
use of com.android.settingslib.core.AbstractPreferenceController in project android_packages_apps_Settings by crdroidandroid.
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 crdroidandroid.
the class ResetDashboardFragment method buildPreferenceControllers.
private static List<AbstractPreferenceController> buildPreferenceControllers(Context context, Lifecycle lifecycle) {
final List<AbstractPreferenceController> controllers = new ArrayList<>();
controllers.add(new NetworkResetPreferenceController(context));
controllers.add(new FactoryResetPreferenceController(context));
controllers.add(new ResetAppPrefPreferenceController(context, lifecycle));
return controllers;
}
Aggregations