use of androidx.preference.SwitchPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class AutoTimeFormatPreferenceControllerTest method updatePreference_autoSet_shouldSendIntent_24HourLocale.
@Test
public void updatePreference_autoSet_shouldSendIntent_24HourLocale() {
mController = new TestAutoTimeFormatPreferenceController(mContext, mCallback);
mPreference = new SwitchPreference(mContext);
mPreference.setKey(mController.getPreferenceKey());
mPreference.setChecked(false);
mController.setIs24HourLocale(true);
boolean result = mController.handlePreferenceTreeClick(mPreference);
assertThat(result).isTrue();
List<Intent> intentsFired = mApplication.getBroadcastIntents();
assertThat(intentsFired.size()).isEqualTo(1);
Intent intentFired = intentsFired.get(0);
assertThat(intentFired.getAction()).isEqualTo(Intent.ACTION_TIME_CHANGED);
assertThat(intentFired.getIntExtra(Intent.EXTRA_TIME_PREF_24_HOUR_FORMAT, -1)).isEqualTo(Intent.EXTRA_TIME_PREF_VALUE_USE_24_HOUR);
}
use of androidx.preference.SwitchPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class SmartBatteryPreferenceControllerTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mFeatureFactory = FakeFeatureFactory.setupForTest();
mContentResolver = RuntimeEnvironment.application.getContentResolver();
mController = new SmartBatteryPreferenceController(RuntimeEnvironment.application);
mPreference = new SwitchPreference(RuntimeEnvironment.application);
}
use of androidx.preference.SwitchPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ApnEditorTest method setMockPreference.
private void setMockPreference(Context context) {
mApnEditorUT.mName = new EditTextPreference(context);
mApnEditorUT.mApn = new EditTextPreference(context);
mApnEditorUT.mProxy = new EditTextPreference(context);
mApnEditorUT.mPort = new EditTextPreference(context);
mApnEditorUT.mUser = new EditTextPreference(context);
mApnEditorUT.mServer = new EditTextPreference(context);
mApnEditorUT.mPassword = new EditTextPreference(context);
mApnEditorUT.mMmsc = new EditTextPreference(context);
mApnEditorUT.mMcc = new EditTextPreference(context);
mApnEditorUT.mMnc = new EditTextPreference(context);
mApnEditorUT.mMmsProxy = new EditTextPreference(context);
mApnEditorUT.mMmsPort = new EditTextPreference(context);
mApnEditorUT.mAuthType = new ListPreference(context);
mApnEditorUT.mApnType = new EditTextPreference(context);
mApnEditorUT.mProtocol = new ListPreference(context);
mApnEditorUT.mRoamingProtocol = new ListPreference(context);
mApnEditorUT.mCarrierEnabled = new SwitchPreference(context);
mApnEditorUT.mBearerMulti = new MultiSelectListPreference(context);
mApnEditorUT.mMvnoType = new ListPreference(context);
mApnEditorUT.mMvnoMatchData = new EditTextPreference(context);
}
use of androidx.preference.SwitchPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class DataDuringCallsPreferenceControllerTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mContext = spy(RuntimeEnvironment.application);
doReturn(mTelephonyManager).when(mContext).getSystemService(eq(TelephonyManager.class));
when(mTelephonyManager.createForSubscriptionId(anyInt())).thenReturn(mTelephonyManager);
mSwitchPreference = new SwitchPreference(mContext);
when(mPreferenceScreen.findPreference(PREF_KEY)).thenReturn(mSwitchPreference);
mController = new DataDuringCallsPreferenceController(mContext, PREF_KEY);
mController.init(mLifecycle, SUB_ID_1);
}
use of androidx.preference.SwitchPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class DialPadTonePreferenceControllerTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
when(mContext.getSystemService(Context.TELEPHONY_SERVICE)).thenReturn(mTelephonyManager);
when(mTelephonyManager.isVoiceCapable()).thenReturn(true);
when(mSetting.getActivity()).thenReturn(mActivity);
when(mActivity.getSystemService(Context.TELEPHONY_SERVICE)).thenReturn(mTelephonyManager);
when(mActivity.getContentResolver()).thenReturn(mContentResolver);
mPreference = new SwitchPreference(RuntimeEnvironment.application);
mController = new DialPadTonePreferenceController(mContext, mSetting, null);
when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
doReturn(mScreen).when(mSetting).getPreferenceScreen();
}
Aggregations