本文整理汇总了Java中android.preference.ListPreference.setValue方法的典型用法代码示例。如果您正苦于以下问题:Java ListPreference.setValue方法的具体用法?Java ListPreference.setValue怎么用?Java ListPreference.setValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.preference.ListPreference
的用法示例。
在下文中一共展示了ListPreference.setValue方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例2: setRpcServerPreferenceData
import android.preference.ListPreference; //导入方法依赖的package包/类
private void setRpcServerPreferenceData(ListPreference lp) {
NetworkInfo[] networks = ethereumNetworkRepository.getAvailableNetworkList();
CharSequence[] entries = new CharSequence[networks.length];
for (int ii = 0; ii < networks.length; ii++) {
entries[ii] = networks[ii].name;
}
CharSequence[] entryValues = new CharSequence[networks.length];
for (int ii = 0; ii < networks.length; ii++) {
entryValues[ii] = networks[ii].name;
}
String currentValue = ethereumNetworkRepository.getDefaultNetwork().name;
lp.setEntries(entries);
lp.setDefaultValue(currentValue);
lp.setValue(currentValue);
lp.setSummary(currentValue);
lp.setEntryValues(entryValues);
}
示例3: 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);
}
示例4: 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);
}
示例5: initLimeEncryptionPreference
import android.preference.ListPreference; //导入方法依赖的package包/类
private void initLimeEncryptionPreference(ListPreference pref) {
List<CharSequence> entries = new ArrayList<CharSequence>();
List<CharSequence> values = new ArrayList<CharSequence>();
entries.add(getString(R.string.lime_encryption_entry_disabled));
values.add(LinphoneLimeState.Disabled.toString());
LinphoneCore lc = LinphoneManager.getLcIfManagerNotDestroyedOrNull();
if (lc == null || !lc.isLimeEncryptionAvailable()) {
setListPreferenceValues(pref, entries, values);
pref.setEnabled(false);
return;
}
entries.add(getString(R.string.lime_encryption_entry_mandatory));
values.add(LinphoneLimeState.Mandatory.toString());
entries.add(getString(R.string.lime_encryption_entry_preferred));
values.add(LinphoneLimeState.Preferred.toString());
setListPreferenceValues(pref, entries, values);
LinphoneLimeState lime = mPrefs.getLimeEncryption();
if (lime == LinphoneLimeState.Disabled) {
pref.setSummary(getString(R.string.lime_encryption_entry_disabled));
} else if (lime == LinphoneLimeState.Mandatory) {
pref.setSummary(getString(R.string.lime_encryption_entry_mandatory));
} else if (lime == LinphoneLimeState.Preferred) {
pref.setSummary(getString(R.string.lime_encryption_entry_preferred));
}
pref.setValue(lime.toString());
}
示例6: updateFileSourcePrefs
import android.preference.ListPreference; //导入方法依赖的package包/类
/**
* Will try to extract the file source preferences (frequency, sample rate, format) from the filename
*/
public void updateFileSourcePrefs() {
EditTextPreference etp_filename = (EditTextPreference) findPreference(getString(R.string.pref_filesource_file));
EditTextPreference etp_frequency = (EditTextPreference) findPreference(getString(R.string.pref_filesource_frequency));
EditTextPreference etp_sampleRate = (EditTextPreference) findPreference(getString(R.string.pref_filesource_sampleRate));
ListPreference lp_format = (ListPreference) findPreference(getString(R.string.pref_filesource_format));
String filename = etp_filename.getText();
// Format. Search for strings like hackrf, rtl-sdr, ...
if(filename.matches(".*hackrf.*") || filename.matches(".*HackRF.*") ||
filename.matches(".*HACKRF.*") || filename.matches(".*hackrfone.*"))
lp_format.setValue("0");
if(filename.matches(".*rtlsdr.*") || filename.matches(".*rtl-sdr.*") ||
filename.matches(".*RTLSDR.*") || filename.matches(".*RTL-SDR.*"))
lp_format.setValue("1");
// Sampe Rate. Search for pattern XXXXXXXSps
if(filename.matches(".*(_|-|\\s)([0-9]+)(sps|Sps|SPS).*"))
etp_sampleRate.setText(filename.replaceFirst(".*(_|-|\\s)([0-9]+)(sps|Sps|SPS).*", "$2"));
if(filename.matches(".*(_|-|\\s)([0-9]+)(msps|Msps|MSps|MSPS).*"))
etp_sampleRate.setText("" + Integer.valueOf(filename.replaceFirst(".*(_|-|\\s)([0-9]+)(msps|Msps|MSps|MSPS).*", "$2")) * 1000000);
// Frequency. Search for pattern XXXXXXXHz
if(filename.matches(".*(_|-|\\s)([0-9]+)(hz|Hz|HZ).*"))
etp_frequency.setText(filename.replaceFirst(".*(_|-|\\s)([0-9]+)(hz|Hz|HZ).*", "$2"));
if(filename.matches(".*(_|-|\\s)([0-9]+)(mhz|Mhz|MHz|MHZ).*"))
etp_frequency.setText("" + Integer.valueOf(filename.replaceFirst(".*(_|-|\\s)([0-9]+)(mhz|Mhz|MHz|MHZ).*", "$2")) * 1000000);
}
示例7: fillLayout
import android.preference.ListPreference; //导入方法依赖的package包/类
@Override
public void fillLayout(final SipProfile account) {
super.fillLayout(account);
CharSequence[] states = new CharSequence[] {"act", "nsw", "nt", "qld", "sa", "tas", "vic", "wa"};
accountState = new ListPreference(parent);
accountState.setEntries(states);
accountState.setEntryValues(states);
accountState.setKey("state");
accountState.setDialogTitle(R.string.w_iinet_state);
accountState.setTitle(R.string.w_iinet_state);
accountState.setSummary(R.string.w_iinet_state_desc);
accountState.setDefaultValue("act");
addPreference(accountState);
String domain = account.reg_uri;
if( domain != null ) {
for(CharSequence state : states) {
String currentComp = "sip:sip."+state+".iinet.net.au";
if( currentComp.equalsIgnoreCase(domain) ) {
accountState.setValue(state.toString());
break;
}
}
}
accountUsername.setTitle(R.string.w_iinet_username);
accountUsername.setDialogTitle(R.string.w_iinet_username);
accountPassword.setTitle(R.string.w_iinet_password);
accountPassword.setDialogTitle(R.string.w_iinet_password);
}
示例8: 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);
}
示例9: handlePreferenceUi
import android.preference.ListPreference; //导入方法依赖的package包/类
public static void handlePreferenceUi(ListPreference preference) {
Context context = preference.getContext();
preference.setValue(getAppliedValue(context));
preference.setOnPreferenceChangeListener(new PreferenceChangeHandler(context));
}
示例10: onCreate
import android.preference.ListPreference; //导入方法依赖的package包/类
@Override
public void onCreate(final Bundle icicle) {
super.onCreate(icicle);
addPreferencesFromResource(R.xml.prefs_screen_advanced);
final Resources res = getResources();
final Context context = getActivity();
// When we are called from the Settings application but we are not already running, some
// singleton and utility classes may not have been initialized. We have to call
// initialization method of these classes here. See {@link LatinIME#onCreate()}.
AudioAndHapticFeedbackManager.init(context);
final SharedPreferences prefs = getPreferenceManager().getSharedPreferences();
if (!Settings.isInternal(prefs)) {
removePreference(Settings.SCREEN_DEBUG);
}
if (!AudioAndHapticFeedbackManager.getInstance().hasVibrator()) {
removePreference(Settings.PREF_VIBRATION_DURATION_SETTINGS);
}
// TODO: consolidate key preview dismiss delay with the key preview animation parameters.
if (!Settings.readFromBuildConfigIfToShowKeyPreviewPopupOption(res)) {
removePreference(Settings.PREF_KEY_PREVIEW_POPUP_DISMISS_DELAY);
} else {
// TODO: Cleanup this setup.
final ListPreference keyPreviewPopupDismissDelay =
(ListPreference) findPreference(Settings.PREF_KEY_PREVIEW_POPUP_DISMISS_DELAY);
final String popupDismissDelayDefaultValue = Integer.toString(res.getInteger(
R.integer.config_key_preview_linger_timeout));
keyPreviewPopupDismissDelay.setEntries(new String[] {
res.getString(R.string.key_preview_popup_dismiss_no_delay),
res.getString(R.string.key_preview_popup_dismiss_default_delay),
});
keyPreviewPopupDismissDelay.setEntryValues(new String[] {
"0",
popupDismissDelayDefaultValue
});
if (null == keyPreviewPopupDismissDelay.getValue()) {
keyPreviewPopupDismissDelay.setValue(popupDismissDelayDefaultValue);
}
keyPreviewPopupDismissDelay.setEnabled(
Settings.readKeyPreviewPopupEnabled(prefs, res));
}
setupKeypressVibrationDurationSettings();
setupKeypressSoundVolumeSettings();
setupKeyLongpressTimeoutSettings();
setupKeyboardHeightSettings();
refreshEnablingsOfKeypressSoundAndVibrationSettings();
setupKeyboardColorSettings();
}
示例11: activateScreenFlashlight
import android.preference.ListPreference; //导入方法依赖的package包/类
private void activateScreenFlashlight() {
ListPreference pref = (ListPreference) findPreference(PREF_FLASHLIGHT);
pref.setValue("0");
}
示例12: onCreate
import android.preference.ListPreference; //导入方法依赖的package包/类
@Override
public void onCreate(final Bundle icicle) {
super.onCreate(icicle);
addPreferencesFromResource(R.xml.prefs_screen_advanced);
final Resources res = getResources();
final Context context = getActivity();
// When we are called from the Settings application but we are not already running, some
// singleton and utility classes may not have been initialized. We have to call
// initialization method of these classes here. See {@link LatinIME#onCreate()}.
AudioAndHapticFeedbackManager.init(context);
final SharedPreferences prefs = getPreferenceManager().getSharedPreferences();
if (!Settings.isInternal(prefs)) {
removePreference(Settings.SCREEN_DEBUG);
}
if (!AudioAndHapticFeedbackManager.getInstance().hasVibrator()) {
removePreference(Settings.PREF_VIBRATION_DURATION_SETTINGS);
}
// TODO: consolidate key preview dismiss delay with the key preview animation parameters.
if (!Settings.readFromBuildConfigIfToShowKeyPreviewPopupOption(res)) {
removePreference(Settings.PREF_KEY_PREVIEW_POPUP_DISMISS_DELAY);
} else {
// TODO: Cleanup this setup.
final ListPreference keyPreviewPopupDismissDelay =
(ListPreference) findPreference(Settings.PREF_KEY_PREVIEW_POPUP_DISMISS_DELAY);
final String popupDismissDelayDefaultValue = Integer.toString(res.getInteger(
R.integer.config_key_preview_linger_timeout));
keyPreviewPopupDismissDelay.setEntries(new String[] {
res.getString(R.string.key_preview_popup_dismiss_no_delay),
res.getString(R.string.key_preview_popup_dismiss_default_delay),
});
keyPreviewPopupDismissDelay.setEntryValues(new String[] {
"0",
popupDismissDelayDefaultValue
});
if (null == keyPreviewPopupDismissDelay.getValue()) {
keyPreviewPopupDismissDelay.setValue(popupDismissDelayDefaultValue);
}
keyPreviewPopupDismissDelay.setEnabled(
Settings.readKeyPreviewPopupEnabled(prefs, res));
}
setupKeypressVibrationDurationSettings();
setupKeypressSoundVolumeSettings();
setupKeyLongpressTimeoutSettings();
refreshEnablingsOfKeypressSoundAndVibrationSettings();
}
示例13: setupListPreference
import android.preference.ListPreference; //导入方法依赖的package包/类
/**
* Set up the {@link ListPreference} instance identified by {@code key}.
*
* @param key
* The key of the {@link ListPreference} object.
* @param value
* Initial value for the {@link ListPreference} object.
*
* @return The {@link ListPreference} instance identified by {@code key}.
*/
protected ListPreference setupListPreference(final String key, final String value) {
final ListPreference prefView = (ListPreference) findPreference(key);
prefView.setValue(value);
prefView.setSummary(prefView.getEntry());
prefView.setOnPreferenceChangeListener(new PreferenceChangeListener(prefView));
return prefView;
}
示例14: initListPreference
import android.preference.ListPreference; //导入方法依赖的package包/类
/**
* Initialize a given {@link ListPreference} instance.
*
* @param prefView
* The {@link ListPreference} instance to initialize.
* @param value
* Initial value for the {@link ListPreference} object.
* @param entries
* Sets the human-readable entries to be shown in the list.
* @param entryValues
* The array to find the value to save for a preference when an
* entry from entries is selected.
*/
protected void initListPreference(final ListPreference prefView, final String value,
final CharSequence[] entries, final CharSequence[] entryValues) {
prefView.setEntries(entries);
prefView.setEntryValues(entryValues);
prefView.setValue(value);
prefView.setSummary(prefView.getEntry());
prefView.setOnPreferenceChangeListener(new PreferenceChangeListener(prefView));
}