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


Java EditTextPreference.setEnabled方法代码示例

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


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

示例1: createPrefAPIURL

import android.preference.EditTextPreference; //导入方法依赖的package包/类
void createPrefAPIURL() {
    EditTextPreference editTextPreference = (EditTextPreference) findPreference("api_url");
    if (defaultConfig != null) {
        editTextPreference.setEnabled(false);
    } else {
        editTextPreference.setEnabled(true);
    }
    if (config.getUrl() == null || config.getUrl().length() == 0)
        editTextPreference.setSummary("(not assigned)");
    else {
        editTextPreference.setSummary(config.getUrl());
    }

    editTextPreference.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
        @Override
        public boolean onPreferenceChange(Preference preference, Object newValue) {
            String temp = (String) newValue;
            if (temp == null || temp.length() == 0) return false;
            config.setUrl(temp);
            preference.setSummary(temp);
            return false;
        }
    });
}
 
开发者ID:MD2Korg,项目名称:mCerebrum-DataKit,代码行数:25,代码来源:PrefsFragmentCerebralCortexSettings.java

示例2: initNetworkSettings

import android.preference.EditTextPreference; //导入方法依赖的package包/类
private void initNetworkSettings() {
	((CheckBoxPreference) findPreference(getString(R.string.pref_wifi_only_key))).setChecked(mPrefs.isWifiOnlyEnabled());

	// Disable UPnP if ICE si enabled, or disable ICE if UPnP is enabled
	CheckBoxPreference ice = (CheckBoxPreference) findPreference(getString(R.string.pref_ice_enable_key));
	CheckBoxPreference turn = (CheckBoxPreference) findPreference(getString(R.string.pref_turn_enable_key));
	ice.setChecked(mPrefs.isIceEnabled());
	turn.setEnabled(mPrefs.getStunServer() != null);
	turn.setChecked(mPrefs.isTurnEnabled());

	EditTextPreference turnUsername = (EditTextPreference) findPreference(getString(R.string.pref_turn_username_key));
	EditTextPreference turnPassword = (EditTextPreference) findPreference(getString(R.string.pref_turn_passwd_key));
	turnUsername.setEnabled(mPrefs.isTurnEnabled());
	turnUsername.setSummary(mPrefs.getTurnUsername());
	turnUsername.setText(mPrefs.getTurnUsername());
	turnPassword.setEnabled(mPrefs.isTurnEnabled());

	CheckBoxPreference randomPort = (CheckBoxPreference) findPreference(getString(R.string.pref_transport_use_random_ports_key));
	randomPort.setChecked(mPrefs.isUsingRandomPort());

	// Disable sip port choice if port is random
	EditTextPreference sipPort = (EditTextPreference) findPreference(getString(R.string.pref_sip_port_key));
	sipPort.setEnabled(!randomPort.isChecked());
	sipPort.setSummary(mPrefs.getSipPort());
	sipPort.setText(mPrefs.getSipPort());

	EditTextPreference stun = (EditTextPreference) findPreference(getString(R.string.pref_stun_server_key));
	stun.setSummary(mPrefs.getStunServer());
	stun.setText(mPrefs.getStunServer());

	((CheckBoxPreference) findPreference(getString(R.string.pref_push_notification_key))).setChecked(mPrefs.isPushNotificationEnabled());
	((CheckBoxPreference) findPreference(getString(R.string.pref_ipv6_key))).setChecked(mPrefs.isUsingIpv6());
}
 
开发者ID:treasure-lau,项目名称:Linphone4Android,代码行数:34,代码来源:SettingsFragment.java

示例3: onSharedPreferenceChanged

import android.preference.EditTextPreference; //导入方法依赖的package包/类
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
    if(key.equals("pref_enable_notifications")) {
        switchPullNodeStatsAlarm(sharedPreferences.getBoolean(key, true));
    } else if(key.equals("storj_dash_integration_enabled")) {
        boolean isEnabled = sharedPreferences.getBoolean("storj_dash_integration_enabled", false);
        EditTextPreference apiKey = (EditTextPreference) findPreference("api_key_edit_text");
        apiKey.setEnabled(isEnabled);
    }
}
 
开发者ID:geckogecko,项目名称:storj_hoststats_app,代码行数:11,代码来源:PreferencesActivity.java

示例4: onCreate

import android.preference.EditTextPreference; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    addPreferencesFromResource(R.xml.preferences);
    startAutomatically = (CheckBoxPreference) findPreference(getString(R.string.pref_start_automatically_key));
    imagepathEditText = (EditTextPreference) findPreference(getString(R.string.pref_image_path_key));
    postStartEditText = (EditTextPreference) findPreference(getString(R.string.pref_post_start_key));
    preStopEditText = (EditTextPreference) findPreference(getString(R.string.pref_pre_stop_key));
    useChecksumCheckBox = (CheckBoxPreference) findPreference(getString(R.string.pref_use_checksum_key));
    installOnInternalStorageBox = (CheckBoxPreference) findPreference(getString(R.string.pref_use_checksum_key));
    limitTo4gbCheckBox = (CheckBoxPreference) findPreference(getString(R.string.pref_limit_to_4gb_key));

    SharedPreferences prefs = getPreferenceScreen().getSharedPreferences();
    Boolean checked = prefs.getBoolean(
            getString(R.string.pref_install_on_internal_storage_key), false);

    if (checked) {
        NativeHelper.installInInternalStorage = true;
        NativeHelper.image_path = NativeHelper.mnt;
        useChecksumCheckBox.setEnabled(false);
        imagepathEditText.setEnabled(false);
        limitTo4gbCheckBox.setEnabled(false);
        setSummaries();
    }

    if (NativeHelper.installInInternalStorage)
        startAutomatically
                .setSummary(getString(R.string.pref_start_on_boot_summary));
}
 
开发者ID:Marz6759,项目名称:MarzecPro,代码行数:30,代码来源:PreferencesActivity.java

示例5: addMedtronicOptionsListener

import android.preference.EditTextPreference; //导入方法依赖的package包/类
private void addMedtronicOptionsListener(){
     final EditTextPreference med_id = (EditTextPreference)findPreference("medtronic_cgm_id");
     final EditTextPreference gluc_id = (EditTextPreference)findPreference("glucometer_cgm_id");
     final EditTextPreference sensor_id = (EditTextPreference)findPreference("sensor_cgm_id");
     final ListPreference calib_type = (ListPreference)findPreference("calibrationType");
     final ListPreference glucSrcType = (ListPreference)findPreference("glucSrcTypes");

     med_id.setEnabled(true);
     gluc_id.setEnabled(true);
     sensor_id.setEnabled(true);
     calib_type.setEnabled(true);
     glucSrcType.setEnabled(true);

}
 
开发者ID:arbox0,项目名称:MedtronicUploader,代码行数:15,代码来源:SettingsFragment.java

示例6: updateCardProcessorPreferences

import android.preference.EditTextPreference; //导入方法依赖的package包/类
private void updateCardProcessorPreferences(String newValue) {
    if (newValue == null) {
        newValue = Configure.getCardProcessor(this);
    }

    ListPreference card_processor = (ListPreference) this.findPreference("card_processor");

    EditTextPreference atos_address = (EditTextPreference) this.findPreference("worldline_address");
    EditTextPreference xengo_userid = (EditTextPreference) this.findPreference("xengo_userid");
    EditTextPreference xengo_password = (EditTextPreference) this.findPreference("xengo_password");
    EditTextPreference xengo_terminalid = (EditTextPreference) this.findPreference("xengo_terminalid");

    atos_address.setEnabled("atos_classic".equals(newValue));
    xengo_userid.setEnabled("atos_xengo".equals(newValue));
    xengo_password.setEnabled("atos_xengo".equals(newValue));
    xengo_terminalid.setEnabled("atos_xengo".equals(newValue));


    card_processor.setSummary(newValue);
    int i = 0;
    for (CharSequence entry : card_processor.getEntryValues()) {
        if (newValue.equals(entry)) {
            card_processor.setSummary(card_processor.getEntries()[i]);
        }
        i++;
    }
}
 
开发者ID:ScilCoop,项目名称:pasteque-android,代码行数:28,代码来源:Configure.java

示例7: onCreate

import android.preference.EditTextPreference; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    Log.d("Settings", "onCreate");
    super.onCreate(savedInstanceState);
    params = new ParametersImpl(this);
    // fixme: everything should be put in onResume?
    addPreferencesFromResource(R.xml.preferences);
    playIntent = new Intent(this, MusicService.class);
    bindService(playIntent, musicConnection, Context.BIND_AUTO_CREATE);

    SharedPreferences sharedPreferences = getPreferenceScreen().getSharedPreferences();

    String thresholdKeys = PrefKeys.SHAKE_THRESHOLD.name();
    EditTextPreference prefShakeThreshold = (EditTextPreference) findPreference(thresholdKeys);
    CheckBoxPreference prefEnableShake = (CheckBoxPreference) findPreference(PrefKeys.ENABLE_SHAKE.name());
    if(getPackageManager().hasSystemFeature(PackageManager.FEATURE_SENSOR_ACCELEROMETER)) {
        prefShakeThreshold.setSummary(String.valueOf(params.getShakeThreshold()));
        prefEnableShake.setChecked(params.getEnableShake());
    }
    else {
        prefShakeThreshold.setEnabled(false);
        prefEnableShake.setEnabled(false);
        Toast.makeText(getApplicationContext(),
                getResources().getString(R.string.settings_no_accelerometer),
                Toast.LENGTH_LONG).show();
    }

    findPreference(PrefKeys.TEXT_SIZE_NORMAL.name()).setSummary(String.valueOf(params.getNormalTextSize()));
    findPreference(PrefKeys.TEXT_SIZE_BIG.name()).setSummary(String.valueOf(params.getBigTextSize()));
    findPreference(PrefKeys.TEXT_SIZE_RATIO.name()).setSummary(String.valueOf(params.getTextSizeRatio()));

    Preference rescan = findPreference(getResources().getString(R.string.settings_rescan_key));
    rescan.setOnPreferenceClickListener(this);

    Preference donate = findPreference(getResources().getString(R.string.settings_donate_key));
    donate.setOnPreferenceClickListener(this);

    setUnfoldSubgroup();
    setUnfoldThresholdSummary();

    String rootFoldersKey = PrefKeys.ROOT_FOLDERS.name();
    EditTextPreference prefRootFolders = (EditTextPreference) findPreference(rootFoldersKey);
    prefRootFolders.setSummary(params.getRootFolders());
    if(!sharedPreferences.contains(rootFoldersKey))
        prefRootFolders.setText(Path.getMusicStoragesStr(getBaseContext()));

    setFoldSummary();

    this.onContentChanged();
}
 
开发者ID:souch,项目名称:SMP,代码行数:51,代码来源:Settings.java

示例8: refreshDisplay

import android.preference.EditTextPreference; //导入方法依赖的package包/类
/**
 * Refresh the preferences.
 */
private void refreshDisplay() {
    boolean isConnected = Matrix.getInstance(getActivity()).isConnected();
    Context appContext = getActivity().getApplicationContext();

    PreferenceManager preferenceManager = getPreferenceManager();

    // refresh the avatar
    UserAvatarPreference avatarPreference = (UserAvatarPreference) preferenceManager.findPreference(PreferencesManager.SETTINGS_PROFILE_PICTURE_PREFERENCE_KEY);
    avatarPreference.refreshAvatar();
    avatarPreference.setEnabled(isConnected);

    // refresh the display name
    final EditTextPreference displaynamePref = (EditTextPreference) preferenceManager.findPreference(PreferencesManager.SETTINGS_DISPLAY_NAME_PREFERENCE_KEY);
    displaynamePref.setSummary(mSession.getMyUser().displayname);
    displaynamePref.setText(mSession.getMyUser().displayname);
    displaynamePref.setEnabled(isConnected);

    // change password
    final EditTextPreference changePasswordPref = (EditTextPreference) preferenceManager.findPreference(PreferencesManager.SETTINGS_CHANGE_PASSWORD_PREFERENCE_KEY);
    changePasswordPref.setEnabled(isConnected);

    // update the push rules
    SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(appContext);

    BingRuleSet rules = mSession.getDataHandler().pushRules();

    GcmRegistrationManager gcmMgr = Matrix.getInstance(appContext).getSharedGCMRegistrationManager();

    for (String resourceText : mPushesRuleByResourceId.keySet()) {
        Preference preference = preferenceManager.findPreference(resourceText);

        if (null != preference) {
            if (preference instanceof BingRulePreference) {
                BingRulePreference bingRulePreference = (BingRulePreference)preference;
                bingRulePreference.setEnabled((null != rules) && isConnected);
                bingRulePreference.setBingRule(mSession.getDataHandler().pushRules().findDefaultRule(mPushesRuleByResourceId.get(resourceText)));
            } else {
                CheckBoxPreference switchPreference = (CheckBoxPreference)preference;
                if (resourceText.equals(PreferencesManager.SETTINGS_ENABLE_THIS_DEVICE_PREFERENCE_KEY)) {
                    switchPreference.setChecked(gcmMgr.areDeviceNotificationsAllowed());
                } else if (resourceText.equals(PreferencesManager.SETTINGS_TURN_SCREEN_ON_PREFERENCE_KEY)) {
                    switchPreference.setChecked(gcmMgr.isScreenTurnedOn());
                } else {
                    switchPreference.setEnabled((null != rules) && isConnected);
                    switchPreference.setChecked(preferences.getBoolean(resourceText, false));
                }
            }
        }
    }
}
 
开发者ID:vector-im,项目名称:riot-android,代码行数:54,代码来源:VectorSettingsPreferencesFragment.java


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