当前位置: 首页>>代码示例>>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;未经允许,请勿转载。