android.preference.EditTextPreference#getText ( )源码实例Demo

下面列出了android.preference.EditTextPreference#getText ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: AndroidAPS   文件: PreferencesActivity.java
private static void updatePrefSummary(Preference pref) {
    if (pref instanceof ListPreference) {
        ListPreference listPref = (ListPreference) pref;
        pref.setSummary(listPref.getEntry());
    }
    if (pref instanceof EditTextPreference) {
        EditTextPreference editTextPref = (EditTextPreference) pref;
        if (pref.getKey().contains("password") || pref.getKey().contains("secret")) {
            pref.setSummary("******");
        } else if (editTextPref.getText() != null) {
            ((EditTextPreference) pref).setDialogMessage(editTextPref.getDialogMessage());
            pref.setSummary(editTextPref.getText());
        } else {
            for (PluginBase plugin : MainApp.getPluginsList()) {
                plugin.updatePreferenceSummary(pref);
            }
        }
    }
    if (pref != null)
        adjustUnitDependentPrefs(pref);
}
 
源代码2 项目: document-viewer   文件: PreferencesDecorator.java
protected void decorateEditPreference(final EditTextPreference textPrefs) {
    final CharSequence summary = textPrefs.getSummary();
    summaries.put(textPrefs.getKey(), summary);

    final String value = textPrefs.getText();

    setPreferenceSummary(textPrefs, value);

    addListener(textPrefs, new OnPreferenceChangeListener() {

        @Override
        public boolean onPreferenceChange(final Preference preference, final Object newValue) {
            setPreferenceSummary(textPrefs, (String) newValue);
            return true;
        }
    });
}
 
源代码3 项目: trigger   文件: SetupActivity.java
private String getText(String key) {
    Preference p = findAnyPreference(key, null);
    if (p instanceof EditTextPreference) {
        EditTextPreference etp = (EditTextPreference) p;
        return etp.getText();
    } else if (p instanceof ListPreference) {
        ListPreference lp = (ListPreference) p;
        return lp.getValue();
    } else {
        Log.w("SetupActivity.setText", "Cannot find EditTextPreference/ListPreference in PreferenceGroup with key: " + key);
        return "";
    }
}
 
源代码4 项目: CSipSimple   文件: BaseImplementation.java
protected boolean isEmpty(EditTextPreference edt){
	if(edt.getText() == null){
		return true;
	}
	if(edt.getText().equals("")){
		return true;
	}
	return false;
}
 
源代码5 项目: SkyTube   文件: OthersPreferenceFragment.java
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
	if(key != null) {
		if (key.equals(getString(R.string.pref_key_default_tab_name))) {
			// If the user changed the Default Tab Preference, update the summary to show the new default tab
			ListPreference defaultTabPref = (ListPreference) findPreference(key);
			defaultTabPref.setSummary(String.format(getString(R.string.pref_summary_default_tab), defaultTabPref.getEntry()));
		} else if (key.equals(getString(R.string.pref_key_hide_tabs))) {
			displayRestartDialog(R.string.pref_hide_tabs_restart, true);
		} else if (key.equals(getString(R.string.pref_youtube_api_key))) {
			// Validate the entered API Key when saved (and not empty), with a simple call to get the most popular video
			EditTextPreference    youtubeAPIKeyPref = (EditTextPreference) findPreference(getString(R.string.pref_youtube_api_key));
			String                youtubeAPIKey     = youtubeAPIKeyPref.getText();

			if (youtubeAPIKey != null) {
				youtubeAPIKey = youtubeAPIKey.trim();

				if (!youtubeAPIKey.isEmpty()) {
					// validate the user's API key
					new ValidateYouTubeAPIKeyTask(youtubeAPIKey).executeInParallel();
				}
				else {
					// inform the user that we are going to use the default YouTube API key and
					// that we need to restart the app
					displayRestartDialog(R.string.pref_youtube_api_key_default,false);
				}
			}
		} else if (key.equals(getString(R.string.pref_key_subscriptions_alphabetical_order))) {
			SubsAdapter subsAdapter = SubsAdapter.get(getActivity());
			subsAdapter.refreshSubsList();
		}/*else if (key.equals(getString(R.string.pref_feed_notification_key))) {
			ListPreference feedNotificationPref = (ListPreference) findPreference(key);
			feedNotificationPref.setSummary(String.format(getString(R.string.pref_summary_feed_notification), feedNotificationPref.getEntry()));

			int interval = Integer.parseInt(feedNotificationPref.getValue());

			SkyTubeApp.setFeedUpdateInterval(interval);
		}*/
	}
}
 
源代码6 项目: AnkiDroid-Wear   文件: SettingsActivity.java
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    addPreferencesFromResource(R.xml.activity_settings);

    NumberPickerPreference fontSizeNumberPicker = (NumberPickerPreference) this.findPreference(getResources().getString(R.string.font_size_key));
    NumberPickerPreference screenTimeoutNumberPicker = (NumberPickerPreference) this.findPreference(getResources().getString(R.string.screen_timeout));
    EditTextPreference mediaLocationDir = (EditTextPreference) this.findPreference(getResources().getString(R.string.media_folder_location));
    if (mediaLocationDir.getText() == null || mediaLocationDir.getText().isEmpty()) {
        mediaLocationDir.setText(Environment.getExternalStorageDirectory() + "/AnkiDroid/collection.media");
    }
    CardMedia.mediaFolder = mediaLocationDir.getText();

    SendToWatchWhenPreferencesChangeListener listener = new SendToWatchWhenPreferencesChangeListener();
    fontSizeNumberPicker.setOnPreferenceChangeListener(listener);
    screenTimeoutNumberPicker.setOnPreferenceChangeListener(listener);
    this.findPreference(getResources().getString(R.string.card_flip_animation_key)).setOnPreferenceChangeListener(listener);
    this.findPreference(getResources().getString(R.string.double_tap_key)).setOnPreferenceChangeListener(listener);
    this.findPreference(getResources().getString(R.string.play_sounds)).setOnPreferenceChangeListener(listener);
    this.findPreference(getResources().getString(R.string.ask_before_first_sound)).setOnPreferenceChangeListener(listener);
    this.findPreference(getResources().getString(R.string.day_mode)).setOnPreferenceChangeListener(listener);
    this.findPreference(getResources().getString(R.string.ambient_mode_key))
            .setOnPreferenceChangeListener(listener);
    mediaLocationDir.setOnPreferenceChangeListener(listener);

}
 
源代码7 项目: Dashchan   文件: ChanFragment.java
private void updateDefaultBoardSummary() {
	EditTextPreference preference = defaultBoardPreference;
	String text = preference.getText();
	if (!StringUtils.isEmpty(text)) {
		String boardName = StringUtils.validateBoardName(text);
		if (boardName != null) {
			text = StringUtils.formatBoardTitle(chanName, boardName,
					ChanConfiguration.get(chanName).getBoardTitle(boardName));
		} else {
			text = null;
		}
	}
	preference.setSummary(text);
}
 
源代码8 项目: Dashchan   文件: BasePreferenceFragment.java
private void updateEditTextSummary(EditTextPreference preference) {
	String text = preference.getText();
	if (StringUtils.isEmpty(text)) {
		CharSequence hint = preference.getEditText().getHint();
		text = hint != null ? hint.toString() : null;
	}
	preference.setSummary(text);
}
 
源代码9 项目: android-app   文件: SettingsActivity.java
private void setPasswordSummary(String key) {
    EditTextPreference preference = (EditTextPreference)findPreference(key);
    if(preference != null) {
        String value = preference.getText();
        preference.setSummary(value == null || value.isEmpty() ? "" : "********");
    }
}
 
源代码10 项目: physical-web   文件: SettingsFragment.java
private void updatePwsPreference() {
  ListPreference listPreference = (ListPreference) findPreference(
      getString(R.string.pws_endpoint_setting_key));
  String entry = (String) listPreference.getEntry();
  if (entry == null) {
    return;
  }

  if (entry.equals(getString(R.string.custom_pws))) {
    // User selected custom PWS therefore need to update it accordingly
    EditTextPreference customPwsUrlPreference =
        (EditTextPreference) mCustomEndpointCategory.findPreference(
            getString(R.string.custom_pws_url_key));
    ListPreference customPwsVersionPreference =
        (ListPreference) mCustomEndpointCategory.findPreference(
            getString(R.string.custom_pws_version_key));
    EditTextPreference customPwsApiKeyPreference =
        (EditTextPreference) mCustomEndpointCategory.findPreference(
            getString(R.string.custom_pws_api_key_key));
    String customPwsUrl = customPwsUrlPreference.getText();
    int customPwsVersion = Integer.parseInt(customPwsVersionPreference.getValue());
    String customPwsApiKey = customPwsApiKeyPreference.getText();
    customPwsUrl = customPwsUrl == null ? "" : customPwsUrl;
    customPwsApiKey = customPwsApiKey == null ? "" : customPwsApiKey;
    listPreference.setValue(Utils.formatEndpointForSharedPrefernces(customPwsUrl,
        customPwsVersion, customPwsApiKey));
    getPreferenceScreen().addPreference(mCustomEndpointCategory);
  } else {
    getPreferenceScreen().removePreference(mCustomEndpointCategory);
  }
}
 
源代码11 项目: boilr   文件: PriceHitAlarmSettingsFragment.java
@Override
protected void updateDependentOnPair() {
	super.updateDependentOnPair();
	EditTextPreference[] edits = { mUpperLimitPref, mLowerLimitPref };
	String text;
	for (EditTextPreference edit : edits) {
		edit.setEnabled(true);
		text = edit.getText();
		if(text != null && !text.equals(""))
			edit.setSummary(text + " " + alarm.getPair().getExchange());
	}
}
 
源代码12 项目: CSipSimple   文件: BaseImplementation.java
protected boolean isMatching(EditTextPreference edt, String regex) {
	if(edt.getText() == null){
		return false;
	}
	return Pattern.matches(regex, edt.getText());
}
 
源代码13 项目: CSipSimple   文件: BaseImplementation.java
/**
    * @see EditTextPreference#getText()
    * @param edt
    */
protected String getText(EditTextPreference edt){
	return edt.getText();
}