use of com.android.settingslib.RestrictedSwitchPreference in project android_packages_apps_Settings by DirtyUnicorns.
the class AddUserWhenLockedPreferenceControllerTest method updateState_preferenceSetUncheckedWhenSettingIsOff.
@Test
public void updateState_preferenceSetUncheckedWhenSettingIsOff() {
final RestrictedSwitchPreference preference = mock(RestrictedSwitchPreference.class);
Global.putInt(mContext.getContentResolver(), Global.ADD_USERS_WHEN_LOCKED, 0);
mController.updateState(preference);
verify(preference).setChecked(false);
}
use of com.android.settingslib.RestrictedSwitchPreference in project android_packages_apps_Settings by DirtyUnicorns.
the class AddUserWhenLockedPreferenceControllerTest method updateState_preferenceSetCheckedWhenSettingIsOn.
@Test
public void updateState_preferenceSetCheckedWhenSettingIsOn() {
final RestrictedSwitchPreference preference = mock(RestrictedSwitchPreference.class);
Global.putInt(mContext.getContentResolver(), Global.ADD_USERS_WHEN_LOCKED, 1);
mController.updateState(preference);
verify(preference).setChecked(true);
}
use of com.android.settingslib.RestrictedSwitchPreference in project android_packages_apps_Settings by crdroidandroid.
the class AddUserWhenLockedPreferenceController method updateState.
@Override
public void updateState(Preference preference) {
RestrictedSwitchPreference restrictedSwitchPreference = (RestrictedSwitchPreference) preference;
int value = Global.getInt(mContext.getContentResolver(), Global.ADD_USERS_WHEN_LOCKED, 0);
restrictedSwitchPreference.setChecked(value == 1);
restrictedSwitchPreference.setDisabledByAdmin(mUserCaps.disallowAddUser() ? mUserCaps.getEnforcedAdmin() : null);
}
use of com.android.settingslib.RestrictedSwitchPreference in project android_packages_apps_Settings by crdroidandroid.
the class AddUserWhenLockedPreferenceControllerTest method onPreferenceChange_SettingIsOffWhenPreferenceNotChecked.
@Test
public void onPreferenceChange_SettingIsOffWhenPreferenceNotChecked() {
final RestrictedSwitchPreference preference = mock(RestrictedSwitchPreference.class);
preference.setChecked(false);
mController.onPreferenceChange(preference, Boolean.FALSE);
assertThat(Global.getInt(mContext.getContentResolver(), Global.ADD_USERS_WHEN_LOCKED, 0)).isEqualTo(0);
}
use of com.android.settingslib.RestrictedSwitchPreference in project android_packages_apps_Settings by crdroidandroid.
the class AutoTimePreferenceControllerTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mContext = ShadowApplication.getInstance().getApplicationContext();
mPreference = new RestrictedSwitchPreference(mContext);
mController = new AutoTimePreferenceController(mContext, mCallback);
}
Aggregations