Search in sources :

Example 1 with LockScreenNotificationPreferenceController

use of com.android.settings.notification.LockScreenNotificationPreferenceController in project android_packages_apps_Settings by LineageOS.

the class SecuritySettingsTest method testSetLockscreenPreferencesSummary_shouldSetSummaryFromLockScreenNotification.

@Test
public void testSetLockscreenPreferencesSummary_shouldSetSummaryFromLockScreenNotification() {
    final Preference preference = mock(Preference.class);
    final PreferenceGroup group = mock(PreferenceGroup.class);
    when(group.findPreference(SecuritySettings.KEY_LOCKSCREEN_PREFERENCES)).thenReturn(preference);
    final LockScreenNotificationPreferenceController controller = mock(LockScreenNotificationPreferenceController.class);
    final SecuritySettings securitySettings = new SecuritySettings();
    ReflectionHelpers.setField(securitySettings, "mLockScreenNotificationPreferenceController", controller);
    when(controller.getSummaryResource()).thenReturn(1234);
    securitySettings.setLockscreenPreferencesSummary(group);
    verify(preference).setSummary(1234);
}
Also used : Preference(android.support.v7.preference.Preference) PreferenceGroup(android.support.v7.preference.PreferenceGroup) LockScreenNotificationPreferenceController(com.android.settings.notification.LockScreenNotificationPreferenceController) Test(org.junit.Test)

Example 2 with LockScreenNotificationPreferenceController

use of com.android.settings.notification.LockScreenNotificationPreferenceController in project android_packages_apps_Settings by LineageOS.

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 3 with LockScreenNotificationPreferenceController

use of com.android.settings.notification.LockScreenNotificationPreferenceController in project android_packages_apps_Settings by omnirom.

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)

Example 4 with LockScreenNotificationPreferenceController

use of com.android.settings.notification.LockScreenNotificationPreferenceController in project android_packages_apps_Settings by omnirom.

the class SecuritySettingsTest method testSetLockscreenPreferencesSummary_shouldSetSummaryFromLockScreenNotification.

@Test
public void testSetLockscreenPreferencesSummary_shouldSetSummaryFromLockScreenNotification() {
    final Preference preference = mock(Preference.class);
    final PreferenceGroup group = mock(PreferenceGroup.class);
    when(group.findPreference(SecuritySettings.KEY_LOCKSCREEN_PREFERENCES)).thenReturn(preference);
    final LockScreenNotificationPreferenceController controller = mock(LockScreenNotificationPreferenceController.class);
    final SecuritySettings securitySettings = new SecuritySettings();
    ReflectionHelpers.setField(securitySettings, "mLockScreenNotificationPreferenceController", controller);
    when(controller.getSummaryResource()).thenReturn(1234);
    securitySettings.setLockscreenPreferencesSummary(group);
    verify(preference).setSummary(1234);
}
Also used : Preference(android.support.v7.preference.Preference) PreferenceGroup(android.support.v7.preference.PreferenceGroup) LockScreenNotificationPreferenceController(com.android.settings.notification.LockScreenNotificationPreferenceController) Test(org.junit.Test)

Example 5 with LockScreenNotificationPreferenceController

use of com.android.settings.notification.LockScreenNotificationPreferenceController in project android_packages_apps_Settings by SudaMod.

the class SecuritySettingsTest method testSetLockscreenPreferencesSummary_shouldSetSummaryFromLockScreenNotification.

@Test
public void testSetLockscreenPreferencesSummary_shouldSetSummaryFromLockScreenNotification() {
    final Preference preference = mock(Preference.class);
    final PreferenceGroup group = mock(PreferenceGroup.class);
    when(group.findPreference(SecuritySettings.KEY_LOCKSCREEN_PREFERENCES)).thenReturn(preference);
    final LockScreenNotificationPreferenceController controller = mock(LockScreenNotificationPreferenceController.class);
    final SecuritySettings securitySettings = new SecuritySettings();
    ReflectionHelpers.setField(securitySettings, "mLockScreenNotificationPreferenceController", controller);
    when(controller.getSummaryResource()).thenReturn(1234);
    securitySettings.setLockscreenPreferencesSummary(group);
    verify(preference).setSummary(1234);
}
Also used : Preference(android.support.v7.preference.Preference) PreferenceGroup(android.support.v7.preference.PreferenceGroup) LockScreenNotificationPreferenceController(com.android.settings.notification.LockScreenNotificationPreferenceController) Test(org.junit.Test)

Aggregations

LockScreenNotificationPreferenceController (com.android.settings.notification.LockScreenNotificationPreferenceController)20 AbstractPreferenceController (com.android.settingslib.core.AbstractPreferenceController)8 ArrayList (java.util.ArrayList)8 Lifecycle (com.android.settingslib.core.lifecycle.Lifecycle)7 Activity (android.app.Activity)6 Preference (android.support.v7.preference.Preference)6 PreferenceGroup (android.support.v7.preference.PreferenceGroup)6 LockPatternUtils (com.android.internal.widget.LockPatternUtils)6 EnterprisePrivacyPreferenceController (com.android.settings.enterprise.EnterprisePrivacyPreferenceController)6 ManageDeviceAdminPreferenceController (com.android.settings.enterprise.ManageDeviceAdminPreferenceController)6 ChooseLockSettingsHelper (com.android.settings.password.ChooseLockSettingsHelper)6 Test (org.junit.Test)6 AddUserWhenLockedPreferenceController (com.android.settings.accounts.AddUserWhenLockedPreferenceController)5 LineageLockPatternUtils (org.lineageos.internal.util.LineageLockPatternUtils)3