use of android.preference.Preference in project meatspace-android by RomainPiel.
the class SettingsFragment method onActivityCreated.
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
ListPreference urlPreference = (ListPreference) findPreference(getString(R.string.settings_url_key));
if (urlPreference.getValue() == null) {
urlPreference.setValue(getString(BuildConfig.MEATSPACE_BASE_URL));
}
urlPreference.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
getActivity().sendBroadcast(new Intent(Constants.FILTER_CHAT_CLOSE));
return true;
}
});
}
use of android.preference.Preference in project KeepScore by nolanlawson.
the class SettingsActivity method setUpPreferences.
private void setUpPreferences() {
plusButtonPref = (EditTextPreference) findPreferenceById(R.string.CONSTANT_pref_plus_button);
minusButtonPref = (EditTextPreference) findPreferenceById(R.string.CONSTANT_pref_minus_button);
button1Pref = (EditTextPreference) findPreferenceById(R.string.CONSTANT_pref_button_1);
button2Pref = (EditTextPreference) findPreferenceById(R.string.CONSTANT_pref_button_2);
button3Pref = (EditTextPreference) findPreferenceById(R.string.CONSTANT_pref_button_3);
button4Pref = (EditTextPreference) findPreferenceById(R.string.CONSTANT_pref_button_4);
twoPlayerButton1Pref = (EditTextPreference) findPreferenceById(R.string.CONSTANT_pref_2p_button_1);
twoPlayerButton2Pref = (EditTextPreference) findPreferenceById(R.string.CONSTANT_pref_2p_button_2);
twoPlayerButton3Pref = (EditTextPreference) findPreferenceById(R.string.CONSTANT_pref_2p_button_3);
twoPlayerButton4Pref = (EditTextPreference) findPreferenceById(R.string.CONSTANT_pref_2p_button_4);
greenTextPref = (CheckBoxPreference) findPreferenceById(R.string.CONSTANT_pref_green_text);
showRoundTotalsPref = (CheckBoxPreference) findPreferenceById(R.string.CONSTANT_pref_show_round_totals);
showInitialMessagePref = (CheckBoxPreference) findPreferenceById(R.string.CONSTANT_pref_initial_message);
disableHighlightTagPref = (CheckBoxPreference) findPreferenceById(R.string.CONSTANT_pref_disable_highlight_tag);
showColorsPref = (CheckBoxPreference) findPreferenceById(R.string.CONSTANT_pref_show_colors);
updateDelayPref = (EditTextPreference) findPreferenceById(R.string.CONSTANT_pref_update_delay);
initialScorePref = (EditTextPreference) findPreferenceById(R.string.CONSTANT_pref_initial_score);
resetPref = findPreferenceById(R.string.CONSTANT_pref_reset);
aboutPref = findPreferenceById(R.string.CONSTANT_pref_about);
colorSchemePref = (ListPreference) findPreferenceById(R.string.CONSTANT_pref_color_scheme);
orientationPref = (ListPreference) findPreferenceById(R.string.CONSTANT_pref_orientation);
loadSettingsPref = findPreferenceById(R.string.CONSTANT_pref_load_settings);
saveSettingsPref = findPreferenceById(R.string.CONSTANT_pref_save_settings);
// changed
for (EditTextPreference pref : new EditTextPreference[] { button1Pref, button2Pref, button3Pref, button4Pref, twoPlayerButton1Pref, twoPlayerButton2Pref, twoPlayerButton3Pref, twoPlayerButton4Pref, plusButtonPref, minusButtonPref }) {
setDynamicSummary(pref);
}
// do a special check for the update delay value
updateDelayPref.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
if (!IntegerUtil.validInt(newValue.toString()) || Integer.parseInt(newValue.toString()) < 1 || Integer.parseInt(newValue.toString()) > 600) {
ToastHelper.showLong(SettingsActivity.this, R.string.toast_valid_update_delay_values);
return false;
}
PreferenceHelper.resetCache();
return true;
}
});
// do another special check for the initial score value
initialScorePref.setSummary(initialScorePref.getText());
initialScorePref.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
if (!IntegerUtil.validInt(newValue.toString())) {
ToastHelper.showLong(SettingsActivity.this, R.string.toast_valid_initial_score);
return false;
}
preference.setSummary(newValue.toString());
return true;
}
});
// show the version number in the "about" summary text
String version = String.format(getString(R.string.text_version_number), PackageHelper.getVersionName(this));
aboutPref.setSummary(version);
// do a special popup for the reset preference
resetPref.setOnPreferenceClickListener(this);
loadSettingsPref.setOnPreferenceClickListener(this);
saveSettingsPref.setOnPreferenceClickListener(this);
setDynamicListPreferenceSummary(colorSchemePref);
setDynamicListPreferenceSummary(orientationPref);
// go to the about activity if the about pref is pressed
aboutPref.setOnPreferenceClickListener(this);
greenTextPref.setOnPreferenceChangeListener(this);
showRoundTotalsPref.setOnPreferenceChangeListener(this);
disableHighlightTagPref.setOnPreferenceChangeListener(this);
showInitialMessagePref.setOnPreferenceChangeListener(this);
showColorsPref.setOnPreferenceChangeListener(this);
}
use of android.preference.Preference in project KeepScore by nolanlawson.
the class SettingsActivity method getSettingsToDisplay.
/**
* Grab a map of all settings, using user-friendly display names for the
* settings
*
* @param settingSet
* @return
*/
private Map<String, ?> getSettingsToDisplay(String settingSet) {
Map<String, ?> inputMap = SettingSetHelper.getSettingsSet(this, settingSet);
Map<String, Object> outputMap = new LinkedHashMap<String, Object>();
// works
for (int i = 0; i < getListView().getAdapter().getCount(); i++) {
Object obj = getListView().getAdapter().getItem(i);
if (!(obj instanceof Preference)) {
continue;
}
Preference pref = (Preference) obj;
if (pref instanceof PreferenceCategory || !pref.isPersistent()) {
// 'reset'
continue;
}
Object value = inputMap.get(pref.getKey());
// Android seems to
value = value != null ? value : Boolean.FALSE;
// store false
// booleans as null
outputMap.put(pref.getTitle().toString(), value);
}
return outputMap;
}
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 scdl by passy.
the class DownloadPreferencesDelegateImpl method setupAboutHandlers.
private void setupAboutHandlers() {
final Uri uri = mPackageHelper.getMarketUri();
final Intent rateAppIntent = new Intent(Intent.ACTION_VIEW, uri);
mPreferenceManager.findPreference(ApplicationPreferences.KEY_RATE_APP).setIntent(rateAppIntent);
final Intent aboutIntent = new Intent(mContext, AboutActivity.class);
mPreferenceManager.findPreference(ApplicationPreferences.KEY_ABOUT_ME).setIntent(aboutIntent);
final Intent donateIntent = new Intent(mContext, BuyAdFreeActivity.class);
final Preference donatePreference = mPreferenceManager.findPreference(ApplicationPreferences.KEY_DONATE);
if (Config.Features.NEW_DONATE) {
throw new IllegalStateException("New Donate isn't implemented yet, doh!");
} else {
donatePreference.setIntent(donateIntent);
donatePreference.setTitle(mContext.getString(R.string.remove_ads));
donatePreference.setEnabled(!mAppPreferences.isAdFree());
}
}
Aggregations