當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。