Java ListPreference.setSummary方法代码示例(javalistpreference.setsummary典型用法代码示例汇总)

本文整理汇总了Java中android.preference.ListPreference.setSummary方法的典型用法代码示例。如果您正苦于以下问题:Java ListPreference.setSummary方法的具体用法?Java ListPreference.setSummary怎么用?Java ListPreference.setSummary使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.preference.ListPreference的用法示例。


Java ListPreference.setSummary方法代码示例(javalistpreference.setsummary典型用法代码示例汇总)

在下文中一共展示了ListPreference.setSummary方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: initializePreferredVideoFpsPreferences

import android.preference.ListPreference; //导入方法依赖的package包/类
private void initializePreferredVideoFpsPreferences(ListPreference pref) {
	List<CharSequence> entries = new ArrayList<CharSequence>();
	List<CharSequence> values = new ArrayList<CharSequence>();
	entries.add(getString(R.string.pref_none));
	values.add("0");
	for (int i = 5; i <= 30; i += 5) {
		String str = Integer.toString(i);
		entries.add(str);
		values.add(str);
	}
	setListPreferenceValues(pref, entries, values);
	String value = Integer.toString(mPrefs.getPreferredVideoFps());
	if (value.equals("0")) {
		value = getString(R.string.pref_none);
	}
	pref.setSummary(value);
	pref.setValue(value);
} 
开发者ID:treasure-lau,项目名称:Linphone4Android,代码行数:19,代码来源:SettingsFragment.java

示例2: initTunnelSettings

import android.preference.ListPreference; //导入方法依赖的package包/类
private void initTunnelSettings() {
	if (!LinphoneManager.getLc().isTunnelAvailable()) {
		return;
	}

	setPreferenceDefaultValueAndSummary(R.string.pref_tunnel_host_key, mPrefs.getTunnelHost());
	setPreferenceDefaultValueAndSummary(R.string.pref_tunnel_port_key, String.valueOf(mPrefs.getTunnelPort()));
	ListPreference tunnelModePref = (ListPreference) findPreference(getString(R.string.pref_tunnel_mode_key));
	String tunnelMode = mPrefs.getTunnelMode();
	tunnelModePref.setSummary(tunnelMode);
	tunnelModePref.setValue(tunnelMode);
} 
开发者ID:treasure-lau,项目名称:Linphone4Android,代码行数:13,代码来源:SettingsFragment.java

示例3: initializePreferredVideoSizePreferences

import android.preference.ListPreference; //导入方法依赖的package包/类
private void initializePreferredVideoSizePreferences(ListPreference pref) {
	List<CharSequence> entries = new ArrayList<CharSequence>();
	List<CharSequence> values = new ArrayList<CharSequence>();
	for (String name : LinphoneManager.getLc().getSupportedVideoSizes()) {
		entries.add(name);
		values.add(name);
	}

	setListPreferenceValues(pref, entries, values);

	String value = mPrefs.getPreferredVideoSize();
	pref.setSummary(value);
	pref.setValue(value);
} 
开发者ID:treasure-lau,项目名称:Linphone4Android,代码行数:15,代码来源:SettingsFragment.java

示例4: onPreferenceChange

import android.preference.ListPreference; //导入方法依赖的package包/类
@Override
public boolean onPreferenceChange(Preference preference, Object value) {
  ListPreference listPref   = (ListPreference) preference;
  int            entryIndex = Arrays.asList(listPref.getEntryValues()).indexOf(value);

  listPref.setSummary(entryIndex >= 0 && entryIndex < listPref.getEntries().length
                      ? listPref.getEntries()[entryIndex]
                      : getString(R.string.preferences__led_color_unknown));
  return true;
} 
开发者ID:CableIM,项目名称:Cable-Android,代码行数:11,代码来源:ListSummaryPreferenceFragment.java

示例5: updatePreference

import android.preference.ListPreference; //导入方法依赖的package包/类
private void updatePreference(Preference preference) {
    //Mostra corretamente os objetos
    if (preference instanceof ListPreference) {
        ListPreference listPreference = (ListPreference) preference;
        listPreference.setSummary(listPreference.getEntry());
    }
    else if(preference instanceof EditTextPreference)
    {
        EditTextPreference editTextPreference = (EditTextPreference) preference;
        editTextPreference.setSummary(editTextPreference.getText());
    }
} 
开发者ID:alessandrojean,项目名称:order-by-android,代码行数:13,代码来源:SettingsActivity.java

示例6: updatePref

import android.preference.ListPreference; //导入方法依赖的package包/类
/**
 * Update a preference
 * @param key - which preference
 */
private void updatePref(String key){
    ListPreference preference = (ListPreference) findPreference(key);
    CharSequence entry = preference.getEntry();
    String value = preference.getValue();
    preference.setSummary(entry);
    SharedPreferences.Editor editor = mPreferences.edit();
    // Fucking strangely, a string cannot be parsed to an integer
    editor.putString(key, value);
    editor.apply();
} 
开发者ID:iskandergaba,项目名称:Botanist,代码行数:15,代码来源:SettingsActivity.java

示例7: setListPreferenceSummary

import android.preference.ListPreference; //导入方法依赖的package包/类
/** Sets summary for ListPreference based on current value. */
public static void setListPreferenceSummary( ListPreference preference, Object value )
{
  String stringValue = value.toString();
  int index = preference.findIndexOfValue( stringValue );
  preference.setSummary( index >= 0 ? preference.getEntries()[ index ] : null );
} 
开发者ID:dr0id3v,项目名称:QuotesOnDesign,代码行数:8,代码来源:Android.java

示例8: updateListPreferenceSummaryToCurrentValue

import android.preference.ListPreference; //导入方法依赖的package包/类
static void updateListPreferenceSummaryToCurrentValue(final String prefKey,
        final PreferenceScreen screen) {
    // Because the "%s" summary trick of {@link ListPreference} doesn't work properly before
    // KitKat, we need to update the summary programmatically.
    final ListPreference listPreference = (ListPreference)screen.findPreference(prefKey);
    if (listPreference == null) {
        return;
    }
    final CharSequence entries[] = listPreference.getEntries();
    final int entryIndex = listPreference.findIndexOfValue(listPreference.getValue());
    listPreference.setSummary(entryIndex < 0 ? null : entries[entryIndex]);
} 
开发者ID:sergeychilingaryan,项目名称:AOSP-Kayboard-7.1.2,代码行数:13,代码来源:SubScreenFragment.java

示例9: onCreate

import android.preference.ListPreference; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    addPreferencesFromResource(R.xml.settings);
    sp = PreferenceManager.getDefaultSharedPreferences(getActivity());
    locationInfo = ConfigPreferences.getLocationConfig(getActivity());
    //disable and enable praying notification related setting
    if (ConfigPreferences.getPrayingNotification(getActivity()) == false) {
        getPreferenceScreen().findPreference("silent").setEnabled(false);
        getPreferenceScreen().findPreference("vibration").setEnabled(false);
        getPreferenceScreen().findPreference("led").setEnabled(false);
    }

    //disable or enable silent related settings
    if(ConfigPreferences.getSilentMood(getActivity()) == false){
        getPreferenceScreen().findPreference("vibration").setEnabled(false);
    }

    if (locationInfo != null) {
        Log.i("DATA_SETTING" ,"locationInfo.dls : "+(locationInfo.dls > 0));
        CheckBoxPreference checked = (CheckBoxPreference) getPreferenceScreen().findPreference("day_light");
        checked.setChecked(locationInfo.dls > 0);
        ListPreference wayPref = (ListPreference) getPreferenceScreen().findPreference("calculations");
        Log.i("DATA_SETTING" ,"locationInfo.way : "+locationInfo.way);
        wayPref.setValueIndex(locationInfo.way);
        ListPreference mazhapPref = (ListPreference) getPreferenceScreen().findPreference("mazhab");
        mazhapPref.setValueIndex(locationInfo.mazhab);
        Log.i("DATA_SETTING" ,"locationInfo.mazhab : "+locationInfo.mazhab);
    }

    listPreference = (ListPreference) findPreference("language");
    String lang = ConfigPreferences.getApplicationLanguage(getActivity()).equalsIgnoreCase("en") ? "English" : "العربية";
    listPreference.setSummary(getString(R.string.language_summary)
            + "  (" + lang + ") ");

} 
开发者ID:fekracomputers,项目名称:MuslimMateAndroid,代码行数:37,代码来源:SettingsActivity.java

示例10: initMediaEncryptionPreference

import android.preference.ListPreference; //导入方法依赖的package包/类
private void initMediaEncryptionPreference(ListPreference pref) {
	List<CharSequence> entries = new ArrayList<CharSequence>();
	List<CharSequence> values = new ArrayList<CharSequence>();
	entries.add(getString(R.string.pref_none));
	values.add(getString(R.string.pref_media_encryption_key_none));

	LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
	if (lc == null || getResources().getBoolean(R.bool.disable_all_security_features_for_markets)) {
		setListPreferenceValues(pref, entries, values);
		return;
	}

	boolean hasZrtp = lc.mediaEncryptionSupported(MediaEncryption.ZRTP);
	boolean hasSrtp = lc.mediaEncryptionSupported(MediaEncryption.SRTP);
	boolean hasDtls = lc.mediaEncryptionSupported(MediaEncryption.DTLS);

	if (!hasSrtp && !hasZrtp && !hasDtls) {
		pref.setEnabled(false);
	} else {
		if (hasSrtp){
			entries.add(getString(R.string.media_encryption_srtp));
			values.add(getString(R.string.pref_media_encryption_key_srtp));
		}
		if (hasZrtp){
			entries.add(getString(R.string.media_encryption_zrtp));
			values.add(getString(R.string.pref_media_encryption_key_zrtp));
		}
		if (hasDtls){
			entries.add(getString(R.string.media_encryption_dtls));
			values.add(getString(R.string.pref_media_encryption_key_dtls));

		}
		setListPreferenceValues(pref, entries, values);
	}

	MediaEncryption value = mPrefs.getMediaEncryption();
	pref.setSummary(value.toString());

	String key = getString(R.string.pref_media_encryption_key_none);
	if (value.toString().equals(getString(R.string.media_encryption_srtp)))
		key = getString(R.string.pref_media_encryption_key_srtp);
	else if (value.toString().equals(getString(R.string.media_encryption_zrtp)))
		key = getString(R.string.pref_media_encryption_key_zrtp);
	else if (value.toString().equals(getString(R.string.media_encryption_dtls)))
		key = getString(R.string.pref_media_encryption_key_dtls);
	pref.setValue(key);
} 
开发者ID:treasure-lau,项目名称:Linphone4Android,代码行数:48,代码来源:SettingsFragment.java

示例11: onCreate

import android.preference.ListPreference; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    addPreferencesFromResource(R.xml.setting);

    weatherShareType = (ListPreference) findPreference(SettingsUtil.WEATHER_SHARE_TYPE);
    busRefreshFreq = (ListPreference) findPreference(SettingsUtil.BUS_REFRESH_FREQ);
    cleanCache = findPreference(SettingsUtil.CLEAR_CACHE);
    theme = findPreference(SettingsUtil.THEME);

    weatherShareType.setSummary(weatherShareType.getValue());
    busRefreshFreq.setSummary(String.format("%s 秒,长按『刷新』按钮即可开启自动模式。", busRefreshFreq.getValue()));
    String[] colorNames = getActivity().getResources().getStringArray(R.array.color_name);
    int currentThemeIndex = SettingsUtil.getTheme();
    if (currentThemeIndex >= colorNames.length) {
        theme.setSummary("自定义色");
    } else {
        theme.setSummary(colorNames[currentThemeIndex]);
    }

    weatherShareType.setOnPreferenceChangeListener(this);
    busRefreshFreq.setOnPreferenceChangeListener(this);
    cleanCache.setOnPreferenceClickListener(this);
    theme.setOnPreferenceClickListener(this);

    String[] cachePaths = new String[]{FileUtil.getInternalCacheDir(App.getContext()), FileUtil.getExternalCacheDir(App.getContext())};
    Observable
            .just(cachePaths)
            .map(new Func1<String[], String>() {
                @Override
                public String call(String[] strings) {
                    return FileSizeUtil.getAutoFileOrFilesSize(strings);
                }
            })
            .subscribeOn(Schedulers.io())
            .observeOn(AndroidSchedulers.mainThread())
            .subscribe(new SimpleSubscriber<String>() {
                @Override
                public void onNext(String s) {
                    cleanCache.setSummary(s);
                }
            });

} 
开发者ID:li-yu,项目名称:FakeWeather,代码行数:45,代码来源:SettingFragment.java

示例12: setUpPreferences

import android.preference.ListPreference; //导入方法依赖的package包/类
private void setUpPreferences() {

            displayLimitPreference = (EditTextPreference) findPreference(getString(R.string.pref_display_limit));

            int displayLimitValue = PreferenceHelper.getDisplayLimitPreference(getActivity());

            displayLimitPreference.setSummary(getString(R.string.pref_display_limit_summary,
                    displayLimitValue, getString(R.string.pref_display_limit_default)));

            displayLimitPreference.setOnPreferenceChangeListener(this);

            logLinePeriodPreference = (EditTextPreference) findPreference(getString(R.string.pref_log_line_period));

            int logLinePrefValue = PreferenceHelper.getLogLinePeriodPreference(getActivity());

            logLinePeriodPreference.setSummary(getString(R.string.pref_log_line_period_summary,
                    logLinePrefValue, getString(R.string.pref_log_line_period_default)));

            logLinePeriodPreference.setOnPreferenceChangeListener(this);

            textSizePreference = (ListPreference) findPreference(getString(R.string.pref_text_size));
            textSizePreference.setSummary(textSizePreference.getEntry());
            textSizePreference.setOnPreferenceChangeListener(this);

            defaultLevelPreference = (ListPreference) findPreference(getString(R.string.pref_default_log_level));
            defaultLevelPreference.setOnPreferenceChangeListener(this);
            setDefaultLevelPreferenceSummary(defaultLevelPreference.getEntry());


            bufferPreference = (MultipleChoicePreference) findPreference(getString(R.string.pref_buffer));
            bufferPreference.setOnPreferenceChangeListener(this);
            setBufferPreferenceSummary(bufferPreference.getValue());

            scrubberPreference = (SwitchPreference) getPreferenceScreen().findPreference("scrubber");
            scrubberPreference.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
                @Override
                public boolean onPreferenceChange(Preference preference, Object newValue) {
                    LogLine.isScrubberEnabled = (boolean) newValue;
                    return true;
                }
            });
        } 
开发者ID:tranleduy2000,项目名称:javaide,代码行数:43,代码来源:SettingsActivity.java

示例13: initializeListSummary

import android.preference.ListPreference; //导入方法依赖的package包/类
protected void initializeListSummary(ListPreference pref) {
  pref.setSummary(pref.getEntry());
} 
开发者ID:CableIM,项目名称:Cable-Android,代码行数:4,代码来源:ListSummaryPreferenceFragment.java

示例14: entrySummary

import android.preference.ListPreference; //导入方法依赖的package包/类
private void entrySummary(String key) {
    ListPreference pref = (ListPreference) findPreference(key);
    pref.setSummary(pref.getEntry());
} 
开发者ID:qqq3,项目名称:inventum,代码行数:5,代码来源:SettingsActivity.java

示例15: setSummaries

import android.preference.ListPreference; //导入方法依赖的package包/类
private void setSummaries(Recipients recipients) {
  CheckBoxPreference         mutePreference     = (CheckBoxPreference) this.findPreference(PREFERENCE_MUTED);
  AdvancedRingtonePreference ringtonePreference = (AdvancedRingtonePreference) this.findPreference(PREFERENCE_TONE);
  ListPreference             vibratePreference  = (ListPreference) this.findPreference(PREFERENCE_VIBRATE);
  ColorPreference            colorPreference    = (ColorPreference) this.findPreference(PREFERENCE_COLOR);
  Preference                 blockPreference    = this.findPreference(PREFERENCE_BLOCK);
  final Preference           identityPreference = this.findPreference(PREFERENCE_IDENTITY);

  mutePreference.setChecked(recipients.isMuted());

  final Uri toneUri = recipients.getRingtone();

  if (toneUri == null) {
    ringtonePreference.setSummary(R.string.preferences__default);
    ringtonePreference.setCurrentRingtone(Settings.System.DEFAULT_NOTIFICATION_URI);
  } else if (toneUri.toString().isEmpty()) {
    ringtonePreference.setSummary(R.string.preferences__silent);
    ringtonePreference.setCurrentRingtone(null);
  } else {
    Ringtone tone = RingtoneManager.getRingtone(getActivity(), toneUri);

    if (tone != null) {
      ringtonePreference.setSummary(tone.getTitle(getActivity()));
      ringtonePreference.setCurrentRingtone(toneUri);
    }
  }

  if (recipients.getVibrate() == VibrateState.DEFAULT) {
    vibratePreference.setSummary(R.string.preferences__default);
    vibratePreference.setValueIndex(0);
  } else if (recipients.getVibrate() == VibrateState.ENABLED) {
    vibratePreference.setSummary(R.string.RecipientPreferenceActivity_enabled);
    vibratePreference.setValueIndex(1);
  } else {
    vibratePreference.setSummary(R.string.RecipientPreferenceActivity_disabled);
    vibratePreference.setValueIndex(2);
  }

  if (!recipients.isSingleRecipient() || recipients.isGroupRecipient()) {
    if (colorPreference    != null) getPreferenceScreen().removePreference(colorPreference);
    if (blockPreference    != null) getPreferenceScreen().removePreference(blockPreference);
    if (identityPreference != null) getPreferenceScreen().removePreference(identityPreference);
  } else {
    colorPreference.setChoices(MaterialColors.CONVERSATION_PALETTE.asConversationColorArray(getActivity()));
    colorPreference.setValue(recipients.getColor().toActionBarColor(getActivity()));

    if (recipients.isBlocked()) blockPreference.setTitle(R.string.RecipientPreferenceActivity_unblock);
    else                        blockPreference.setTitle(R.string.RecipientPreferenceActivity_block);

    IdentityUtil.getRemoteIdentityKey(getActivity(), masterSecret, recipients.getPrimaryRecipient()).addListener(new ListenableFuture.Listener<Optional<IdentityKey>>() {
      @Override
      public void onSuccess(Optional<IdentityKey> result) {
        if (result.isPresent()) {
          if (identityPreference != null) identityPreference.setOnPreferenceClickListener(new IdentityClickedListener(result.get()));
          if (identityPreference != null) identityPreference.setEnabled(true);
        } else if (canHaveSafetyNumber) {
          if (identityPreference != null) identityPreference.setSummary(R.string.RecipientPreferenceActivity_available_once_a_message_has_been_sent_or_received);
          if (identityPreference != null) identityPreference.setEnabled(false);
        } else {
          if (identityPreference != null) getPreferenceScreen().removePreference(identityPreference);
        }
      }

      @Override
      public void onFailure(ExecutionException e) {
        if (identityPreference != null) getPreferenceScreen().removePreference(identityPreference);
      }
    });
  }
} 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:71,代码来源:RecipientPreferenceActivity.java

本文标签属性:

示例:示例的拼音

代码:代码转换器

java:java模拟器

ListPreference:ListPreference

setSummary:setSummary

上一篇:什么叫工业(工业怎么解释)
下一篇:Java PreferenceScreen.getPreferenceCount方法代码示例(javapreferencescreen.getpreferencecount典型用法代码示例汇总)

为您推荐