Example usage for android.preference ListPreference setSummary

List of usage examples for android.preference ListPreference setSummary

Introduction

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

Prototype

@Override
public void setSummary(CharSequence summary) 

Source Link

Document

Sets the summary for this Preference with a CharSequence.

Usage

From source file:Main.java

public static void PopulateFSList(Preference preference, String[] List, String filesystem) {
    PopulateList(preference, List);
    ListPreference PrefList = (ListPreference) preference;
    if (filesystem != null) {
        String currentfs = GetCurrentFileSystem(filesystem);
        PrefList.setSummary("current filesystem: " + currentfs);
        PrefList.setValue(currentfs);/*from ww w  . j  ava 2  s  .c o  m*/
    } else {
        PrefList.setValue("");
    }
}

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);
            }//  w w  w. j av a2 s. c om

            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.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:bander.notepad.PrefsFragment.java

private void setSortOrderSummary(ListPreference preference) {
    preference.setSummary(getString(R.string.pref_sortOrderSummary, preference.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: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: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
 *//* www . ja  v a 2s . com*/
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;
        }
    });
}