use of androidx.preference.DropDownPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class DockAudioMediaPreferenceControllerTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
when(mSetting.getActivity()).thenReturn(mActivity);
when(mActivity.getContentResolver()).thenReturn(mContentResolver);
when(mActivity.getResources().getBoolean(com.android.settings.R.bool.has_dock_settings)).thenReturn(true);
when(mActivity.getResources().getString(anyInt())).thenReturn("test string");
mPreference = new DropDownPreference(RuntimeEnvironment.application);
mController = new DockAudioMediaPreferenceController(mContext, mSetting, null);
when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
doReturn(mScreen).when(mSetting).getPreferenceScreen();
}
use of androidx.preference.DropDownPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class NfcForegroundPreferenceControllerTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mContext = spy(RuntimeEnvironment.application);
when(mContext.getPackageManager()).thenReturn(mManager);
mFakeFeatureFactory = FakeFeatureFactory.setupForTest();
mController = new NfcForegroundPreferenceController(mContext, PREF_KEY);
mPreference = new DropDownPreference(mContext);
when(mScreen.findPreference(PREF_KEY)).thenReturn(mPreference);
}
use of androidx.preference.DropDownPreference in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class EmergencyTonePreferenceControllerTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
final Context appContext = RuntimeEnvironment.application;
when(mContext.getSystemService(Context.TELEPHONY_SERVICE)).thenReturn(mTelephonyManager);
when(mTelephonyManager.getCurrentPhoneType()).thenReturn(TelephonyManager.PHONE_TYPE_CDMA);
when(mSetting.getActivity()).thenReturn(mActivity);
when(mActivity.getSystemService(Context.TELEPHONY_SERVICE)).thenReturn(mTelephonyManager);
when(mActivity.getContentResolver()).thenReturn(mContentResolver);
when(mActivity.getResources()).thenReturn(appContext.getResources());
mPreference = new DropDownPreference(appContext);
mController = new EmergencyTonePreferenceController(mContext, mSetting, null);
when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
doReturn(mScreen).when(mSetting).getPreferenceScreen();
}
use of androidx.preference.DropDownPreference in project android_packages_apps_Settings by omnirom.
the class ZenModeEventRuleSettings method onCreateInternal.
@Override
protected void onCreateInternal() {
mCreate = true;
final PreferenceScreen root = getPreferenceScreen();
mCalendar = (DropDownPreference) root.findPreference(KEY_CALENDAR);
mCalendar.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
final String calendarKey = (String) newValue;
if (calendarKey.equals(key(mEvent)))
return false;
String[] key = calendarKey.split(":", 3);
mEvent.userId = Integer.parseInt(key[0]);
mEvent.calendarId = key[1].equals("") ? null : Long.parseLong(key[1]);
mEvent.calName = key[2].equals("") ? null : key[2];
updateRule(ZenModeConfig.toEventConditionId(mEvent));
return true;
}
});
mReply = (DropDownPreference) root.findPreference(KEY_REPLY);
mReply.setEntries(new CharSequence[] { getString(R.string.zen_mode_event_rule_reply_any_except_no), getString(R.string.zen_mode_event_rule_reply_yes_or_maybe), getString(R.string.zen_mode_event_rule_reply_yes) });
mReply.setEntryValues(new CharSequence[] { Integer.toString(EventInfo.REPLY_ANY_EXCEPT_NO), Integer.toString(EventInfo.REPLY_YES_OR_MAYBE), Integer.toString(EventInfo.REPLY_YES) });
mReply.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
final int reply = Integer.parseInt((String) newValue);
if (reply == mEvent.reply)
return false;
mEvent.reply = reply;
updateRule(ZenModeConfig.toEventConditionId(mEvent));
return true;
}
});
reloadCalendar();
updateControlsInternal();
}
use of androidx.preference.DropDownPreference in project android_packages_apps_Settings by omnirom.
the class DockAudioMediaPreferenceControllerTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
when(mSetting.getActivity()).thenReturn(mActivity);
when(mActivity.getContentResolver()).thenReturn(mContentResolver);
when(mActivity.getResources().getBoolean(com.android.settings.R.bool.has_dock_settings)).thenReturn(true);
when(mActivity.getResources().getString(anyInt())).thenReturn("test string");
mPreference = new DropDownPreference(RuntimeEnvironment.application);
mController = new DockAudioMediaPreferenceController(mContext, mSetting, null);
when(mScreen.findPreference(mController.getPreferenceKey())).thenReturn(mPreference);
doReturn(mScreen).when(mSetting).getPreferenceScreen();
}
Aggregations