當前位置: 首頁>>代碼示例>>Java>>正文


Java ListPreference.setSummary方法代碼示例

本文整理匯總了Java中android.support.v7.preference.ListPreference.setSummary方法的典型用法代碼示例。如果您正苦於以下問題:Java ListPreference.setSummary方法的具體用法?Java ListPreference.setSummary怎麽用?Java ListPreference.setSummary使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.support.v7.preference.ListPreference的用法示例。


在下文中一共展示了ListPreference.setSummary方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: updateGridRecyclerLayoutSummary

import android.support.v7.preference.ListPreference; //導入方法依賴的package包/類
private void updateGridRecyclerLayoutSummary() {
  final ListPreference listPreference =
      (ListPreference) findPreference(Const.RECYCLER_LAYOUT_KEY);
  // We have to enable the Grid settings only if the selection is the related on
  final ListPreference gridPreference =
      (ListPreference) findPreference(Const.GRID_SPAN_COUNT_KEY);
  final String value = listPreference.getValue();
  final boolean gridGroupVisible = Const.GRID_RECYCLER_VIEW_LAYOUT_VALUE.equals(value);
  // We update summary
  if (gridGroupVisible) {
    final String spanCountValue = gridPreference.getValue();
    gridPreference.setSummary(
        getString(R.string.label_grid_recycler_span_count_summary, spanCountValue));
  }
  gridPreference.setVisible(gridGroupVisible);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:17,代碼來源:SettingsFragment.java

示例2: initializeTheme

import android.support.v7.preference.ListPreference; //導入方法依賴的package包/類
public static void initializeTheme(
        final Activity activity,
        final ListPreference theme)
{
    if (null != theme) {
        theme.setSummary(theme.getEntry());

        theme.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener()
        {
            @Override
            public boolean onPreferenceChange(
                    Preference preference,
                    Object newValue)
            {
                activity.startActivity(activity.getIntent());
                activity.finish();
                return true;
            }
        });
    }
}
 
開發者ID:nextgis,項目名稱:android_nextgis_mobile,代碼行數:22,代碼來源:SettingsFragment.java

示例3: setPreferenceSummary

import android.support.v7.preference.ListPreference; //導入方法依賴的package包/類
/**
 * Updates the summary for the preference
 *
 * @param preference The preference to be updated
 * @param value      The value that the preference was updated to
 */
private void setPreferenceSummary(Preference preference, String value) {
    if (preference instanceof ListPreference) {
        // For list preferences, figure out the label of the selected value
        ListPreference listPreference = (ListPreference) preference;
        int prefIndex = listPreference.findIndexOfValue(value);
        if (prefIndex >= 0) {
            // Set the summary to that label
            listPreference.setSummary(listPreference.getEntries()[prefIndex]);
        }
    } else if (preference instanceof EditTextPreference) {
        if (preference.getKey().equals(getString(R.string.pref_radius_key))) {
            preference.setSummary(value + "m");
        } else {
            // For EditTextPreferences, set the summary to the value's simple string representation.
            preference.setSummary(value);
        }
    }
}
 
開發者ID:Jugendhackt,項目名稱:Camera-warner,代碼行數:25,代碼來源:SettingsFragment.java

示例4: initializeShowStatusPanel

import android.support.v7.preference.ListPreference; //導入方法依賴的package包/類
public static void initializeShowStatusPanel(final ListPreference listPreference)
{
    listPreference.setSummary(listPreference.getEntry());

    listPreference.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener()
    {
        @Override
        public boolean onPreferenceChange(
                Preference preference,
                Object newValue)
        {
            preference.setSummary(listPreference.getEntries()[listPreference.findIndexOfValue(
                    (String) newValue)]);

            return true;
        }
    });
}
 
開發者ID:nextgis,項目名稱:android_gisapp,代碼行數:19,代碼來源:SettingsFragment.java

示例5: initializeShowCurrentLocation

import android.support.v7.preference.ListPreference; //導入方法依賴的package包/類
public static void initializeShowCurrentLocation(
        final ListPreference listPreference)
{
    listPreference.setSummary(listPreference.getEntry());

    listPreference.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener()
    {
        @Override
        public boolean onPreferenceChange(
                Preference preference,
                Object newValue)
        {
            preference.setSummary(listPreference.getEntries()[listPreference.findIndexOfValue(
                    (String) newValue)]);

            return true;
        }
    });
}
 
開發者ID:nextgis,項目名稱:android_gisapp,代碼行數:20,代碼來源:SettingsFragment.java

示例6: initializeMapBG

import android.support.v7.preference.ListPreference; //導入方法依賴的package包/類
public static void initializeMapBG(final ListPreference mapBG)
{
    mapBG.setSummary(mapBG.getEntry());

    mapBG.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener()
    {
        @Override
        public boolean onPreferenceChange(
                Preference preference,
                Object newValue)
        {
            preference.setSummary(
                    mapBG.getEntries()[mapBG.findIndexOfValue((String) newValue)]);
            return true;
        }
    });
}
 
開發者ID:nextgis,項目名稱:android_gisapp,代碼行數:18,代碼來源:SettingsFragment.java

示例7: updateListPreference

import android.support.v7.preference.ListPreference; //導入方法依賴的package包/類
private static void updateListPreference(
    Resources resources,
    ListPreference preference,
    int arrayValuesId) {
  final int valueIndex = preference.findIndexOfValue(preference.getValue());
  final String summary = resources.getStringArray(arrayValuesId)[valueIndex];
  preference.setSummary(summary);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:9,代碼來源:SettingsFragment.java

示例8: setPreferenceSummary

import android.support.v7.preference.ListPreference; //導入方法依賴的package包/類
private void setPreferenceSummary(Preference preference, String value) {
    if (preference instanceof ListPreference) {
        ListPreference listPreference = (ListPreference) preference;
        int index = listPreference.findIndexOfValue(value);
        if (index >= 0) {
            listPreference.setSummary(listPreference.getEntries()[index]);
        }
    }


}
 
開發者ID:RobIsr,項目名稱:OneMoreRepFitness,代碼行數:12,代碼來源:SettingsFragment.java

示例9: setPreferenceSummary

import android.support.v7.preference.ListPreference; //導入方法依賴的package包/類
private void setPreferenceSummary(android.support.v7.preference.Preference preference, String value) {
    if (preference instanceof ListPreference) {
        // For list preferences, figure out the label of the selected value
        ListPreference listPreference = (ListPreference) preference;
        int prefIndex = listPreference.findIndexOfValue(value);
        if (prefIndex >= 0) {
            // Set the summary to that label
            listPreference.setSummary(listPreference.getEntries()[prefIndex]);
        }
    } else if (preference instanceof EditTextPreference) {
        // For EditTextPreferences, set the summary to the value's simple string representation.
        preference.setSummary(value);
    }
}
 
開發者ID:Existentio,項目名稱:OddLauncher,代碼行數:15,代碼來源:SettingsFragment.java

示例10: setPreferenceSummary

import android.support.v7.preference.ListPreference; //導入方法依賴的package包/類
/**
 * Updates the summary for the preference
 *
 * @param preference The preference to be updated
 * @param value      The value that the preference was updated to
 */
private void setPreferenceSummary(Preference preference, String value) {
    if (preference instanceof ListPreference) {
        // For list preferences, figure out the label of the selected value
        ListPreference listPreference = (ListPreference) preference;
        int prefIndex = listPreference.findIndexOfValue(value);
        if (prefIndex >= 0) {
            // Set the summary to that label
            listPreference.setSummary(listPreference.getEntries()[prefIndex]);
        }
    } else if (preference instanceof EditTextPreference) {
        // For EditTextPreferences, set the summary to the value's simple string representation.
        preference.setSummary(value);
    }
}
 
開發者ID:fjoglar,項目名稱:android-dev-challenge,代碼行數:21,代碼來源:SettingsFragment.java

示例11: setPreferenceSummary

import android.support.v7.preference.ListPreference; //導入方法依賴的package包/類
/**
 * Updates the summary for the preference
 *
 * @param preference The preference to be updated
 * @param value      The value that the preference was updated to
 */
private void setPreferenceSummary(Preference preference, String value) {
    // COMPLETED (3) Don't forget to add code here to properly set the summary for an EditTextPreference
    if (preference instanceof ListPreference) {
        // For list preferences, figure out the label of the selected value
        ListPreference listPreference = (ListPreference) preference;
        int prefIndex = listPreference.findIndexOfValue(value);
        if (prefIndex >= 0) {
            // Set the summary to that label
            listPreference.setSummary(listPreference.getEntries()[prefIndex]);
        }
    } else if (preference instanceof EditTextPreference) {
        preference.setSummary(value);
    }
}
 
開發者ID:fjoglar,項目名稱:android-dev-challenge,代碼行數:21,代碼來源:SettingsFragment.java

示例12: setPreferenceSummary

import android.support.v7.preference.ListPreference; //導入方法依賴的package包/類
private void setPreferenceSummary(Preference preference, String value) {
    if (preference instanceof ListPreference) {
        ListPreference listPreference = (ListPreference) preference;
        int prefIndex = listPreference.findIndexOfValue(value);

        if (prefIndex >= 0) {
            listPreference.setSummary(listPreference.getEntries()[prefIndex]);
        }
    }
}
 
開發者ID:fjoglar,項目名稱:android-dev-challenge,代碼行數:11,代碼來源:SettingsFragment.java

示例13: onCreatePreferencesFix

import android.support.v7.preference.ListPreference; //導入方法依賴的package包/類
@Override
public void onCreatePreferencesFix(Bundle savedInstanceState, String rootKey) {
	setPreferencesFromResource(R.xml.widget_preference, rootKey);

	ListPreference dotSize = (ListPreference) findPreference("dot_size");
	dotSize.setSummary(dotSize.getEntry());

	Preference about = findPreference("about");
	about.setOnPreferenceClickListener(extrasPreferenceClickListener);

	Preference help = findPreference("help");
	help.setOnPreferenceClickListener(extrasPreferenceClickListener);
}
 
開發者ID:ashutoshgngwr,項目名稱:10-bitClockWidget,代碼行數:14,代碼來源:ClockWidgetPreferenceFragment.java

示例14: loadSummaries

import android.support.v7.preference.ListPreference; //導入方法依賴的package包/類
private void loadSummaries(String key) {
    ListPreference preference = (ListPreference) findPreference("THEME");
    preference.setSummary(preference.getEntry());

    if (ObjectsCompat.equals(key, "THEME")) {
        getActivity().recreate();
    }
}
 
開發者ID:jumaallan,項目名稱:AndelaTrackChallenge,代碼行數:9,代碼來源:SettingsFragment.java

示例15: initThemePref

import android.support.v7.preference.ListPreference; //導入方法依賴的package包/類
private void initThemePref(String theme) {
    ListPreference themePref = (ListPreference)
            findPreference(getString(R.string.pref_key_theme));

    String theme_name = Settings.Utils.getThemeName(getActivity(), theme);
    themePref.setSummary(theme_name);
    themePref.setOnPreferenceChangeListener(this);
}
 
開發者ID:kollerlukas,項目名稱:Camera-Roll-Android-App,代碼行數:9,代碼來源:SettingsActivity.java


注:本文中的android.support.v7.preference.ListPreference.setSummary方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。