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


Java Preference.setSummary方法代碼示例

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


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

示例1: setPreferenceSummary

import android.support.v7.preference.Preference; //導入方法依賴的package包/類
private void setPreferenceSummary(Preference preference, Object value) {
    String stringValue = value.toString();

    if (preference instanceof ListPreference) {
        // For list preferences, look up the correct display value in
        // the preference's 'entries' list (since they have separate labels/values).
        ListPreference listPreference = (ListPreference) preference;
        int prefIndex = listPreference.findIndexOfValue(stringValue);
        if (prefIndex >= 0) {
            preference.setSummary(listPreference.getEntries()[prefIndex]);
        }
    } else {
        // For other preferences, set the summary to the value's simple string representation.
        preference.setSummary(stringValue);
    }
}
 
開發者ID:fjoglar,項目名稱:android-dev-challenge,代碼行數:17,代碼來源:SettingsFragment.java

示例2: setPreferenceSummary

import android.support.v7.preference.Preference; //導入方法依賴的package包/類
private void setPreferenceSummary(Preference preference, Object value) {
    String stringValue = value.toString();
    String key = preference.getKey();

    if (preference instanceof ListPreference) {
        /* For list preferences, look up the correct display value in */
        /* the preference's 'entries' list (since they have separate labels/values). */
        ListPreference listPreference = (ListPreference) preference;
        int prefIndex = listPreference.findIndexOfValue(stringValue);
        if (prefIndex >= 0) {
            preference.setSummary(listPreference.getEntries()[prefIndex]);
        }
    } else {
        // For other preferences, set the summary to the value's simple string representation.
        preference.setSummary(stringValue);
    }
}
 
開發者ID:fjoglar,項目名稱:android-dev-challenge,代碼行數:18,代碼來源:SettingsFragment.java

示例3: setPreferenceSummary

import android.support.v7.preference.Preference; //導入方法依賴的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: updateDownloadSummary

import android.support.v7.preference.Preference; //導入方法依賴的package包/類
private void updateDownloadSummary(Preference update) {
    update.setSummary(getString(R.string.settings_update_summary));
    String date = StorageUtils.getStringPref(getActivity(), getString(R.string.license_last_updated_key));
    if (!date.equals("")) {
        update.setSummary(update.getSummary()+" "+getString(R.string.settings_update_summary_extra)+" "+date);
    }
}
 
開發者ID:mDL-ILP,項目名稱:mDL-ILP,代碼行數:8,代碼來源:SettingsFragment.java

示例5: onViewCreated

import android.support.v7.preference.Preference; //導入方法依賴的package包/類
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState)
{
    super.onViewCreated(view, savedInstanceState);
    app = (App) getContext().getApplicationContext();
    setYearAdapters();
    view.setBackgroundColor(Color.parseColor("#FFFFFF"));
    Preference preference = findPreference("preference_logout");
    preference.setOnPreferenceClickListener(onLogout);
    Preference year = findPreference("preference_staticyear");
    year.setOnPreferenceClickListener(onStaticYear);
    Preference test = findPreference("preference_notification");
    test.setOnPreferenceClickListener(onNotificationsOpen);
    Preference about = findPreference("preference_about");
    about.setOnPreferenceClickListener(onAbout);
    Preference shortcut = findPreference("preference_shortcut");
    shortcut.setOnPreferenceClickListener(onTheme);
    Preference shortcut1 = findPreference("preference_webmail");
    shortcut1.setOnPreferenceClickListener(onTheme1);
    Preference tys = findPreference("preference_tys");
    tys.setOnPreferenceClickListener(onTySRequest);

    String type = "release";
    if (AppManager.isDebug())
        type = "debug";

    Preference version = findPreference("preference_version");
    version.setTitle("ConnectU App version " + AppManager.getAppVersion(getContext()));
    version.setSummary("You are on " + type + " mode");
}
 
開發者ID:Onelio,項目名稱:ConnectU,代碼行數:31,代碼來源:PreferenceMenuFragment.java

示例6: onPreferenceChange

import android.support.v7.preference.Preference; //導入方法依賴的package包/類
@Override
public boolean onPreferenceChange(Preference preference, Object o) {
    Log.d("SettingsActivity", "onPreferenceChange() called with: preference = [" + preference + "], o = [" + o + "]");
    if (callback != null) {
        callback.onSettingChanged();
    }

    Settings settings = Settings.getInstance(getActivity());
    if (preference.getKey().equals(getString(R.string.pref_key_theme))) {
        String themeValue = (String) o;
        settings.setTheme(themeValue);

        String theme_name = Settings.Utils.getThemeName(getActivity(), themeValue);
        preference.setSummary(theme_name);

        //update Activities
        getActivity().recreate();
    } else if (preference.getKey().equals(getString(R.string.pref_key_style))) {
        settings.setStyle((int) o);
        String style_name = Settings.Utils.getStyleName(getActivity(), (int) o);
        preference.setSummary(style_name);

    } else if (preference.getKey().equals(getString(R.string.pref_key_column_count))) {
        settings.setColumnCount((int) o);
        preference.setSummary(String.valueOf(o));
    } else if (preference.getKey().equals(getString(R.string.pref_key_media_retriever))) {
        settings.useStorageRetriever((boolean) o);
    } else if (preference.getKey().equals(getString(R.string.pref_key_8_bit_color))) {
        settings.use8BitColor((boolean) o);
    } else if (preference.getKey().equals(getString(R.string.pref_key_camera_shortcut))) {
        settings.setCameraShortcut((boolean) o);
    }
    return true;
}
 
開發者ID:kollerlukas,項目名稱:Camera-Roll-Android-App,代碼行數:35,代碼來源:SettingsActivity.java

示例7: onUserGet

import android.support.v7.preference.Preference; //導入方法依賴的package包/類
@Override
public void onUserGet(TraktGson.TraktUser user, Drawable icon) {
    Preference pref = findPreference(getString(R.string.pref_key_login));
    if(pref != null && user != null) {
        pref.setTitle("Logged in as: " + user.username);
        pref.setSummary("Click for re-outh");
        if(icon != null) {
            pref.setIcon(icon);
        }

    }
}
 
開發者ID:ad-on-is,項目名稱:chilly,代碼行數:13,代碼來源:SettingsFragment.java

示例8: setPreferenceSummary

import android.support.v7.preference.Preference; //導入方法依賴的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

示例9: setPreferenceSummary

import android.support.v7.preference.Preference; //導入方法依賴的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


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