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


Java CheckBoxPreference.setSummary方法代碼示例

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


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

示例1: addCheckBox

import android.preference.CheckBoxPreference; //導入方法依賴的package包/類
private CheckBoxPreference addCheckBox(String title, PreferenceCategory category, String key, Drawable icon, String onText, String offText, boolean defaultValue, Context context) {
    CheckBoxPreference c = new CheckBoxPreference(context);
    c.setTitle(title);
    c.setKey(key);
    if (null != icon) c.setIcon(icon);
    if (offText.equals(null) || onText.equals(null)) {
        if (offText.equals(null)) {
            c.setSummary(onText);
        } else if (onText.equals(null)) {
            c.setSummary(offText);
        }
    } else {
        c.setSummaryOn(onText);
        c.setSummaryOff(offText);
    }
    c.setDefaultValue(defaultValue);
    c.setChecked(KRFAM.sharedPreferences.getBoolean(key, defaultValue));
    category.addPreference(c);
    return c;
}
 
開發者ID:iebb,項目名稱:Kasumi,代碼行數:21,代碼來源:AppPreferences.java

示例2: onCreate

import android.preference.CheckBoxPreference; //導入方法依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    PreferenceScreen screen = getPreferenceManager().createPreferenceScreen(getActivity());

    PreferenceCategory category = new PreferenceCategory(getActivity());
    category.setTitle("Libraries");

    screen.addPreference(category);

    CheckBoxPreference checkBoxPref = new CheckBoxPreference(getActivity());
    checkBoxPref.setTitle("title");
    checkBoxPref.setSummary("summary");
    checkBoxPref.setChecked(true);

    category.addPreference(checkBoxPref);
    setPreferenceScreen(screen);
}
 
開發者ID:mrspaceman,項目名稱:ebookmgr,代碼行數:19,代碼來源:SettingsActivity.java

示例3: createCheckBoxPreference

import android.preference.CheckBoxPreference; //導入方法依賴的package包/類
/**
 * Create a SwitchPreference for the specified preference
 * @param titleResId resource ID to use for the title
 * @param summaryResId resource ID to use for the summary
 * @param key preference key
 * @return newly created preference
 */
private CheckBoxPreference createCheckBoxPreference(@StringRes int titleResId, @StringRes int summaryResId, Settings.Key key) {
    final CheckBoxPreference checkBoxPreference = new CheckBoxPreference(getActivity());
    checkBoxPreference.setDefaultValue(mSettings.getDefault(key));
    checkBoxPreference.setKey(key.name());
    checkBoxPreference.setSummary(summaryResId);
    checkBoxPreference.setTitle(titleResId);
    checkBoxPreference.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
        @Override
        public boolean onPreferenceChange(Preference preference, Object newValue) {
            checkBoxPreference.setChecked((boolean) newValue);
            return true;
        }
    });
    return checkBoxPreference;
}
 
開發者ID:nitroshare,項目名稱:nitroshare-android,代碼行數:23,代碼來源:SettingsActivity.java

示例4: onCreate

import android.preference.CheckBoxPreference; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle icicle) {
    // Get the settings preferences
    SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this);

    Design.updateTheme(this, sp);

	super.onCreate(icicle);
    addPreferencesFromResource(R.xml.language_prefs);
    mSelectedLanguages = sp.getString(KP2AKeyboard.PREF_SELECTED_LANGUAGES, "");
    String[] languageList = mSelectedLanguages.split(",");
    
    //first try to get the unique locales in a strict mode (filtering most redundant layouts like English (Jamaica) etc.)
    mAvailableLanguages = getUniqueLocales(true);
    //sometimes the strict check returns only EN_US, EN_GB and ES_US. Accept more in these cases:
    if (mAvailableLanguages.size() < 5)
    {
    	mAvailableLanguages = getUniqueLocales(false);
    }
    PreferenceGroup parent = getPreferenceScreen();
    for (int i = 0; i < mAvailableLanguages.size(); i++) {
        CheckBoxPreference pref = new CheckBoxPreference(this);
        Locale locale = mAvailableLanguages.get(i).locale;
        pref.setTitle(LanguageSwitcher.toTitleCase(locale.getDisplayName(locale), locale));
        boolean checked = isLocaleIn(locale, languageList);
        pref.setChecked(checked);
        if (hasDictionary(locale, this)) {
            pref.setSummary(R.string.has_dictionary);
        }
        parent.addPreference(pref);
    }
}
 
開發者ID:PhilippC,項目名稱:keepass2android,代碼行數:33,代碼來源:InputLanguageSelection.java

示例5: initializePushMessagingToggle

import android.preference.CheckBoxPreference; //導入方法依賴的package包/類
private void initializePushMessagingToggle() {
  CheckBoxPreference preference = (CheckBoxPreference)this.findPreference(PUSH_MESSAGING_PREF);

  if (TextSecurePreferences.isPushRegistered(getActivity())) {
    preference.setChecked(true);
    preference.setSummary(TextSecurePreferences.getLocalNumber(getActivity()));
  } else {
    preference.setChecked(false);
    preference.setSummary(R.string.preferences__free_private_messages_and_calls);
  }

  preference.setOnPreferenceChangeListener(new PushMessagingClickListener());
}
 
開發者ID:XecureIT,項目名稱:PeSanKita-android,代碼行數:14,代碼來源:AdvancedPreferenceFragment.java

示例6: onSharedPreferenceChanged

import android.preference.CheckBoxPreference; //導入方法依賴的package包/類
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
	// update summary
	if (PREF_DISABLE_MMS.equals(key)) {
		CheckBoxPreference pref = (CheckBoxPreference) findPreference(PREF_DISABLE_MMS);
		pref.setSummary(pref.isChecked() ? R.string.pref_disable_mms_descr_disabled : R.string.pref_disable_mms_descr_enabled);
	}
}
 
開發者ID:sdrausty,項目名稱:buildAPKsApps,代碼行數:8,代碼來源:MobileDataApnPrefs.java

示例7: onCreate

import android.preference.CheckBoxPreference; //導入方法依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    mPrefs = SharedPreferencesUtils.getSharedPreferences(getPreferenceManager(), "ledcontrol");
    addPreferencesFromResource(R.xml.led_control_active_screen_settings);

    mPrefPocketMode = (CheckBoxPreference) findPreference(
            LedSettings.PREF_KEY_ACTIVE_SCREEN_POCKET_MODE);

    if (LedSettings.isProximityWakeUpEnabled(getActivity())) {
        mPrefPocketMode.setSummary(R.string.pref_unc_as_pocket_mode_summary_overriden);
        mPrefPocketMode.setEnabled(false);
    }
}
 
開發者ID:WrBug,項目名稱:GravityBox,代碼行數:16,代碼來源:ActiveScreenActivity.java

示例8: onCreate

import android.preference.CheckBoxPreference; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    getDelegate().installViewFactory();
    getDelegate().onCreate(savedInstanceState);
    super.onCreate(savedInstanceState);
    PreferenceScreen screen = getPreferenceManager().createPreferenceScreen(this);
    PreferenceCategory category = new PreferenceCategory(this);
    category.setTitle(R.string.filter_pokemons);
    screen.addPreference(category);
    try {
        JSONArray pokemonList = new JSONArray(Utils.loadJSONFromFile(this, "pokemon.json"));
        for (int i = 0; i < pokemonList.length(); i++){
            JSONObject pokemon = pokemonList.getJSONObject(i);
            CheckBoxPreference checkBox = new CheckBoxPreference(this);
            checkBox.setTitle(pokemon.getString("Name"));
            checkBox.setIcon(new BitmapDrawable(getResources(), Utils.bitmapForPokemon(this, Integer.parseInt(pokemon.getString("Number")))));
            checkBox.setDefaultValue(true);
            checkBox.setSummary(String.format(getString(R.string.setting_filter_pokemon_summary), pokemon.getString("Name")));
            checkBox.setKey("pref_key_show_pokemon_" + Integer.parseInt(pokemon.getString("Number")));
            category.addPreference(checkBox);
        }
    } catch (JSONException e) {
        e.printStackTrace();
    }

    setPreferenceScreen(screen);
}
 
開發者ID:guipenedo,項目名稱:PokeRadar,代碼行數:28,代碼來源:PokemonFilterSettingsActivity.java

示例9: updateDisableSoundCheckBoxSummary

import android.preference.CheckBoxPreference; //導入方法依賴的package包/類
private void updateDisableSoundCheckBoxSummary(boolean notificationPolicyAccessGranted) {
    final CheckBoxPreference disableSoundCheckbox = (CheckBoxPreference)
            findPreference(DISABLE_SOUND_AND_VIBRATION);
    if (notificationPolicyAccessGranted) {
        disableSoundCheckbox.setSummary("");
    } else {
        disableSoundCheckbox.setSummary("Click to grant permission");
    }
}
 
開發者ID:goodtime-productivity,項目名稱:Goodtime,代碼行數:10,代碼來源:SettingsFragment.java

示例10: checkSummary

import android.preference.CheckBoxPreference; //導入方法依賴的package包/類
private void checkSummary(String key, int resId) {
    CheckBoxPreference pref = (CheckBoxPreference) findPreference(key);
    pref.setSummary(resId);
}
 
開發者ID:uhuru-mobile,項目名稱:mobile-store,代碼行數:5,代碼來源:PreferencesFragment.java

示例11: onCreate

import android.preference.CheckBoxPreference; //導入方法依賴的package包/類
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    addPreferencesFromResource(R.xml.app_selector_screen);

    PreferenceCategory preferenceCategory = (PreferenceCategory) findPreference("apps");
    sharedPreferencesPackageNames = getActivity().getSharedPreferences("myPackageNames", MODE_PRIVATE);


    Set<String> all = sharedPreferencesPackageNames.getStringSet(getString(R.string.shared_pref_key_package_name_all), null);
    Set<String> selected = sharedPreferencesPackageNames.getStringSet(getString(R.string.shared_pref_key_package_name_selected), null);

    CheckBoxPreference a = new CheckBoxPreference(getContext());
    a.setKey(getContext().getString(R.string.string_all_key));
    a.setTitle(R.string.string_all_apps);
    if (selected != null){
        if (selected.contains(getContext().getString(R.string.string_all_key))){
            a.setChecked(true);
        }
    }
    a.setOnPreferenceClickListener(this);
    preferenceCategory.addPreference(a);

    if (all != null){
        for(String s: all){
            CheckBoxPreference p = new CheckBoxPreference(getContext());
            p.setKey(s);
            p.setSummary(s);
            p.setEnabled(!a.isChecked());

            if (selected != null){
                if (selected.contains(s)){
                    p.setChecked(true);
                }
            }

            p.setTitle(Utils.getAppName(getContext(), s));
            p.setOnPreferenceClickListener(this);
            preferenceCategory.addPreference(p);
        }
    }

    String title = preferenceCategory.getTitle().toString();

    // all devices with android 8.1 and Pixel 2 (XL) on 8.0 and onward are using "using battery" instead of "running in the background"
    if (Build.VERSION.SDK_INT >= 27 || Build.MODEL.equals("Pixel 2") || Build.MODEL.equals("Pixel 2 XL")){
        title = title.replace("%s", "\"" + getString(R.string.string_app_name_replace_using_battery) + "\"");
    }else{
        title = title.replace("%s", "\"" + getString(R.string.string_app_name_replace_running_in_the_background) + "\"");
    }

    preferenceCategory.setTitle(title);

}
 
開發者ID:iboalali,項目名稱:sysnotifsnooze,代碼行數:55,代碼來源:AppSelectorActivity.java

示例12: initPrefs

import android.preference.CheckBoxPreference; //導入方法依賴的package包/類
private void initPrefs() {
    Preference clearcache = findPreference(SETTINGS_CLEARCACHE);
    Preference clearhistory = findPreference(SETTINGS_CLEARHISTORY);
    Preference clearcookies = findPreference(SETTINGS_CLEARCOOKIES);
    Preference clearwebstorage = findPreference(SETTINGS_CLEARWEBSTORAGE);

    CheckBoxPreference cblocation = (CheckBoxPreference) findPreference(SETTINGS_LOCATION);
    CheckBoxPreference cb3cookies = (CheckBoxPreference) findPreference(SETTINGS_THIRDPCOOKIES);
    CheckBoxPreference cbsavepasswords = (CheckBoxPreference) findPreference(SETTINGS_SAVEPASSWORD);
    CheckBoxPreference cbcacheexit = (CheckBoxPreference) findPreference(SETTINGS_CACHEEXIT);
    CheckBoxPreference cbhistoryexit = (CheckBoxPreference) findPreference(SETTINGS_HISTORYEXIT);
    CheckBoxPreference cbcookiesexit = (CheckBoxPreference) findPreference(SETTINGS_COOKIEEXIT);
    CheckBoxPreference cbwebstorageexit = (CheckBoxPreference) findPreference(SETTINGS_WEBSTORAGEEXIT);
    CheckBoxPreference cbDoNotTrack = (CheckBoxPreference) findPreference(SETTINGS_DONOTTRACK);
    CheckBoxPreference cbIdentifyingHeaders = (CheckBoxPreference) findPreference(SETTINGS_IDENTIFYINGHEADERS);

    clearcache.setOnPreferenceClickListener(this);
    clearhistory.setOnPreferenceClickListener(this);
    clearcookies.setOnPreferenceClickListener(this);
    clearwebstorage.setOnPreferenceClickListener(this);

    cblocation.setOnPreferenceChangeListener(this);
    cb3cookies.setOnPreferenceChangeListener(this);
    cbsavepasswords.setOnPreferenceChangeListener(this);
    cbcacheexit.setOnPreferenceChangeListener(this);
    cbhistoryexit.setOnPreferenceChangeListener(this);
    cbcookiesexit.setOnPreferenceChangeListener(this);
    cbwebstorageexit.setOnPreferenceChangeListener(this);
    cbDoNotTrack.setOnPreferenceChangeListener(this);
    cbIdentifyingHeaders.setOnPreferenceChangeListener(this);

    cblocation.setChecked(mPreferenceManager.getLocationEnabled());
    cbsavepasswords.setChecked(mPreferenceManager.getSavePasswordsEnabled());
    cbcacheexit.setChecked(mPreferenceManager.getClearCacheExit());
    cbhistoryexit.setChecked(mPreferenceManager.getClearHistoryExitEnabled());
    cbcookiesexit.setChecked(mPreferenceManager.getClearCookiesExitEnabled());
    cb3cookies.setChecked(mPreferenceManager.getBlockThirdPartyCookiesEnabled());
    cbwebstorageexit.setChecked(mPreferenceManager.getClearWebStorageExitEnabled());
    cbDoNotTrack.setChecked(mPreferenceManager.getDoNotTrackEnabled() && Utils.doesSupportHeaders());
    cbIdentifyingHeaders.setChecked(mPreferenceManager.getRemoveIdentifyingHeadersEnabled() && Utils.doesSupportHeaders());

    cbDoNotTrack.setEnabled(Utils.doesSupportHeaders());
    cbIdentifyingHeaders.setEnabled(Utils.doesSupportHeaders());

    String identifyingHeadersSummary = LightningView.HEADER_REQUESTED_WITH + ", " + LightningView.HEADER_WAP_PROFILE;
    cbIdentifyingHeaders.setSummary(identifyingHeadersSummary);

    cb3cookies.setEnabled(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP);

}
 
開發者ID:XndroidDev,項目名稱:Xndroid,代碼行數:51,代碼來源:PrivacySettingsFragment.java

示例13: checkSummary

import android.preference.CheckBoxPreference; //導入方法依賴的package包/類
protected void checkSummary(String key, int resId) {
    CheckBoxPreference pref = (CheckBoxPreference) findPreference(key);
    pref.setSummary(resId);
}
 
開發者ID:nutellarlz,項目名稱:AppHub,代碼行數:5,代碼來源:PreferencesFragment.java


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