use of android.preference.Preference in project Signal-Android by WhisperSystems.
the class AdvancedPreferenceFragment method initializeIdentitySelection.
private void initializeIdentitySelection() {
ContactIdentityManager identity = ContactIdentityManager.getInstance(getActivity());
Preference preference = this.findPreference(TextSecurePreferences.IDENTITY_PREF);
if (identity.isSelfIdentityAutoDetected()) {
this.getPreferenceScreen().removePreference(preference);
} else {
Uri contactUri = identity.getSelfIdentityUri();
if (contactUri != null) {
String contactName = ContactAccessor.getInstance().getNameFromContact(getActivity(), contactUri);
preference.setSummary(String.format(getString(R.string.ApplicationPreferencesActivity_currently_s), contactName));
}
preference.setOnPreferenceClickListener(new IdentityPreferenceClickListener());
}
}
use of android.preference.Preference in project Signal-Android by WhisperSystems.
the class AppProtectionPreferenceFragment method initializePlatformSpecificOptions.
private void initializePlatformSpecificOptions() {
PreferenceScreen preferenceScreen = getPreferenceScreen();
Preference screenSecurityPreference = findPreference(TextSecurePreferences.SCREEN_SECURITY_PREF);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH && screenSecurityPreference != null) {
preferenceScreen.removePreference(screenSecurityPreference);
}
}
use of android.preference.Preference in project Jota-Text-Editor-old by jiro-aqua.
the class SettingsActivity method createDictionaryPreference.
private void createDictionaryPreference(String categ) {
// new PreferenceScreen
mPs = mPm.createPreferenceScreen(this);
{
if (CAT_TOP.equals(categ)) {
setTitle(R.string.menu_preferences);
{
final Preference pr = new Preference(this);
pr.setTitle(R.string.menu_pref_search);
pr.setOnPreferenceClickListener(mProcPrefSearch);
mPs.addPreference(pr);
}
{
final Preference pr = new Preference(this);
pr.setTitle(R.string.menu_pref_font);
pr.setOnPreferenceClickListener(mProcPrefFont);
mPs.addPreference(pr);
}
{
final Preference pr = new Preference(this);
pr.setTitle(R.string.menu_pref_view);
pr.setOnPreferenceClickListener(mProcPrefView);
mPs.addPreference(pr);
}
{
final Preference pr = new Preference(this);
pr.setTitle(R.string.menu_pref_file);
pr.setOnPreferenceClickListener(mProcPrefFile);
mPs.addPreference(pr);
}
{
final Preference pr = new Preference(this);
pr.setTitle(R.string.menu_pref_input);
pr.setOnPreferenceClickListener(mProcPrefInput);
mPs.addPreference(pr);
}
{
final Preference pr = new Preference(this);
pr.setTitle(R.string.label_miscllaneous);
pr.setOnPreferenceClickListener(mProcPrefMisc);
mPs.addPreference(pr);
}
}
if (CAT_SEARCH.equals(categ)) {
// Search Category
setTitle(R.string.menu_pref_search);
final PreferenceCategory category = new PreferenceCategory(this);
category.setTitle(R.string.label_search);
mPs.addPreference(category);
{
final CheckBoxPreference pr = new CheckBoxPreference(this);
pr.setKey(KEY_RE);
pr.setTitle(R.string.label_re);
category.addPreference(pr);
}
{
final CheckBoxPreference pr = new CheckBoxPreference(this);
pr.setKey(KEY_IGNORE_CASE);
pr.setTitle(R.string.label_ignore_case);
category.addPreference(pr);
}
}
if (CAT_FONT.equals(categ)) {
// Font Category
setTitle(R.string.menu_pref_font);
final PreferenceCategory catfont = new PreferenceCategory(this);
catfont.setTitle(R.string.label_font);
mPs.addPreference(catfont);
{
// Font Typeface
final ListPreference pr = new ListPreference(this);
pr.setKey(KEY_FONT);
pr.setTitle(R.string.label_font_type);
pr.setEntries(new String[] { getString(R.string.label_font_type_normal), getString(R.string.label_font_type_monospace) });
pr.setEntryValues(new CharSequence[] { "NORMAL", "MONOSPACE" });
// pr.setSummary(sp.getString(pr.getKey(), ""));
catfont.addPreference(pr);
mPrefFont = pr;
}
{
// FontSize
final ListPreference pr = new ListPreference(this);
pr.setKey(KEY_FONT_SIZE);
// pr.setSummary(sp.getString(pr.getKey(), ""));
pr.setTitle(R.string.label_font_size);
pr.setEntries(new String[] { "8", "9", "10", "11", "12", "14", "16", "18", "20", "24", "30", "36", "48", "64", "72", "96" });
pr.setEntryValues(new String[] { "8", "9", "10", "11", "12", "14", "16", "18", "20", "24", "30", "36", "48", "64", "72", "96" });
catfont.addPreference(pr);
mPrefFontSize = pr;
}
}
if (CAT_VIEW.equals(categ)) {
// View Category
setTitle(R.string.menu_pref_view);
final PreferenceCategory cat = new PreferenceCategory(this);
cat.setTitle(R.string.label_view);
mPs.addPreference(cat);
{
// word wrap
final CheckBoxPreference pr = new CheckBoxPreference(this);
pr.setKey(KEY_WORD_WRAP);
pr.setTitle(R.string.label_word_wrap);
cat.addPreference(pr);
}
{
// Wrap width portrait
final Preference pr = new Preference(this);
pr.setTitle(R.string.label_wrapwidth_p);
pr.setSummary(R.string.summary_wrapwidth_p);
pr.setOnPreferenceClickListener(mProcWrapWidthPortrait);
cat.addPreference(pr);
mPrefWrapWidthP = pr;
}
{
// Wrap width landscape
final Preference pr = new Preference(this);
pr.setTitle(R.string.label_wrapwidth_l);
pr.setSummary(R.string.summary_wrapwidth_l);
pr.setOnPreferenceClickListener(mProcWrapWidthLandscape);
cat.addPreference(pr);
mPrefWrapWidthL = pr;
}
{
// Tab width
final Preference pr = new Preference(this);
pr.setTitle(R.string.label_tabwidth);
pr.setOnPreferenceClickListener(mProcTabWidthLandscape);
cat.addPreference(pr);
}
{
// Line Spacing
final Preference pr = new Preference(this);
pr.setTitle(R.string.label_line_space);
pr.setOnPreferenceClickListener(mProcLineSpace);
cat.addPreference(pr);
}
{
// show underline
final CheckBoxPreference pr = new CheckBoxPreference(this);
pr.setKey(KEY_UNDERLINE);
pr.setTitle(R.string.label_underline);
cat.addPreference(pr);
}
{
// show line numbers
final CheckBoxPreference pr = new CheckBoxPreference(this);
pr.setKey(KEY_SHOW_LINENUMBERS);
pr.setTitle(R.string.label_show_linenumbers);
cat.addPreference(pr);
}
{
// show tab
final CheckBoxPreference pr = new CheckBoxPreference(this);
pr.setKey(KEY_SHOW_TAB);
pr.setTitle(R.string.label_show_tab);
cat.addPreference(pr);
}
{
// theme
final ListPreference pr = new ListPreference(this);
pr.setDialogTitle(R.string.label_theme);
pr.setKey(KEY_THEME);
pr.setTitle(R.string.label_theme);
pr.setEntries(new String[] { getResources().getString(R.string.label_background_white), getResources().getString(R.string.label_background_black) });
final String[] values = new String[] { THEME_DEFAULT, THEME_BLACK };
pr.setEntryValues(values);
pr.setOnPreferenceChangeListener(mProcTheme);
cat.addPreference(pr);
}
{
// Text Color
final Preference pr = new Preference(this);
pr.setTitle(R.string.label_text_color);
pr.setOnPreferenceClickListener(mProcTextColor);
cat.addPreference(pr);
}
{
// Selection Color
final Preference pr = new Preference(this);
pr.setTitle(R.string.label_highlight_color);
pr.setOnPreferenceClickListener(mProcHighlightColor);
cat.addPreference(pr);
}
{
// Underline Color
final Preference pr = new Preference(this);
pr.setTitle(R.string.label_underline_color);
pr.setOnPreferenceClickListener(mProcUnderlineColor);
cat.addPreference(pr);
}
{
// blink cursor
final CheckBoxPreference pr = new CheckBoxPreference(this);
pr.setKey(KEY_BLINK_CURSOR);
pr.setTitle(R.string.label_blink_cursor);
cat.addPreference(pr);
}
{
// hide titlebar
final CheckBoxPreference pr = new CheckBoxPreference(this);
pr.setKey(KEY_HIDETITLEBAR);
pr.setTitle(R.string.label_hide_titlebar);
pr.setSummary(R.string.summary_need_restart);
cat.addPreference(pr);
}
{
// screen orientation
final ListPreference pr = new ListPreference(this);
pr.setKey(KEY_ORIENTATION);
pr.setDialogTitle(R.string.label_orientation);
pr.setTitle(R.string.label_orientation);
pr.setEntries(new String[] { getResources().getString(R.string.label_orientation_auto), getResources().getString(R.string.label_orientation_portrait), getResources().getString(R.string.label_orientation_landscape) });
final String[] values = new String[] { ORI_AUTO, ORI_PORTRAIT, ORI_LANDSCAPE };
pr.setEntryValues(values);
cat.addPreference(pr);
mPrefOrientation = pr;
}
if (IS01FullScreen.isIS01orLynx()) {
// hide softkey
final CheckBoxPreference pr = new CheckBoxPreference(this);
pr.setKey(KEY_HIDESOFTKEY_IS01);
pr.setTitle(R.string.label_hide_softkey_is01);
pr.setSummary(R.string.summary_need_restart);
cat.addPreference(pr);
}
}
if (CAT_FILE.equals(categ)) {
// File Category
setTitle(R.string.menu_pref_file);
final PreferenceCategory cat = new PreferenceCategory(this);
cat.setTitle(R.string.label_file);
mPs.addPreference(cat);
{
// default directory
final Preference pr = new Preference(this);
pr.setTitle(R.string.label_default_new_file);
pr.setOnPreferenceClickListener(mProcDefaultDirectory);
cat.addPreference(pr);
}
{
// rememer last file
final CheckBoxPreference pr = new CheckBoxPreference(this);
pr.setKey(KEY_REMEMBER_LAST_FILE);
pr.setTitle(R.string.label_open_last_file);
pr.setSummary(R.string.label_open_last_file_summary);
cat.addPreference(pr);
}
{
// create backup file
final CheckBoxPreference pr = new CheckBoxPreference(this);
pr.setKey(KEY_CRETAE_BACKUP);
pr.setTitle(R.string.label_create_backup);
pr.setSummary(R.string.summary_create_backup);
cat.addPreference(pr);
}
{
// Characterset for Open
final ListPreference pr = new ListPreference(this);
pr.setKey(KEY_CHARSET_OPEN);
pr.setTitle(R.string.label_charset_open);
String[] entries = getResources().getStringArray(R.array.CharcterSet_open);
String[] values = getResources().getStringArray(R.array.CharcterSet_open);
values[0] = "";
pr.setEntries(entries);
pr.setEntryValues(values);
cat.addPreference(pr);
mPrefCharsetOpen = pr;
}
{
// Characterset for Save
final ListPreference pr = new ListPreference(this);
pr.setKey(KEY_CHARSET_SAVE);
pr.setTitle(R.string.label_charset_save);
String[] entries = getResources().getStringArray(R.array.CharcterSet_save);
String[] values = getResources().getStringArray(R.array.CharcterSet_save);
values[0] = "";
pr.setEntries(entries);
pr.setEntryValues(values);
cat.addPreference(pr);
mPrefCharsetSave = pr;
}
{
// Characterset for Save
final ListPreference pr = new ListPreference(this);
pr.setKey(KEY_LINEBREAK_SAVE);
pr.setTitle(R.string.label_linebreak_save);
String[] entries = getResources().getStringArray(R.array.LineBreak_save);
String[] values = new String[] { "-1", "0", "1", "2" };
pr.setEntries(entries);
pr.setEntryValues(values);
cat.addPreference(pr);
mPrefLinebreakSave = pr;
}
{
// auto save
final CheckBoxPreference pr = new CheckBoxPreference(this);
pr.setKey(KEY_AUTO_SAVE);
pr.setTitle(R.string.label_auto_save);
pr.setSummary(R.string.summary_auto_save);
cat.addPreference(pr);
}
}
if (CAT_MISC.equals(categ)) {
// Direct Intent Category
setTitle(R.string.label_miscllaneous);
final PreferenceCategory category = new PreferenceCategory(this);
category.setTitle(R.string.label_direct_intent);
mPs.addPreference(category);
{
final ListPreference pr = new ListPreference(this);
pr.setDialogTitle(R.string.label_select_kind);
pr.setKey(KEY_DIRECT_INTENT);
pr.setTitle(R.string.label_select_direct_intent);
pr.setEntries(new String[] { getResources().getString(R.string.label_di_share), getResources().getString(R.string.label_di_search), getResources().getString(R.string.label_di_mushroom), getResources().getString(R.string.label_di_view) });
final String[] values = new String[] { DI_SHARE, DI_SEARCH, DI_MUSHROOM, DI_VIEW };
pr.setEntryValues(values);
pr.setOnPreferenceChangeListener(mProcDirectIntent);
category.addPreference(pr);
mPrefDirectIntent = pr;
}
{
final ListPreference pr = new ListPreference(this);
pr.setDialogTitle(R.string.label_select_kind);
pr.setKey(KEY_DIRECT_INTENT2);
pr.setTitle(R.string.label_select_insert);
pr.setEntries(new String[] { getResources().getString(R.string.label_di_insert), getResources().getString(R.string.label_di_share), getResources().getString(R.string.label_di_search), getResources().getString(R.string.label_di_mushroom), getResources().getString(R.string.label_di_view) });
final String[] values = new String[] { DI_INSERT, DI_SHARE, DI_SEARCH, DI_MUSHROOM, DI_VIEW };
pr.setEntryValues(values);
pr.setOnPreferenceChangeListener(mProcDirectIntent2);
category.addPreference(pr);
mPrefInsert = pr;
}
}
if (CAT_INPUT.equals(categ)) {
// Input Category
setTitle(R.string.menu_pref_input);
final PreferenceCategory category = new PreferenceCategory(this);
category.setTitle(R.string.label_input);
mPs.addPreference(category);
{
// viewer mode
final CheckBoxPreference pr = new CheckBoxPreference(this);
pr.setKey(KEY_VIEWER_MODE);
pr.setTitle(R.string.label_viewer_mode);
pr.setSummary(R.string.summary_viewer_mode);
category.addPreference(pr);
}
{
final CheckBoxPreference pr = new CheckBoxPreference(this);
pr.setKey(KEY_USE_VOLUMEKEY);
pr.setTitle(R.string.label_use_volumekey);
pr.setSummary(R.string.summary_use_volumekey);
category.addPreference(pr);
}
{
// Trackball Button
final ListPreference pr = new ListPreference(this);
pr.setKey(KEY_TRACKBALL_BUTTON);
pr.setTitle(R.string.label_trackball_button);
pr.setEntries(new String[] { getString(R.string.trackball_centering), getString(R.string.trackball_enter), getString(R.string.trackball_contextmenu) });
pr.setEntryValues(new CharSequence[] { TB_CENTERING, TB_ENTER, TB_CONTEXTMENU });
category.addPreference(pr);
mPrefTrackball = pr;
}
{
// AUto capitalize
final CheckBoxPreference pr = new CheckBoxPreference(this);
pr.setKey(KEY_AUTO_CAPITALIZE);
pr.setTitle(R.string.label_auto_capitalize);
pr.setSummary(R.string.summary_auto_capitalize);
category.addPreference(pr);
}
{
final CheckBoxPreference pr = new CheckBoxPreference(this);
pr.setKey(KEY_SHORTCUT_ALT_LEFT);
pr.setTitle(R.string.label_shortcut_alt_left);
category.addPreference(pr);
}
{
final CheckBoxPreference pr = new CheckBoxPreference(this);
pr.setKey(KEY_SHORTCUT_ALT_RIGHT);
pr.setTitle(R.string.label_shortcut_alt_right);
category.addPreference(pr);
}
{
final CheckBoxPreference pr = new CheckBoxPreference(this);
pr.setKey(KEY_SHORTCUT_CTRL);
pr.setTitle(R.string.label_shortcut_ctrl);
pr.setSummary(R.string.summary_ctrl_daz);
category.addPreference(pr);
}
{
final CheckBoxPreference pr = new CheckBoxPreference(this);
pr.setKey(KEY_SHORTCUT_CTRL_LTN);
pr.setTitle(R.string.label_shortcut_ctrl);
pr.setSummary(R.string.summary_ctrl_ltn);
category.addPreference(pr);
}
{
final CheckBoxPreference pr = new CheckBoxPreference(this);
pr.setKey(KEY_SPECIAL_KEY_DESIREZ);
pr.setTitle(R.string.label_shortcut_ctrl);
pr.setSummary(R.string.summary_desirez);
category.addPreference(pr);
}
{
final Preference pr = new Preference(this);
pr.setTitle(R.string.label_customize_shortcut);
pr.setOnPreferenceClickListener(mProcShortcutSettings);
category.addPreference(pr);
}
{
// auto indent
final CheckBoxPreference pr = new CheckBoxPreference(this);
pr.setKey(KEY_AUTO_INDENT);
pr.setTitle(R.string.label_auto_indent);
category.addPreference(pr);
}
}
if (CAT_MISC.equals(categ)) {
// Misc Category
final PreferenceCategory category = new PreferenceCategory(this);
category.setTitle(R.string.label_miscllaneous);
mPs.addPreference(category);
{
// ACTION SHARE
final ListPreference pr = new ListPreference(this);
pr.setKey(KEY_ACTION_SHARE);
pr.setTitle(R.string.label_action_share);
pr.setSummary(R.string.summary_action_share);
pr.setEntries(new String[] { getString(R.string.label_action_share_insert), getString(R.string.label_action_share_newfile) });
pr.setEntryValues(new CharSequence[] { AS_INSERT, AS_NEWFILE });
category.addPreference(pr);
mPrefActionShare = pr;
}
{
final Preference pr = new Preference(this);
pr.setTitle(R.string.label_clear_history);
pr.setOnPreferenceClickListener(mProcClearHisotry);
category.addPreference(pr);
}
{
final Preference pr = new Preference(this);
pr.setTitle(R.string.label_init);
pr.setOnPreferenceClickListener(mProcInit);
category.addPreference(pr);
}
}
if (CAT_MISC.equals(categ)) {
// Help Category
final PreferenceCategory category = new PreferenceCategory(this);
category.setTitle(R.string.label_help);
mPs.addPreference(category);
{
final Preference pr = new Preference(this);
pr.setTitle(R.string.label_help);
pr.setOnPreferenceClickListener(mProcHelp);
category.addPreference(pr);
}
{
final Preference pr = new Preference(this);
pr.setTitle(R.string.label_mail);
pr.setOnPreferenceClickListener(mProcMail);
pr.setSummary(R.string.label_mail_summary);
category.addPreference(pr);
}
{
final Preference pr = new Preference(this);
pr.setTitle(R.string.label_tweet);
pr.setOnPreferenceClickListener(mProcTweet);
pr.setSummary(R.string.label_tweet_summary);
category.addPreference(pr);
}
{
// donate
final Preference pr = new Preference(this);
pr.setTitle(R.string.label_donate);
pr.setSummary(R.string.summary_donate);
pr.setOnPreferenceClickListener(mProcDonate);
category.addPreference(pr);
}
{
final Preference pr = new Preference(this);
pr.setTitle(R.string.label_about);
pr.setOnPreferenceClickListener(mProcAbout);
category.addPreference(pr);
}
}
if (CAT_TOP.equals(categ)) {
if (sSettings.donateCounter == 0) {
// donate
final Preference pr = new Preference(this);
pr.setTitle(R.string.label_donate);
pr.setSummary(R.string.summary_donate);
pr.setOnPreferenceClickListener(mProcDonate);
mPs.addPreference(pr);
}
{
final Preference pr = new Preference(this);
pr.setTitle(R.string.label_about);
pr.setOnPreferenceClickListener(mProcAbout);
mPs.addPreference(pr);
}
}
}
setPreferenceScreen(mPs);
setSummary();
}
use of android.preference.Preference in project k-9 by k9mail.
the class FolderSettings method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
String folderName = (String) getIntent().getSerializableExtra(EXTRA_FOLDER_NAME);
String accountUuid = getIntent().getStringExtra(EXTRA_ACCOUNT);
Account mAccount = Preferences.getPreferences(this).getAccount(accountUuid);
try {
LocalStore localStore = mAccount.getLocalStore();
mFolder = localStore.getFolder(folderName);
mFolder.open(Folder.OPEN_MODE_RW);
} catch (MessagingException me) {
Timber.e(me, "Unable to edit folder %s preferences", folderName);
return;
}
boolean isPushCapable = false;
try {
Store store = mAccount.getRemoteStore();
isPushCapable = store.isPushCapable();
} catch (Exception e) {
Timber.e(e, "Could not get remote store");
}
addPreferencesFromResource(R.xml.folder_settings_preferences);
String displayName = FolderInfoHolder.getDisplayName(this, mAccount, mFolder.getName());
Preference category = findPreference(PREFERENCE_TOP_CATERGORY);
category.setTitle(displayName);
mInTopGroup = (CheckBoxPreference) findPreference(PREFERENCE_IN_TOP_GROUP);
mInTopGroup.setChecked(mFolder.isInTopGroup());
mIntegrate = (CheckBoxPreference) findPreference(PREFERENCE_INTEGRATE);
mIntegrate.setChecked(mFolder.isIntegrate());
mDisplayClass = (ListPreference) findPreference(PREFERENCE_DISPLAY_CLASS);
mDisplayClass.setValue(mFolder.getDisplayClass().name());
mDisplayClass.setSummary(mDisplayClass.getEntry());
mDisplayClass.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
public boolean onPreferenceChange(Preference preference, Object newValue) {
final String summary = newValue.toString();
int index = mDisplayClass.findIndexOfValue(summary);
mDisplayClass.setSummary(mDisplayClass.getEntries()[index]);
mDisplayClass.setValue(summary);
return false;
}
});
mSyncClass = (ListPreference) findPreference(PREFERENCE_SYNC_CLASS);
mSyncClass.setValue(mFolder.getRawSyncClass().name());
mSyncClass.setSummary(mSyncClass.getEntry());
mSyncClass.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
public boolean onPreferenceChange(Preference preference, Object newValue) {
final String summary = newValue.toString();
int index = mSyncClass.findIndexOfValue(summary);
mSyncClass.setSummary(mSyncClass.getEntries()[index]);
mSyncClass.setValue(summary);
return false;
}
});
mPushClass = (ListPreference) findPreference(PREFERENCE_PUSH_CLASS);
mPushClass.setEnabled(isPushCapable);
mPushClass.setValue(mFolder.getRawPushClass().name());
mPushClass.setSummary(mPushClass.getEntry());
mPushClass.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
public boolean onPreferenceChange(Preference preference, Object newValue) {
final String summary = newValue.toString();
int index = mPushClass.findIndexOfValue(summary);
mPushClass.setSummary(mPushClass.getEntries()[index]);
mPushClass.setValue(summary);
return false;
}
});
mNotifyClass = (ListPreference) findPreference(PREFERENCE_NOTIFY_CLASS);
mNotifyClass.setValue(mFolder.getRawNotifyClass().name());
mNotifyClass.setSummary(mNotifyClass.getEntry());
mNotifyClass.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
public boolean onPreferenceChange(Preference preference, Object newValue) {
final String summary = newValue.toString();
int index = mNotifyClass.findIndexOfValue(summary);
mNotifyClass.setSummary(mNotifyClass.getEntries()[index]);
mNotifyClass.setValue(summary);
return false;
}
});
}
use of android.preference.Preference in project qksms by moezbhatti.
the class SettingsFragment method onPreferenceClick.
@Override
public boolean onPreferenceClick(Preference preference) {
String key = preference.getKey() != null ? preference.getKey() : "";
AnalyticsManager.getInstance().sendEvent(AnalyticsManager.CATEGORY_PREFERENCE_CLICK, key, null);
// Categories
int resId = 0;
switch(key) {
case CATEGORY_APPEARANCE:
resId = R.xml.settings_appearance;
break;
case CATEGORY_GENERAL:
resId = R.xml.settings_general;
break;
case CATEGORY_NOTIFICATIONS:
resId = R.xml.settings_notifications;
break;
case CATEGORY_MMS:
resId = R.xml.settings_mms;
break;
case CATEGORY_QUICKREPLY:
resId = R.xml.settings_quickreply;
break;
case CATEGORY_QUICKCOMPOSE:
resId = R.xml.settings_quickcompose;
break;
case CATEGORY_ABOUT:
resId = R.xml.settings_about;
break;
}
if (resId != 0) {
Fragment fragment = SettingsFragment.newInstance(resId);
getFragmentManager().beginTransaction().addToBackStack(null).replace(R.id.content_frame, fragment, CATEGORY_TAG).commit();
}
switch(key) {
case THEME:
ThemeManager.showColorPickerDialog(mContext);
break;
case ICON:
ThemeManager.setIcon(mContext);
break;
case BUBBLES:
new BubblePreferenceDialog().setContext(mContext).show();
break;
case BLOCKED_FUTURE:
BlockedNumberDialog.showDialog(mContext);
break;
case SHOULD_I_ANSWER:
final String packageName = "org.mistergroup.muzutozvednout";
if (!PackageUtils.isAppInstalled(mContext, packageName)) {
String referrer = "referrer=utm_source%3Dqksms%26utm_medium%3Dapp%26utm_campaign%3Dqksmssettings";
new QKDialog().setContext(mContext).setTitle(R.string.dialog_should_i_answer_title).setMessage(R.string.dialog_should_i_answer_message).setNegativeButton(R.string.cancel, null).setPositiveButton(R.string.okay, v -> {
try {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + packageName + "&" + referrer)));
} catch (android.content.ActivityNotFoundException anfe) {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + packageName + "&" + referrer)));
}
}).show();
new Handler().postDelayed(() -> {
mPrefs.edit().putBoolean(SHOULD_I_ANSWER, false).commit();
((CheckBoxPreference) preference).setChecked(false);
}, 500);
}
break;
case NOTIFICATION_LED_COLOR:
mLedColorPickerDialog.show(getActivity().getFragmentManager(), "colorpicker");
break;
case DAY_START:
case NIGHT_START:
TimePickerFragment fragment = new TimePickerFragment();
fragment.setPreference(preference);
fragment.setOnPreferenceChangeListener(this);
fragment.show(getFragmentManager(), "timepicker");
break;
case QK_RESPONSES:
showQkResponseEditor();
break;
case AUTOMATICALLY_CONFIGURE_MMS:
// Show the MMS setup dialogs. See the MMSSetupDialog class for info about what the
// arguments mean.
MMSSetupFragment f = new MMSSetupFragment();
Bundle args = new Bundle();
args.putBoolean(MMSSetupFragment.ARG_ASK_FIRST, false);
args.putString(MMSSetupFragment.ARG_DONT_ASK_AGAIN_PREF, null);
f.setArguments(args);
getFragmentManager().beginTransaction().add(f, MMSSetupFragment.TAG).commit();
break;
case MMS_CONTACT_SUPPORT:
// Opens an email compose intent with MMS debugging information
MMSSetupFragment.contactSupport(getActivity());
break;
case CHANGELOG:
DialogHelper.showChangelog(mContext);
break;
case THANKS:
new QKDialog().setContext(mContext).setTitle(R.string.pref_about_thanks_title).setTripleLineItems(R.array.contributor_names, R.array.contributor_githubs, R.array.contributor_projects, new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
String baseUrl = ((QKTextView) view.findViewById(R.id.list_item_subtitle)).getText().toString();
startBrowserIntent("https://" + baseUrl);
}
}).show();
break;
case DONATE:
DonationManager.getInstance(mContext).showDonateDialog();
break;
case GOOGLE_PLUS:
startBrowserIntent(GOOGLE_PLUS_URL);
break;
case GITHUB:
startBrowserIntent(GITHUB_URL);
break;
case CROWDIN:
startBrowserIntent(CROWDIN_URL);
break;
}
return false;
}
Aggregations