当前位置: 首页>>代码示例>>Java>>正文


Java ListPreference.setEnabled方法代码示例

本文整理汇总了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);
    }
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:26,代码来源:AccountSettings.java

示例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());
}
 
开发者ID:treasure-lau,项目名称:Linphone4Android,代码行数:30,代码来源:SettingsFragment.java

示例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);
}
 
开发者ID:Zweihui,项目名称:Aurora,代码行数:10,代码来源:PrefFragment.java

示例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);
}
 
开发者ID:treasure-lau,项目名称:Linphone4Android,代码行数:48,代码来源:SettingsFragment.java

示例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();
}
 
开发者ID:rkkr,项目名称:simple-keyboard,代码行数:55,代码来源:AdvancedSettingsFragment.java

示例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);
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:49,代码来源:SingleWebsitePreferences.java

示例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();
}
 
开发者ID:sergeychilingaryan,项目名称:AOSP-Kayboard-7.1.2,代码行数:53,代码来源:AdvancedSettingsFragment.java


注:本文中的android.preference.ListPreference.setEnabled方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。