@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
if(data != null) {
switch (requestCode) {
case FILESOURCE_RESULT_CODE:
Uri uri = data.getData();
if (uri != null) {
String filepath = FileUtils.getPath(getActivity(), uri);
if(filepath != null) {
((EditTextPreference) findPreference(getString(R.string.pref_filesource_file))).setText(filepath);
updateFileSourcePrefs();
}
else {
Toast.makeText(SettingsFragment.this.getActivity(), "Can't resolve file path from: " + uri.toString(), Toast.LENGTH_LONG).show();
}
}
break;
default:
}
}
super.onActivityResult(requestCode, resultCode, data);
}
java类android.preference.EditTextPreference的实例源码
SettingsFragment.java 文件源码
项目:AndroidSdrRtlTuner
阅读 26
收藏 0
点赞 0
评论 0
ServerSettingsFragment.java 文件源码
项目:ultrasonic
阅读 25
收藏 0
点赞 0
评论 0
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
serverNamePref = (EditTextPreference) findPreference(getString(R.string.settings_server_name));
serverUrlPref = (EditTextPreference) findPreference(getString(R.string.settings_server_address));
serverUsernamePref = (EditTextPreference) findPreference(getString(R.string.settings_server_username));
serverPasswordPref = (EditTextPreference) findPreference(getString(R.string.settings_server_password));
equalizerPref = (CheckBoxPreference) findPreference(getString(R.string.equalizer_enabled));
jukeboxPref = (CheckBoxPreference) findPreference(getString(R.string.jukebox_is_default));
removeServerPref = findPreference(getString(R.string.settings_server_remove_server));
testConnectionPref = findPreference(getString(R.string.settings_test_connection_title));
allowSelfSignedCertificatePref = (CheckBoxPreference) findPreference(
getString(R.string.settings_allow_self_signed_certificate));
setupPreferencesValues();
setupPreferencesListeners();
}
SettingActivity.java 文件源码
项目:AndroidSDK2.0
阅读 61
收藏 0
点赞 0
评论 0
@Override
protected void onCreate( Bundle savedInstanceState )
{
super.onCreate( savedInstanceState );
penClient = PenClientCtrl.getInstance( getApplicationContext() );
if(penClient.getProtocolVersion() == 1)
addPreferencesFromResource( R.xml.pref_settings );
else
addPreferencesFromResource( R.xml.pref_settings2 );
mPasswordPref = (EditTextPreference) getPreferenceScreen().findPreference( Const.Setting.KEY_PASSWORD );
EditText myEditText = (EditText) mPasswordPref.getEditText();
myEditText.setKeyListener( DigitsKeyListener.getInstance( false, true ) );
}
PreferencesUtil.java 文件源码
项目:text_converter
阅读 28
收藏 0
点赞 0
评论 0
@Override
public boolean onPreferenceChange(Preference preference, Object value) {
String stringValue = value.toString();
if (preference instanceof ListPreference) {
// For list preferences, look up the correct display value in
// the preference's 'entries' list.
ListPreference listPreference = (ListPreference) preference;
int index = listPreference.findIndexOfValue(stringValue);
// Set the summary to reflect the new value.
preference.setSummary(index >= 0 ? listPreference.getEntries()[index] : null);
} else if (preference instanceof RingtonePreference) {
} else if (preference instanceof EditTextPreference) {
EditTextPreference editTextPreference = (EditTextPreference) preference;
editTextPreference.setSummary(editTextPreference.getText());
} else {
// For all other preferences, set the summary to the value's
// simple string representation.
preference.setSummary(stringValue);
}
return true;
}
ServerPreferencesScreen.java 文件源码
项目:bananapeel
阅读 23
收藏 0
点赞 0
评论 0
private void setKeys(PreferenceScreen screen)
{
for(int i = 0; i < screen.getPreferenceCount(); i++)
{
Preference preference = screen.getPreference(i);
String key = server + ";" + preference.getKey();
preference.setKey(key);
if(preference instanceof EditIntPreference)
((EditIntPreference)preference).setInt(preference.getSharedPreferences().getInt(key, -1));
else if(preference instanceof EditTextPreference)
((EditTextPreference)preference).setText(preference.getSharedPreferences().getString(key, null));
else if(preference instanceof ListPreference)
((ListPreference)preference).setValue(preference.getSharedPreferences().getString(key, null));
else if(preference instanceof CheckBoxPreference)
((CheckBoxPreference)preference).setChecked(preference.getSharedPreferences().getBoolean(key, false));
if(preference instanceof PreferenceScreen)
setKeys((PreferenceScreen)preference);
}
}
SettingsActivity.java 文件源码
项目:MovieGuide
阅读 25
收藏 0
点赞 0
评论 0
/**
* Binds a preference's summary to its value. More specifically, when the
* preference's value is changed, its summary (line of text below the
* preference title) is updated to reflect the value. The summary is also
* immediately updated upon calling this method. The exact display format is
* dependent on the type of preference.
*
* @see #sBindPreferenceSummaryToValueListener
*/
private static void bindPreferenceSummaryToValue(Preference preference) {
// Set the listener to watch for value changes.
preference.setOnPreferenceChangeListener(sBindPreferenceSummaryToValueListener);
// Trigger the listener immediately with the preference' current value.
if (preference instanceof ListPreference
|| preference instanceof EditTextPreference) {
sBindPreferenceSummaryToValueListener.onPreferenceChange(preference,
PreferenceManager
.getDefaultSharedPreferences(preference.getContext())
.getString(preference.getKey(), ""));
} else if (preference instanceof SwitchPreference
|| preference instanceof CheckBoxPreference) {
sBindPreferenceSummaryToValueListener.onPreferenceChange(preference,
PreferenceManager
.getDefaultSharedPreferences(preference.getContext())
.getBoolean(preference.getKey(),true));
}
}
AttackSettingFragment.java 文件源码
项目:SmingZZick_App
阅读 17
收藏 0
点赞 0
评论 0
@Override
public boolean onPreferenceChange(android.preference.Preference preference, Object newValue) {
if (preference instanceof EditTextPreference) {
String value = (String) newValue;
if (TextUtils.isEmpty(value) == false) {
preference.setSummary(value);
} else {
preference.setSummary("없음");
}
}
handler.post(new Runnable() {
@Override
public void run() {
AttackSetting.getInstance().refresh();
}
});
return true;
}
PreferencesUtil.java 文件源码
项目:javaide
阅读 23
收藏 0
点赞 0
评论 0
@Override
public boolean onPreferenceChange(Preference preference, Object value) {
String stringValue = value.toString();
if (preference instanceof ListPreference) {
// For list preferences, look up the correct display value in
// the preference's 'entries' list.
ListPreference listPreference = (ListPreference) preference;
int index = listPreference.findIndexOfValue(stringValue);
// Set the summary to reflect the new value.
preference.setSummary(index >= 0 ? listPreference.getEntries()[index] : null);
} else if (preference instanceof RingtonePreference) {
} else if (preference instanceof EditTextPreference) {
EditTextPreference editTextPreference = (EditTextPreference) preference;
editTextPreference.setSummary(editTextPreference.getText());
} else {
// For all other preferences, set the summary to the value's
// simple string representation.
preference.setSummary(stringValue);
}
return true;
}
PreferencesActivity.java 文件源码
项目:android-mrz-reader
阅读 31
收藏 0
点赞 0
评论 0
/**
* Set the default preference values.
*
* @param savedInstanceState the current Activity's state, as passed by
* Android
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.preferences);
sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
listPreferenceSourceLanguage = (ListPreference) getPreferenceScreen().findPreference(KEY_SOURCE_LANGUAGE_PREFERENCE);
listPreferenceTargetLanguage = (ListPreference) getPreferenceScreen().findPreference(KEY_TARGET_LANGUAGE_PREFERENCE);
listPreferenceTranslator = (ListPreference) getPreferenceScreen().findPreference(KEY_TRANSLATOR);
listPreferenceOcrEngineMode = (ListPreference) getPreferenceScreen().findPreference(KEY_OCR_ENGINE_MODE);
editTextPreferenceCharacterBlacklist = (EditTextPreference) getPreferenceScreen().findPreference(KEY_CHARACTER_BLACKLIST);
editTextPreferenceCharacterWhitelist = (EditTextPreference) getPreferenceScreen().findPreference(KEY_CHARACTER_WHITELIST);
listPreferencePageSegmentationMode = (ListPreference) getPreferenceScreen().findPreference(KEY_PAGE_SEGMENTATION_MODE);
// Create the entries/entryvalues for the translation target language list.
initTranslationTargetList();
}
FragmentPreferences.java 文件源码
项目:GcmForMojo
阅读 17
收藏 0
点赞 0
评论 0
public PrefListener(String key) {
super();
Preference preference = findPreference(key);
format = preference.getSummary().toString();
if (EditTextPreference.class.isInstance(preference)) {
// EditText
EditTextPreference etp = (EditTextPreference) preference;
onPreferenceChange(preference, etp.getText());
} else if (ListPreference.class.isInstance(preference)) {
// List 切换推送通道 注册及关闭Miui和华为推送
ListPreference lp = (ListPreference) preference;
onPreferenceChange(preference, lp.getEntry());
} else {
Log.e("GcmForMojoSetting", "不支持的Preference类型");
}
preference.setOnPreferenceChangeListener(this);
}
SettingsActivity.java 文件源码
项目:RepWifiApp
阅读 24
收藏 0
点赞 0
评论 0
private void setValidationListener(String prefName) {
EditTextPreference edit_Pref = (EditTextPreference) getPreferenceScreen()
.findPreference(prefName);
edit_Pref.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
// put validation here..
if (((String) newValue).isEmpty()
|| InetAddressUtils.isIPv4Address((String) newValue)) {
return true;
} else {
Commons.showMessage("ERROR:\nWrong IP format!", getActivity());
return false;
}
}
});
}
SettingsFragment.java 文件源码
项目:okwallet
阅读 27
收藏 0
点赞 0
评论 0
@Override
public void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.preference_settings);
backgroundThread = new HandlerThread("backgroundThread", Process.THREAD_PRIORITY_BACKGROUND);
backgroundThread.start();
backgroundHandler = new Handler(backgroundThread.getLooper());
btcPrecisionPreference = findPreference(Configuration.PREFS_KEY_BTC_PRECISION);
btcPrecisionPreference.setOnPreferenceChangeListener(this);
trustedPeerPreference = findPreference(Configuration.PREFS_KEY_TRUSTED_PEER);
((EditTextPreference) trustedPeerPreference).getEditText().setSingleLine();
trustedPeerPreference.setOnPreferenceChangeListener(this);
trustedPeerOnlyPreference = findPreference(Configuration.PREFS_KEY_TRUSTED_PEER_ONLY);
trustedPeerOnlyPreference.setOnPreferenceChangeListener(this);
final Preference dataUsagePreference = findPreference(Configuration.PREFS_KEY_DATA_USAGE);
dataUsagePreference.setEnabled(pm.resolveActivity(dataUsagePreference.getIntent(), 0) != null);
updateTrustedPeer();
}
SettingsFragment.java 文件源码
项目:diary
阅读 26
收藏 0
点赞 0
评论 0
@Override
public void onSharedPreferenceChanged(SharedPreferences preferences,
String key)
{
if (key.equals(Diary.PREF_FOLDER))
{
// Get folder summary
EditTextPreference folder =
(EditTextPreference) findPreference(key);
// Set folder in text view
folder.setSummary(preferences.getString(key, Diary.DIARY));
}
if (key.equals(Diary.PREF_DARK_THEME))
{
if (Build.VERSION.SDK_INT != VERSION_M)
getActivity().recreate();
}
}
TtsSettings.java 文件源码
项目:KotlinStudy
阅读 20
收藏 0
点赞 0
评论 0
@SuppressWarnings("deprecation")
@Override
public void onCreate(Bundle savedInstanceState) {
requestWindowFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
// 指定保存文件名字
getPreferenceManager().setSharedPreferencesName(PREFER_NAME);
addPreferencesFromResource(R.xml.tts_setting);
mSpeedPreference = (EditTextPreference)findPreference("speed_preference");
mSpeedPreference.getEditText().addTextChangedListener(new SettingTextWatcher(TtsSettings.this,mSpeedPreference,0,200));
mPitchPreference = (EditTextPreference)findPreference("pitch_preference");
mPitchPreference.getEditText().addTextChangedListener(new SettingTextWatcher(TtsSettings.this,mPitchPreference,0,100));
mVolumePreference = (EditTextPreference)findPreference("volume_preference");
mVolumePreference.getEditText().addTextChangedListener(new SettingTextWatcher(TtsSettings.this,mVolumePreference,0,100));
}
ReportPreferencesActivity.java 文件源码
项目:financisto1-holo
阅读 17
收藏 0
点赞 0
评论 0
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.report_preferences);
getCurrenciesList();
final EditTextPreference pReportReferenceCurrency = (EditTextPreference)getPreferenceScreen().findPreference("report_reference_currency");
pReportReferenceCurrency.setOnPreferenceClickListener(
new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference arg0) {
return showChoiceList(pReportReferenceCurrency);
}
}
);
}
SettingsActivity.java 文件源码
项目:android-udacity-reviews
阅读 28
收藏 0
点赞 0
评论 0
private void updatePreference(String key, String newValue){
if (key.equals(API_KEY)){
Preference preference = findPreference(key);
if (preference instanceof EditTextPreference){
EditTextPreference editTextPreference = (EditTextPreference) preference;
PreferencesHelper preferencesHelper = new PreferencesHelper(getApplicationContext());
preferencesHelper.save(API_KEY, newValue);
if (newValue != null ){
editTextPreference.setText(newValue);
editTextPreference.setSummary(newValue);
}else{
editTextPreference.setText("");
editTextPreference.setSummary("");
}
}
}
}
FragmentoConfiguracion.java 文件源码
项目:LazarilloApp
阅读 20
收藏 0
点赞 0
评论 0
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//Asigna el layout de la preferencias definido en el xml al fragment
addPreferencesFromResource(R.xml.configuraciones);
Preference dir_casa = findPreference("dir_casa");
Preference alto_contraste = findPreference("alto_contraste");
Preference reset = findPreference("reset");
dir_casa.setOnPreferenceChangeListener(this);
alto_contraste.setOnPreferenceChangeListener(this);
reset.setOnPreferenceClickListener(this);
//restaurar valor del sumary
dir_casa.setSummary(((EditTextPreference) dir_casa).getText());
}
PreferencesActivity.java 文件源码
项目:android-ocr-demo
阅读 35
收藏 0
点赞 0
评论 0
/**
* Set the default preference values.
*
* @param Bundle savedInstanceState the current Activity's state, as passed by
* Android
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.preferences);
sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
listPreferenceSourceLanguage = (ListPreference) getPreferenceScreen().findPreference(KEY_SOURCE_LANGUAGE_PREFERENCE);
listPreferenceTargetLanguage = (ListPreference) getPreferenceScreen().findPreference(KEY_TARGET_LANGUAGE_PREFERENCE);
listPreferenceTranslator = (ListPreference) getPreferenceScreen().findPreference(KEY_TRANSLATOR);
listPreferenceOcrEngineMode = (ListPreference) getPreferenceScreen().findPreference(KEY_OCR_ENGINE_MODE);
editTextPreferenceCharacterBlacklist = (EditTextPreference) getPreferenceScreen().findPreference(KEY_CHARACTER_BLACKLIST);
editTextPreferenceCharacterWhitelist = (EditTextPreference) getPreferenceScreen().findPreference(KEY_CHARACTER_WHITELIST);
listPreferencePageSegmentationMode = (ListPreference) getPreferenceScreen().findPreference(KEY_PAGE_SEGMENTATION_MODE);
// Create the entries/entryvalues for the translation target language list.
initTranslationTargetList();
}
PreferencesFragment.java 文件源码
项目:RemindrApp-Android
阅读 29
收藏 0
点赞 0
评论 0
@Override
public void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
//Construct the preferences screen form XML config
addPreferencesFromResource(R.xml.task_preferences);
//Use the number keyboard when editing the time preference
EditTextPreference timeDefault = (EditTextPreference)findPreference(getString(R.string.pref_default_time_from_now_key));
timeDefault.getEditText().setKeyListener(DigitsKeyListener.getInstance());
findPreference(this.getString(R.string.title_instructions)).setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
Intent intent = new Intent(getActivity(), IntroActivity.class);
startActivity(intent);
return false;
}
});
}
PreferencesActivity.java 文件源码
项目:nubo-test
阅读 28
收藏 0
点赞 0
评论 0
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.preferences);
/*
this.mSharedPreferences = getSharedPreferences(Constants.SHARED_PREFS, MODE_PRIVATE);
SharedPreferences.Editor edit = mSharedPreferences.edit();
edit.remove(Constants.SERVER_NAME);
edit.apply();
*/
EditTextPreference pref = (EditTextPreference)findPreference(Constants.SERVER_NAME);
pref.getEditText().setInputType(InputType.TYPE_CLASS_TEXT);
}
SettingsActivity.java 文件源码
项目:MovieGuide
阅读 24
收藏 0
点赞 0
评论 0
/**
* Binds a preference's summary to its value. More specifically, when the
* preference's value is changed, its summary (line of text below the
* preference title) is updated to reflect the value. The summary is also
* immediately updated upon calling this method. The exact display format is
* dependent on the type of preference.
*
* @see #sBindPreferenceSummaryToValueListener
*/
private static void bindPreferenceSummaryToValue(Preference preference) {
// Set the listener to watch for value changes.
preference.setOnPreferenceChangeListener(sBindPreferenceSummaryToValueListener);
// Trigger the listener immediately with the preference' current value.
if (preference instanceof ListPreference
|| preference instanceof EditTextPreference) {
sBindPreferenceSummaryToValueListener.onPreferenceChange(preference,
PreferenceManager
.getDefaultSharedPreferences(preference.getContext())
.getString(preference.getKey(), ""));
} else if (preference instanceof SwitchPreference
|| preference instanceof CheckBoxPreference) {
sBindPreferenceSummaryToValueListener.onPreferenceChange(preference,
PreferenceManager
.getDefaultSharedPreferences(preference.getContext())
.getBoolean(preference.getKey(),true));
}
}
SettingsActivity.java 文件源码
项目:AlarmController
阅读 23
收藏 0
点赞 0
评论 0
@Override
public void onActivityResult(int requestCode, int resultCode, Intent audioReturnedIntent) {
super.onActivityResult(requestCode, resultCode, audioReturnedIntent);
if (resultCode == RESULT_OK) {
Uri selectedAudio = audioReturnedIntent.getData();
Log.d(TAG, "Announcement selected: " + selectedAudio.toString());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
getActivity().grantUriPermission(
getActivity().getPackageName(),
selectedAudio,
Intent.FLAG_GRANT_READ_URI_PERMISSION);
int takeFlags = audioReturnedIntent.getFlags() & (Intent.FLAG_GRANT_READ_URI_PERMISSION);
getActivity().getContentResolver().takePersistableUriPermission(selectedAudio, takeFlags);
}
EditTextPreference announcementPrefs = (EditTextPreference)findPreference("announcement_file");
announcementPrefs.setText(selectedAudio.toString());
announcementPrefs.setSummary(selectedAudio.toString());
}
}
SettingsActivity.java 文件源码
项目:nitroshare-android
阅读 28
收藏 0
点赞 0
评论 0
/**
* Create an EditTextPreference for the specified preference
* @param titleResId resource ID to use for the title
* @param key preference key
* @return newly created preference
*/
private EditTextPreference createEditTextPreference(@StringRes int titleResId, Settings.Key key) {
final EditTextPreference editTextPreference = new EditTextPreference(getActivity());
editTextPreference.setDefaultValue(mSettings.getDefault(key));
editTextPreference.setKey(key.name());
editTextPreference.setSummary(mSettings.getString(key));
editTextPreference.setTitle(titleResId);
editTextPreference.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
editTextPreference.setSummary((String) newValue);
return true;
}
});
return editTextPreference;
}
ConnectionPrefsFragment.java 文件源码
项目:Xpra-client-android
阅读 53
收藏 0
点赞 0
评论 0
protected void setSshPreferencesEnabled(boolean enabled) {
final EditTextPreference portPref = (EditTextPreference) findPreference(PREF_PORT);
if(enabled) {
if("10000".equals(portPref.getText())) {
portPref.setText("22");
PreferenceHelper.callChangeListener(portPref, portPref.getText());
}
} else {
if("22".equals(portPref.getText())) {
portPref.setText("10000");
PreferenceHelper.callChangeListener(portPref, portPref.getText());
}
}
findPreference(PREF_USERNAME).setEnabled(enabled);
findPreference(PREF_PRIVATE_KEY).setEnabled(enabled);
}
MapSettingsActivity.java 文件源码
项目:mytracks
阅读 17
收藏 0
点赞 0
评论 0
@SuppressWarnings("deprecation")
@Override
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
addPreferencesFromResource(R.xml.map_settings);
slowPreference = (EditTextPreference) findPreference(
getString(R.string.settings_map_slow_display_key));
mediumPreference = (EditTextPreference) findPreference(
getString(R.string.settings_map_medium_display_key));
percentagePreference = (EditTextPreference) findPreference(
getString(R.string.settings_map_percentage_display_key));
configTrackColorModePerference();
configSpeedPreference(slowPreference, R.string.track_color_mode_slow_key,
PreferencesUtils.TRACK_COLOR_MODE_SLOW_DEFAULT);
configSpeedPreference(mediumPreference, R.string.track_color_mode_medium_key,
PreferencesUtils.TRACK_COLOR_MODE_MEDIUM_DEFAULT);
configPercentagePreference();
updateSpeedSummary(slowPreference, R.string.track_color_mode_slow_key,
PreferencesUtils.TRACK_COLOR_MODE_SLOW_DEFAULT);
updateSpeedSummary(mediumPreference, R.string.track_color_mode_medium_key,
PreferencesUtils.TRACK_COLOR_MODE_MEDIUM_DEFAULT);
updatePercentageSummary();
}
MapSettingsActivity.java 文件源码
项目:mytracks
阅读 23
收藏 0
点赞 0
评论 0
/**
* Configures the IME action done.
*
* @param editTextPreference the edit text preference
*/
private void configImeActionDone(final EditTextPreference editTextPreference) {
editTextPreference.getEditText()
.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_DONE) {
Dialog dialog = editTextPreference.getDialog();
editTextPreference.onClick(dialog, Dialog.BUTTON_POSITIVE);
dialog.dismiss();
return true;
}
return false;
}
});
}
SettingsFragment.java 文件源码
项目:fissure-android
阅读 25
收藏 0
点赞 0
评论 0
@Override
public void onCreate(Bundle savedInstanceState) {
//getDelegate().installViewFactory();
//getDelegate().onCreate(savedInstanceState);
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.settings);
//mCheckBox = (CheckBoxPreference) findPreference("pref_repeat");
mEditText = (EditTextPreference) findPreference("pre_default_title");
mNumberPicker = (NumberPickerPreference) findPreference("pref_compression");
// TODO: Set Programmatically
String vName = BuildConfig.VERSION_NAME;
mVersion = findPreference("pref_static_field_key0");
mVersion.setSummary("Fissure "+ vName);
}
PreferencesActivity.java 文件源码
项目:AndroidAPS
阅读 34
收藏 0
点赞 0
评论 0
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));
}
}
}
SettingsActivity.java 文件源码
项目:cameraserve
阅读 26
收藏 0
点赞 0
评论 0
private void updateSummaries() {
EditTextPreference portPref = (EditTextPreference) findPreference("port");
portPref.setSummary(portPref.getText() + " (on " + getIp() + ")");
ListPreference camPref = (ListPreference) findPreference("cam");
camPref.setSummary("Cam " + (Integer.parseInt(camPref.getValue()) + 1));
ListPreference resPref = (ListPreference) findPreference("resolution");
resPref.setSummary(resPref.getValue().replace("x", " x "));
ListPreference rotPref = (ListPreference) findPreference("rotation");
rotPref.setSummary(rotPref.getEntry());
EditTextPreference idPref = (EditTextPreference) findPreference("ssdp_id");
idPref.setSummary(idPref.getText());
EditTextPreference versionPref = (EditTextPreference) findPreference("app_version");
versionPref.setSummary(BuildConfig.VERSION_NAME);
}
GlobalSettingsActivity.java 文件源码
项目:Hupl
阅读 19
收藏 0
点赞 0
评论 0
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_global_settings);
addPreferencesFromResource(R.xml.global_settings);
List<Preference> prefs = getPreferenceList(getPreferenceScreen(), new LinkedList<Preference>());
for (Preference p : prefs)
{
if (p instanceof EditTextPreference)
{
String val = ((EditTextPreference)p).getText();
p.setSummary(val);
}
p.setOnPreferenceChangeListener(this);
}
}