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


Java Preference.getExtras方法代碼示例

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


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

示例1: resetList

import android.preference.Preference; //導入方法依賴的package包/類
private void resetList() {
    getPreferenceScreen().removeAll();
    addPreferencesFromResource(R.xml.usb_chooser_preferences);

    if (mPermissionsByObject.isEmpty() && mSearch.isEmpty() && mEmptyView != null) {
        mEmptyView.setText(R.string.website_settings_usb_no_devices);
    }

    for (Pair<ArrayList<UsbInfo>, ArrayList<Website>> entry : mPermissionsByObject.values()) {
        Preference preference = new Preference(getActivity());
        Bundle extras = preference.getExtras();
        extras.putInt(UsbDevicePreferences.EXTRA_CATEGORY, mCategory.toContentSettingsType());
        extras.putString(
                SingleCategoryPreferences.EXTRA_TITLE, getActivity().getTitle().toString());
        extras.putSerializable(UsbDevicePreferences.EXTRA_USB_INFOS, entry.first);
        extras.putSerializable(UsbDevicePreferences.EXTRA_SITES, entry.second);
        preference.setIcon(R.drawable.settings_usb);
        preference.setTitle(entry.first.get(0).getName());
        preference.setFragment(UsbDevicePreferences.class.getCanonicalName());
        getPreferenceScreen().addPreference(preference);
    }
}
 
開發者ID:rkshuai,項目名稱:chromium-for-android-56-debug-video,代碼行數:23,代碼來源:UsbChooserPreferences.java

示例2: rebuildProfileList

import android.preference.Preference; //導入方法依賴的package包/類
private void rebuildProfileList() {
    // Add an edit preference for each current Chrome profile.
    PreferenceGroup profileCategory = (PreferenceGroup) findPreference(PREF_AUTOFILL_PROFILES);
    profileCategory.removeAll();
    for (AutofillProfile profile : PersonalDataManager.getInstance().getProfilesForSettings()) {
        // Add an item on the current page...
        Preference pref = new Preference(getActivity());
        pref.setTitle(profile.getFullName());
        pref.setSummary(profile.getLabel());

        if (profile.getIsLocal()) {
            pref.setFragment(AutofillProfileEditor.class.getName());
        } else {
            pref.setWidgetLayoutResource(R.layout.autofill_server_data_label);
            pref.setFragment(AutofillServerProfilePreferences.class.getName());
        }

        Bundle args = pref.getExtras();
        args.putString(AUTOFILL_GUID, profile.getGUID());
        profileCategory.addPreference(pref);
    }
}
 
開發者ID:rkshuai,項目名稱:chromium-for-android-56-debug-video,代碼行數:23,代碼來源:AutofillPreferences.java

示例3: rebuildCreditCardList

import android.preference.Preference; //導入方法依賴的package包/類
private void rebuildCreditCardList() {
    PreferenceGroup profileCategory =
            (PreferenceGroup) findPreference(PREF_AUTOFILL_CREDIT_CARDS);
    profileCategory.removeAll();
    for (CreditCard card : PersonalDataManager.getInstance().getCreditCardsForSettings()) {
        // Add an item on the current page...
        Preference pref = new Preference(getActivity());
        pref.setTitle(card.getObfuscatedNumber());
        pref.setSummary(card.getFormattedExpirationDate(getActivity()));

        if (card.getIsLocal()) {
            pref.setFragment(AutofillLocalCardEditor.class.getName());
        } else {
            pref.setFragment(AutofillServerCardEditor.class.getName());
            pref.setWidgetLayoutResource(R.layout.autofill_server_data_label);
        }

        Bundle args = pref.getExtras();
        args.putString(AUTOFILL_GUID, card.getGUID());
        profileCategory.addPreference(pref);
    }
}
 
開發者ID:rkshuai,項目名稱:chromium-for-android-56-debug-video,代碼行數:23,代碼來源:AutofillPreferences.java

示例4: onSharedPreferenceChanged

import android.preference.Preference; //導入方法依賴的package包/類
/**
 * Handles what to do when a preference is altered
 *
 * @param sharedPreferences to observe
 * @param key               of the pref that was altered
 */
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
    final Preference preference = findPreference(key);

    if (preference != null) {
        final Bundle extras = preference.getExtras();

        if (preference instanceof ListPreference) {
            final String name = extras.getString("icons");

            if (name != null) {
                final String value = sharedPreferences.getString(key, null);
                final int id = getResources()
                        .getIdentifier(name, "array", getActivity().getPackageName());

                final TypedArray icons = getResources().obtainTypedArray(id);
                final CharSequence[] entryValues
                        = ((ListPreference) preference).getEntryValues();

                for (int x = 0; x < entryValues.length; x++) {
                    if (value != null && value.equals(entryValues[x])) {
                        setStyleIcon(preference, getResources()
                                .getDrawable(icons.getResourceId(x, 0)));
                    }
                }
                icons.recycle();
            }
        } else if (preference.getSummary() != null && preference.getSummary().equals("%s")) {
            setSummary(key);
        }
    }
}
 
開發者ID:Nxt3,項目名稱:IO_Classic_WatchFace,代碼行數:39,代碼來源:SettingsFragment.java

示例5: setSummary

import android.preference.Preference; //導入方法依賴的package包/類
/**
 * Handles setting the summary after an new selection has been made
 *
 * @param key of the setting to update its summary for
 */
private void setSummary(String key) {
    final Preference preference = findPreference(key);

    if (preference != null) {
        Bundle extras = preference.getExtras();

        final String defaultValue = extras.getString("default");

        final String value = PreferenceManager
                .getDefaultSharedPreferences(mContext).getString(key, defaultValue);

        preference.setSummary(value);
    }
}
 
開發者ID:Nxt3,項目名稱:IO_Classic_WatchFace,代碼行數:20,代碼來源:SettingsFragment.java

示例6: setPreferenceScreenType

import android.preference.Preference; //導入方法依賴的package包/類
private void setPreferenceScreenType(Class<?> classObj, String key, int type) {
    Preference pf = findPreference(key);
    pf.setFragment(classObj.getCanonicalName());
    Bundle b = pf.getExtras();
    b.putInt(PrefsLogic.EXTRA_PREFERENCE_TYPE, type);
}
 
開發者ID:treasure-lau,項目名稱:CSipSimple,代碼行數:7,代碼來源:PrefsLoaderFragment.java


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