use of com.android.settingslib.core.AbstractPreferenceController in project android_packages_apps_Settings by LineageOS.
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 LineageOS.
the class LanguageAndInputSettingsTest method testGetPreferenceControllers_shouldRegisterLifecycleObservers.
@Test
public void testGetPreferenceControllers_shouldRegisterLifecycleObservers() {
final List<AbstractPreferenceController> controllers = mFragment.getPreferenceControllers(mActivity);
int lifecycleObserverCount = 0;
for (AbstractPreferenceController controller : controllers) {
if (controller instanceof LifecycleObserver) {
lifecycleObserverCount++;
}
}
verify(mFragment.getLifecycle(), times(lifecycleObserverCount)).addObserver(any(LifecycleObserver.class));
}
use of com.android.settingslib.core.AbstractPreferenceController in project android_packages_apps_Settings by LineageOS.
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 LineageOS.
the class DashboardFragmentTest method onAttach_shouldCreatePlaceholderPreferenceController.
@Test
public void onAttach_shouldCreatePlaceholderPreferenceController() {
final AbstractPreferenceController controller = mTestFragment.getPreferenceController(DashboardTilePlaceholderPreferenceController.class);
assertThat(controller).isNotNull();
}
use of com.android.settingslib.core.AbstractPreferenceController in project android_packages_apps_Settings by LineageOS.
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