Example usage for android.preference ListPreference getEntry

List of usage examples for android.preference ListPreference getEntry

Introduction

In this page you can find the example usage for android.preference ListPreference getEntry.

Prototype

public CharSequence getEntry() 

Source Link

Document

Returns the entry corresponding to the current value.

Usage

From source file:com.battlelancer.seriesguide.ui.SeriesGuidePreferences.java

public static void setListPreferenceSummary(ListPreference listPref) {
    // Set summary to be the user-description for the selected value
    listPref.setSummary(listPref.getEntry().toString().replaceAll("%", "%%"));
}

From source file:com.battlelancer.seriesguide.ui.SeriesGuidePreferences.java

protected static void setupAdvancedSettings(final Context context, Preference upcomingPref,
        Preference offsetPref, Preference analyticsPref, Preference clearCachePref) {

    // Clear image cache
    clearCachePref.setOnPreferenceClickListener(new OnPreferenceClickListener() {

        public boolean onPreferenceClick(Preference preference) {
            fireTrackerEvent(context, "Clear Image Cache");

            // try to open app info where user can clear app cache folders
            Intent intent = new Intent(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
            intent.setData(Uri.parse("package:" + context.getPackageName()));
            try {
                context.startActivity(intent);
            } catch (ActivityNotFoundException e) {
                // open all apps view
                intent = new Intent(android.provider.Settings.ACTION_MANAGE_APPLICATIONS_SETTINGS);
                context.startActivity(intent);
            }/*from w  w w  .  ja v  a  2 s .  co m*/

            return true;
        }
    });

    // GA opt-out
    analyticsPref.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
        @Override
        public boolean onPreferenceChange(Preference preference, Object newValue) {
            if (preference.getKey().equals(AppSettings.KEY_GOOGLEANALYTICS)) {
                boolean isEnabled = (Boolean) newValue;
                GoogleAnalytics.getInstance(context).setAppOptOut(isEnabled);
                return true;
            }
            return false;
        }
    });

    // show currently set values for list prefs
    setListPreferenceSummary((ListPreference) upcomingPref);
    ListPreference offsetListPref = (ListPreference) offsetPref;
    offsetListPref.setSummary(context.getString(R.string.pref_offsetsummary, offsetListPref.getEntry()));
}

From source file:com.example.domiter.fileexplorer.fragment.PreferenceFragment.java

private void changeListPreferenceSummaryToCurrentValue(ListPreference listPref) {
    listPref.setSummary(listPref.getEntry());
}

From source file:com.arcao.menza.fragment.SettingsFragment.java

protected void updateListPreferenceSummary(String key) {
    ListPreference p = findPreference(key);
    p.setSummary(p.getEntry());
}

From source file:bander.notepad.PrefsFragment.java

private void setTextSizeSummary(ListPreference preference) {
    preference.setSummary(getString(R.string.pref_textSizeSummary, preference.getEntry()));
}

From source file:bander.notepad.PrefsFragment.java

private void setSortOrderSummary(ListPreference preference) {
    preference.setSummary(getString(R.string.pref_sortOrderSummary, preference.getEntry()));
}

From source file:cc.redpen.ui.fragment.SettingsFragment.java

private void setUpLayout() {
    ListPreference languagePref = getPreference(this, getString(R.string.label_setting_language));
    languagePref.setSummary(languagePref.getEntry());
    PreferenceScreen aboutScreen = getPreference(this, getString(R.string.label_setting_about));
    aboutScreen.setOnPreferenceClickListener(this);
    PreferenceScreen feedbackScreen = getPreference(this, getString(R.string.label_setting_feedback));
    feedbackScreen.setOnPreferenceClickListener(this);
    PreferenceScreen licenceScreen = getPreference(this, getString(R.string.label_setting_licence));
    licenceScreen.setOnPreferenceClickListener(this);
    PreferenceScreen versionScreen = getPreference(this, getString(R.string.label_setting_version));
    versionScreen.setSummary(MetaDataUtil.getVersionName(getContext()));
}

From source file:it.gulch.linuxday.android.fragments.SettingsFragment.java

private void updateNotificationsDelaySummary() {
    ListPreference notificationsDelayPreference = (ListPreference) findPreference(KEY_PREF_NOTIFICATIONS_DELAY);
    notificationsDelayPreference.setSummary(notificationsDelayPreference.getEntry());
}

From source file:org.xbmc.kore.ui.SettingsFragment.java

/**
 * Sets up the preferences state and summaries
 *///from w  w w .  jav a  2 s. co m
private void setupPreferences() {
    // Theme preferences
    ListPreference themePref = (ListPreference) findPreference(Settings.KEY_PREF_THEME);
    themePref.setSummary(themePref.getEntry());

    // About preference
    String nameAndVersion = getActivity().getString(R.string.app_name);
    try {
        nameAndVersion += " " + getActivity().getPackageManager().getPackageInfo(getActivity().getPackageName(),
                0).versionName;
    } catch (PackageManager.NameNotFoundException exc) {
    }
    Preference aboutPreference = findPreference(Settings.KEY_PREF_ABOUT);
    aboutPreference.setSummary(nameAndVersion);
    aboutPreference.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
        @Override
        public boolean onPreferenceClick(Preference preference) {
            AboutDialogFragment aboutDialog = new AboutDialogFragment();
            aboutDialog.show(getActivity().getFragmentManager(), null);
            return true;
        }
    });
}

From source file:monakhv.android.samlib.SamlibPreferencesActivity.java

private void updateSummary(String key) {
    if (autoSumKeys.contains(key)) {
        Preference pr = getPreferenceScreen().findPreference(key);
        if (pr instanceof ListPreference) {
            final ListPreference currentPreference = (ListPreference) pr;
            currentPreference.setSummary(currentPreference.getEntry());
        } else if (pr instanceof EditTextPreference) {
            final EditTextPreference currentPreference = (EditTextPreference) pr;
            currentPreference.setSummary(currentPreference.getText());
        }/*  w w  w.  j  a  va  2 s .  c o m*/
    }
}