Search in sources :

Example 71 with AbstractPreferenceController

use of com.android.settingslib.core.AbstractPreferenceController in project android_packages_apps_Settings by SudaMod.

the class LockscreenDashboardFragment method getPreferenceControllers.

@Override
protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
    final List<AbstractPreferenceController> controllers = new ArrayList<>();
    final Lifecycle lifecycle = getLifecycle();
    final LockScreenNotificationPreferenceController notificationController = new LockScreenNotificationPreferenceController(context, KEY_LOCK_SCREEN_NOTIFICATON, KEY_LOCK_SCREEN_NOTIFICATON_WORK_PROFILE_HEADER, KEY_LOCK_SCREEN_NOTIFICATON_WORK_PROFILE);
    lifecycle.addObserver(notificationController);
    controllers.add(notificationController);
    final AddUserWhenLockedPreferenceController addUserWhenLockedController = new AddUserWhenLockedPreferenceController(context);
    lifecycle.addObserver(addUserWhenLockedController);
    controllers.add(addUserWhenLockedController);
    mOwnerInfoPreferenceController = new OwnerInfoPreferenceController(context, this, lifecycle);
    controllers.add(mOwnerInfoPreferenceController);
    return controllers;
}
Also used : AbstractPreferenceController(com.android.settingslib.core.AbstractPreferenceController) Lifecycle(com.android.settingslib.core.lifecycle.Lifecycle) ArrayList(java.util.ArrayList) LockScreenNotificationPreferenceController(com.android.settings.notification.LockScreenNotificationPreferenceController) AddUserWhenLockedPreferenceController(com.android.settings.accounts.AddUserWhenLockedPreferenceController)

Example 72 with AbstractPreferenceController

use of com.android.settingslib.core.AbstractPreferenceController in project android_packages_apps_Settings by SudaMod.

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;
}
Also used : NetworkResetPreferenceController(com.android.settings.network.NetworkResetPreferenceController) AbstractPreferenceController(com.android.settingslib.core.AbstractPreferenceController) ArrayList(java.util.ArrayList) ResetAppPrefPreferenceController(com.android.settings.applications.ResetAppPrefPreferenceController)

Example 73 with AbstractPreferenceController

use of com.android.settingslib.core.AbstractPreferenceController in project android_packages_apps_Settings by DirtyUnicorns.

the class PowerUsageSummary method getPreferenceControllers.

@Override
protected List<AbstractPreferenceController> getPreferenceControllers(Context context) {
    final List<AbstractPreferenceController> controllers = new ArrayList<>();
    mBatteryHeaderPreferenceController = new BatteryHeaderPreferenceController(context, getActivity(), this, /* host */
    getLifecycle());
    controllers.add(mBatteryHeaderPreferenceController);
    // controllers.add(new AutoBrightnessPreferenceController(context, KEY_AUTO_BRIGHTNESS));
    // controllers.add(new TimeoutPreferenceController(context, KEY_SCREEN_TIMEOUT));
    controllers.add(new BatterySaverController(context, getLifecycle()));
    controllers.add(new BatteryPercentagePreferenceController(context));
    // KEY_AMBIENT_DISPLAY));
    return controllers;
}
Also used : AbstractPreferenceController(com.android.settingslib.core.AbstractPreferenceController) ArrayList(java.util.ArrayList) BatteryPercentagePreferenceController(com.android.settings.display.BatteryPercentagePreferenceController)

Example 74 with AbstractPreferenceController

use of com.android.settingslib.core.AbstractPreferenceController in project android_packages_apps_Settings by DirtyUnicorns.

the class SecondaryUserControllerTest method profilesOfPrimaryUserAreNotIgnored.

@Test
public void profilesOfPrimaryUserAreNotIgnored() throws Exception {
    ArrayList<UserInfo> userInfos = new ArrayList<>();
    UserInfo secondaryUser = new UserInfo();
    secondaryUser.id = mPrimaryUser.id;
    userInfos.add(mPrimaryUser);
    userInfos.add(secondaryUser);
    when(mUserManager.getPrimaryUser()).thenReturn(mPrimaryUser);
    when(mUserManager.getUsers()).thenReturn(userInfos);
    List<AbstractPreferenceController> controllers = SecondaryUserController.getSecondaryUserControllers(mContext, mUserManager);
    assertThat(controllers).hasSize(2);
    assertThat(controllers.get(0) instanceof UserProfileController).isTrue();
    assertThat(controllers.get(1) instanceof SecondaryUserController).isFalse();
}
Also used : AbstractPreferenceController(com.android.settingslib.core.AbstractPreferenceController) ArrayList(java.util.ArrayList) UserInfo(android.content.pm.UserInfo) Test(org.junit.Test)

Example 75 with AbstractPreferenceController

use of com.android.settingslib.core.AbstractPreferenceController in project android_packages_apps_Settings by DirtyUnicorns.

the class SecondaryUserControllerTest method secondaryUserAddedIfHasDistinctId.

@Test
public void secondaryUserAddedIfHasDistinctId() throws Exception {
    ArrayList<UserInfo> userInfos = new ArrayList<>();
    UserInfo secondaryUser = new UserInfo();
    secondaryUser.id = 10;
    // this just has to be something not 0
    secondaryUser.profileGroupId = 101010;
    userInfos.add(mPrimaryUser);
    userInfos.add(secondaryUser);
    when(mUserManager.getPrimaryUser()).thenReturn(mPrimaryUser);
    when(mUserManager.getUsers()).thenReturn(userInfos);
    List<AbstractPreferenceController> controllers = SecondaryUserController.getSecondaryUserControllers(mContext, mUserManager);
    assertThat(controllers).hasSize(1);
    assertThat(controllers.get(0) instanceof SecondaryUserController).isTrue();
}
Also used : AbstractPreferenceController(com.android.settingslib.core.AbstractPreferenceController) ArrayList(java.util.ArrayList) UserInfo(android.content.pm.UserInfo) Test(org.junit.Test)

Aggregations

AbstractPreferenceController (com.android.settingslib.core.AbstractPreferenceController)298 ArrayList (java.util.ArrayList)211 Test (org.junit.Test)75 Context (android.content.Context)29 Lifecycle (com.android.settingslib.core.lifecycle.Lifecycle)29 UserInfo (android.content.pm.UserInfo)28 SettingsActivity (com.android.settings.SettingsActivity)15 StorageManager (android.os.storage.StorageManager)14 StorageItemPreferenceController (com.android.settings.deviceinfo.storage.StorageItemPreferenceController)14 StorageManagerVolumeProvider (com.android.settingslib.deviceinfo.StorageManagerVolumeProvider)14 PreferenceScreen (android.support.v7.preference.PreferenceScreen)12 AdditionalSystemUpdatePreferenceController (com.android.settings.deviceinfo.AdditionalSystemUpdatePreferenceController)12 TimeoutPreferenceController (com.android.settings.display.TimeoutPreferenceController)10 Activity (android.app.Activity)9 AmbientDisplayConfiguration (com.android.internal.hardware.AmbientDisplayConfiguration)9 AmbientDisplayPreferenceController (com.android.settings.display.AmbientDisplayPreferenceController)9 AutoBrightnessPreferenceController (com.android.settings.display.AutoBrightnessPreferenceController)9 Config (org.robolectric.annotation.Config)7 Bundle (android.os.Bundle)6 SecondaryUserController (com.android.settings.deviceinfo.storage.SecondaryUserController)6