當前位置: 首頁>>代碼示例>>Java>>正文


Java EditTextPreference.getText方法代碼示例

本文整理匯總了Java中android.preference.EditTextPreference.getText方法的典型用法代碼示例。如果您正苦於以下問題:Java EditTextPreference.getText方法的具體用法?Java EditTextPreference.getText怎麽用?Java EditTextPreference.getText使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.preference.EditTextPreference的用法示例。


在下文中一共展示了EditTextPreference.getText方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: updatePrefSummary

import android.preference.EditTextPreference; //導入方法依賴的package包/類
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 (pref.getKey().equals(MainApp.sResources.getString(R.string.key_danars_name))) {
            pref.setSummary(SP.getString(R.string.key_danars_name, ""));
        } else if (editTextPref.getText() != null && !editTextPref.getText().equals("")) {
            ((EditTextPreference) pref).setDialogMessage(editTextPref.getDialogMessage());
            pref.setSummary(editTextPref.getText());
        } else if (pref.getKey().contains("smscommunicator_allowednumbers") && TextUtils.isEmpty(editTextPref.getText().trim())) {
            pref.setSummary(MainApp.sResources.getString(R.string.smscommunicator_allowednumbers_summary));
        }
    }
}
 
開發者ID:MilosKozak,項目名稱:AndroidAPS,代碼行數:20,代碼來源:PreferencesActivity.java

示例2: decorateEditPreference

import android.preference.EditTextPreference; //導入方法依賴的package包/類
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;
        }
    });
}
 
開發者ID:Git-tl,項目名稱:appcan-plugin-pdfreader-android,代碼行數:18,代碼來源:PreferencesDecorator.java

示例3: updateFileSourcePrefs

import android.preference.EditTextPreference; //導入方法依賴的package包/類
/**
 * Will try to extract the file source preferences (frequency, sample rate, format) from the filename
 */
public void updateFileSourcePrefs() {
	EditTextPreference etp_filename = 	(EditTextPreference) findPreference(getString(R.string.pref_filesource_file));
	EditTextPreference etp_frequency = 	(EditTextPreference) findPreference(getString(R.string.pref_filesource_frequency));
	EditTextPreference etp_sampleRate = (EditTextPreference) findPreference(getString(R.string.pref_filesource_sampleRate));
	ListPreference lp_format = 			(ListPreference) findPreference(getString(R.string.pref_filesource_format));
	String filename = etp_filename.getText();

	// Format. Search for strings like hackrf, rtl-sdr, ...
	if(filename.matches(".*hackrf.*") || filename.matches(".*HackRF.*") ||
			filename.matches(".*HACKRF.*") || filename.matches(".*hackrfone.*"))
		lp_format.setValue("0");
	if(filename.matches(".*rtlsdr.*") || filename.matches(".*rtl-sdr.*") ||
			filename.matches(".*RTLSDR.*") || filename.matches(".*RTL-SDR.*"))
		lp_format.setValue("1");

	// Sampe Rate. Search for pattern XXXXXXXSps
	if(filename.matches(".*(_|-|\\s)([0-9]+)(sps|Sps|SPS).*"))
		etp_sampleRate.setText(filename.replaceFirst(".*(_|-|\\s)([0-9]+)(sps|Sps|SPS).*", "$2"));
	if(filename.matches(".*(_|-|\\s)([0-9]+)(msps|Msps|MSps|MSPS).*"))
		etp_sampleRate.setText("" + Integer.valueOf(filename.replaceFirst(".*(_|-|\\s)([0-9]+)(msps|Msps|MSps|MSPS).*", "$2")) * 1000000);

	// Frequency. Search for pattern XXXXXXXHz
	if(filename.matches(".*(_|-|\\s)([0-9]+)(hz|Hz|HZ).*"))
		etp_frequency.setText(filename.replaceFirst(".*(_|-|\\s)([0-9]+)(hz|Hz|HZ).*", "$2"));
	if(filename.matches(".*(_|-|\\s)([0-9]+)(mhz|Mhz|MHz|MHZ).*"))
		etp_frequency.setText("" + Integer.valueOf(filename.replaceFirst(".*(_|-|\\s)([0-9]+)(mhz|Mhz|MHz|MHZ).*", "$2")) * 1000000);
}
 
開發者ID:takyonxxx,項目名稱:AndroidSdrRtlTuner,代碼行數:31,代碼來源:SettingsFragment.java

示例4: isEmpty

import android.preference.EditTextPreference; //導入方法依賴的package包/類
protected boolean isEmpty(EditTextPreference edt){
	if(edt.getText() == null){
		return true;
	}
	if(edt.getText().equals("")){
		return true;
	}
	return false;
}
 
開發者ID:treasure-lau,項目名稱:CSipSimple,代碼行數:10,代碼來源:BaseImplementation.java

示例5: onResume

import android.preference.EditTextPreference; //導入方法依賴的package包/類
@Override
protected void onResume(){
    super.onResume();
    EditTextPreference editTextPreference =  (EditTextPreference) getPreferenceScreen().findPreference("api_key");
    String apiKey = editTextPreference.getText();
    getPreferenceScreen().findPreference(API_KEY).setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
        @Override
        public boolean onPreferenceChange(Preference preference, Object newValue) {
            updatePreference(API_KEY, newValue.toString());
            return false;
        }
    });
    updatePreference(API_KEY, apiKey);
}
 
開發者ID:throwrocks,項目名稱:android-udacity-reviews,代碼行數:15,代碼來源:SettingsActivity.java

示例6: updatePassword

import android.preference.EditTextPreference; //導入方法依賴的package包/類
private void updatePassword() {
    EditTextPreference libPassword = (EditTextPreference) findPreference(getString(R.string.pref_library_password));
    if(libPassword != null && libPassword.getText() != null) {
        String passDot = "•";
        int n = libPassword.getText().length();
        String passwordMask = new String(new char[n]).replace("\0", passDot);
        libPassword.setSummary(passwordMask);
    }
}
 
開發者ID:ufrgs,項目名稱:ufrgs-mobile-android,代碼行數:10,代碼來源:MainPreferencesFragment.java

示例7: onSharedPreferenceChanged

import android.preference.EditTextPreference; //導入方法依賴的package包/類
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
    Preference changedPreference = findPreference(key);
    if(changedPreference instanceof  EditTextPreference){
        EditTextPreference textPref = (EditTextPreference) findPreference(key);
        switch(key){
            case "myName":
                if(textPref.getText() != null)
                    textPref.setSummary(getString(R.string.preference_name_summary_set) + textPref.getText());
                else
                    textPref.setSummary(getString(R.string.preference_name_summary_not_set));
                break;
            case "myPhoneNumber":
                if(textPref.getText() != null)
                    textPref.setSummary(getString(R.string.preference_phone_summary_set) + textPref.getText());
                else
                    textPref.setSummary(getString(R.string.preference_phone_summary_not_set));
                break;
            case "contact":
                if(textPref.getText() != null)
                    textPref.setSummary(getString(R.string.preference_emergency_summary_set) + textPref.getText());
                else
                    textPref.setSummary(getString(R.string.preference_emergency_summary_not_set));
                break;
        }
    }

}
 
開發者ID:jagrutkosti,項目名稱:dashit,代碼行數:29,代碼來源:SettingsActivity.java

示例8: populateDiscoverableId

import android.preference.EditTextPreference; //導入方法依賴的package包/類
private void populateDiscoverableId() {
    EditTextPreference idPref = (EditTextPreference) findPreference("ssdp_id");
    String id = idPref.getText();
    if (id == null || id.isEmpty()) {
        id = UUID.randomUUID().toString();
        idPref.setText(id);
    }
}
 
開發者ID:arktronic,項目名稱:cameraserve,代碼行數:9,代碼來源:SettingsActivity.java

示例9: onCreate

import android.preference.EditTextPreference; //導入方法依賴的package包/類
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Load the preferences from an XML resource
    addPreferencesFromResource(R.xml.settings_server);

    credentials_category = (PreferenceCategory) findPreference("pref_key_credentials");

    pref_serverAddress = (EditTextPreference) findPreference("pref_server_address");
    pref_use_guest = (CheckBoxPreference) findPreference("pref_enable_guest");
    pref_username = (EditTextPreference) findPreference("pref_server_username");
    pref_password = (EditTextPreference) findPreference("pref_server_password");

    server_screen = (PreferenceScreen) findPreference("pref_screen_server");

    if (pref_use_guest.isChecked()) {
        server_screen.removePreference(credentials_category);
    }

    String serverAddress = pref_serverAddress.getText();
    String username = pref_username.getText();
    String password = pref_password.getText();

    if (serverAddress != null) {
        pref_serverAddress.setSummary(serverAddress);
    }

    if (username != null) {
        pref_username.setSummary(username);
    }

    if (password != null) {
        EditText edit = pref_password.getEditText();
        String maskedPassword = pref_password.getEditText().getTransformationMethod().getTransformation(password, edit).toString();
        pref_password.setSummary(maskedPassword);
    }
}
 
開發者ID:nullpointerexceptionapps,項目名稱:TeamCityDownloader,代碼行數:39,代碼來源:SettingsFragmentServer.java

示例10: onSharedPreferenceChanged

import android.preference.EditTextPreference; //導入方法依賴的package包/類
@SuppressWarnings("deprecation")
@Override
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
	SharedPreferences.Editor editor = sharedPreferences.edit();
	// update on nickname change
	if(key.equals(Globals.NICKNAME_DATA)){
		EditTextPreference p = (EditTextPreference) findPreference(Globals.NICKNAME_DATA);
		String nickname = p.getText();
		editor.putString(Globals.NICKNAME_DATA, nickname);
		editor.commit();
	}
	
}
 
開發者ID:dks-rub,項目名稱:meshchat,代碼行數:14,代碼來源:SettingsActivity.java

示例11: onCreate

import android.preference.EditTextPreference; //導入方法依賴的package包/類
@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);

}
 
開發者ID:wlky,項目名稱:AnkiDroid-Wear,代碼行數:28,代碼來源:SettingsActivity.java

示例12: updateDefaultBoardSummary

import android.preference.EditTextPreference; //導入方法依賴的package包/類
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);
}
 
開發者ID:Mishiranu,項目名稱:Dashchan,代碼行數:15,代碼來源:ChanFragment.java

示例13: updateEditTextSummary

import android.preference.EditTextPreference; //導入方法依賴的package包/類
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);
}
 
開發者ID:Mishiranu,項目名稱:Dashchan,代碼行數:9,代碼來源:BasePreferenceFragment.java

示例14: isMatching

import android.preference.EditTextPreference; //導入方法依賴的package包/類
protected boolean isMatching(EditTextPreference edt, String regex) {
	if(edt.getText() == null){
		return false;
	}
	return Pattern.matches(regex, edt.getText());
}
 
開發者ID:treasure-lau,項目名稱:CSipSimple,代碼行數:7,代碼來源:BaseImplementation.java

示例15: updateUsername

import android.preference.EditTextPreference; //導入方法依賴的package包/類
private void updateUsername() {
    EditTextPreference libUsername = (EditTextPreference) findPreference(getString(R.string.pref_library_username));
    if(libUsername != null && libUsername.getText() != null) {
        libUsername.setSummary(libUsername.getText());
    }
}
 
開發者ID:ufrgs,項目名稱:ufrgs-mobile-android,代碼行數:7,代碼來源:MainPreferencesFragment.java


注:本文中的android.preference.EditTextPreference.getText方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。