本文整理汇总了Java中android.preference.ListPreference.setEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java ListPreference.setEnabled方法的具体用法?Java ListPreference.setEnabled怎么用?Java ListPreference.setEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.preference.ListPreference
的用法示例。
在下文中一共展示了ListPreference.setEnabled方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onPreExecute
import android.preference.ListPreference; //导入方法依赖的package包/类
@Override
protected void onPreExecute() {
autoExpandFolder = (ListPreference) findPreference(PREFERENCE_AUTO_EXPAND_FOLDER);
autoExpandFolder.setEnabled(false);
archiveFolder = (ListPreference) findPreference(PREFERENCE_ARCHIVE_FOLDER);
archiveFolder.setEnabled(false);
draftsFolder = (ListPreference) findPreference(PREFERENCE_DRAFTS_FOLDER);
draftsFolder.setEnabled(false);
sentFolder = (ListPreference) findPreference(PREFERENCE_SENT_FOLDER);
sentFolder.setEnabled(false);
spamFolder = (ListPreference) findPreference(PREFERENCE_SPAM_FOLDER);
spamFolder.setEnabled(false);
trashFolder = (ListPreference) findPreference(PREFERENCE_TRASH_FOLDER);
trashFolder.setEnabled(false);
if (!isMoveCapable) {
PreferenceScreen foldersCategory =
(PreferenceScreen) findPreference(PREFERENCE_CATEGORY_FOLDERS);
foldersCategory.removePreference(archiveFolder);
foldersCategory.removePreference(spamFolder);
foldersCategory.removePreference(draftsFolder);
foldersCategory.removePreference(sentFolder);
foldersCategory.removePreference(trashFolder);
}
}
示例2: 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());
}
示例3: onPreferenceTreeClick
import android.preference.ListPreference; //导入方法依赖的package包/类
@Override
public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
if ("select_linkage".equals(preference.getKey())) {
CheckBoxPreference checkBox = (CheckBoxPreference) findPreference("select_linkage");
ListPreference editBox = (ListPreference) findPreference("select_city");
editBox.setEnabled(checkBox.isChecked());
}
return super.onPreferenceTreeClick(preferenceScreen, preference);
}
示例4: 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);
}
示例5: 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();
}
示例6: setUpListPreference
import android.preference.ListPreference; //导入方法依赖的package包/类
/**
* Initialize a ListPreference with a certain value.
* @param preference The ListPreference to initialize.
* @param value The value to initialize it to.
*/
private void setUpListPreference(Preference preference, ContentSetting value) {
if (value == null) {
getPreferenceScreen().removePreference(preference);
return;
}
ListPreference listPreference = (ListPreference) preference;
int contentType = getContentSettingsTypeFromPreferenceKey(preference.getKey());
CharSequence[] keys = new String[2];
CharSequence[] descriptions = new String[2];
keys[0] = ContentSetting.ALLOW.toString();
keys[1] = ContentSetting.BLOCK.toString();
descriptions[0] = getResources().getString(
ContentSettingsResources.getSiteSummary(ContentSetting.ALLOW));
descriptions[1] = getResources().getString(
ContentSettingsResources.getSiteSummary(ContentSetting.BLOCK));
listPreference.setEntryValues(keys);
listPreference.setEntries(descriptions);
int index = (value == ContentSetting.ALLOW ? 0 : 1);
listPreference.setValueIndex(index);
int explanationResourceId = ContentSettingsResources.getExplanation(contentType);
if (explanationResourceId != 0) {
listPreference.setTitle(explanationResourceId);
}
if (listPreference.isEnabled()) {
SiteSettingsCategory category =
SiteSettingsCategory.fromContentSettingsType(contentType);
if (category != null && !category.enabledInAndroid(getActivity())) {
listPreference.setIcon(category.getDisabledInAndroidIcon(getActivity()));
listPreference.setEnabled(false);
} else {
listPreference.setIcon(ContentSettingsResources.getIcon(contentType));
}
} else {
listPreference.setIcon(
ContentSettingsResources.getDisabledIcon(contentType, getResources()));
}
preference.setSummary("%s");
listPreference.setOnPreferenceChangeListener(this);
}
示例7: 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();
}