use of com.android.settingslib.widget.RadioButtonPreference in project android_packages_apps_Settings by omnirom.
the class ZenModePrioritySendersPreferenceController method makeRadioPreference.
private RadioButtonPreference makeRadioPreference(String key, int titleId) {
final RadioButtonPreference pref = new RadioButtonPreference(mPreferenceCategory.getContext());
pref.setKey(key);
pref.setTitle(titleId);
pref.setOnClickListener(mRadioButtonClickListener);
View.OnClickListener widgetClickListener = getWidgetClickListener(key);
if (widgetClickListener != null) {
pref.setExtraWidgetOnClickListener(widgetClickListener);
}
mPreferenceCategory.addPreference(pref);
mRadioButtonPreferences.add(pref);
return pref;
}
use of com.android.settingslib.widget.RadioButtonPreference in project android_packages_apps_Settings by omnirom.
the class ZenModePriorityConversationsPreferenceController method updateState.
@Override
public void updateState(Preference preference) {
final int currSetting = mBackend.getPriorityConversationSenders();
for (RadioButtonPreference pref : mRadioButtonPreferences) {
pref.setChecked(keyToSetting(pref.getKey()) == currSetting);
pref.setSummary(getSummary(pref.getKey()));
}
}
use of com.android.settingslib.widget.RadioButtonPreference in project android_packages_apps_Settings by omnirom.
the class ZenModePriorityConversationsPreferenceController method makeRadioPreference.
private RadioButtonPreference makeRadioPreference(String key, int titleId) {
final RadioButtonPreference pref = new RadioButtonPreference(mPreferenceCategory.getContext());
if (KEY_ALL.equals(key) || KEY_IMPORTANT.equals(key)) {
pref.setExtraWidgetOnClickListener(mConversationSettingsWidgetClickListener);
}
pref.setKey(key);
pref.setTitle(titleId);
pref.setOnClickListener(mRadioButtonClickListener);
mPreferenceCategory.addPreference(pref);
mRadioButtonPreferences.add(pref);
return pref;
}
use of com.android.settingslib.widget.RadioButtonPreference in project android_packages_apps_Settings by omnirom.
the class ZenModePriorityConversationsPreferenceControllerTest method clickImportantConversations.
@Test
public void clickImportantConversations() {
RadioButtonPreference importantConversationsRb = getButton(KEY_IMPORTANT);
importantConversationsRb.onClick();
verify(mZenBackend).saveConversationSenders(CONVERSATION_SENDERS_IMPORTANT);
}
use of com.android.settingslib.widget.RadioButtonPreference in project android_packages_apps_Settings by omnirom.
the class ZenModePrioritySendersPreferenceControllerTest method clickStarredSenders.
@Test
public void clickStarredSenders() {
// GIVEN current priority message senders are ANY
when(mZenBackend.getPriorityMessageSenders()).thenReturn(PRIORITY_SENDERS_ANY);
// WHEN user clicks the starred contacts option
RadioButtonPreference starredRb = getButton(KEY_STARRED);
starredRb.onClick();
// THEN starred contacts gets saved as priority senders for messages
verify(mZenBackend).saveSenders(PRIORITY_CATEGORY_MESSAGES, PRIORITY_SENDERS_STARRED);
}
Aggregations