comparison src/com/five_ten_sg/connectbot/HostEditorActivity.java @ 308:42b15aaa7ac7 ganymed

merge
author Carl Byington <carl@five-ten-sg.com>
date Wed, 30 Jul 2014 14:21:50 -0700
parents 071eccdff8ea
children
comparison
equal deleted inserted replaced
306:90e47d99ea54 308:42b15aaa7ac7
321 321
322 private void getSummaries() { 322 private void getSummaries() {
323 // get all the original text summaries 323 // get all the original text summaries
324 for (String key : this.pref.values.keySet()) { 324 for (String key : this.pref.values.keySet()) {
325 Preference pref = this.findPreference(key); 325 Preference pref = this.findPreference(key);
326
326 if (pref == null) continue; 327 if (pref == null) continue;
328
327 if (pref instanceof CheckBoxPreference) continue; 329 if (pref instanceof CheckBoxPreference) continue;
330
328 CharSequence value = pref.getSummary(); 331 CharSequence value = pref.getSummary();
329 summaries.put(key, value); 332 summaries.put(key, value);
330 } 333 }
331 } 334 }
332 335
333 private void updateSummaries() { 336 private void updateSummaries() {
334 // for all text preferences, set hint as current database value if it is non-empty 337 // for all text preferences, set hint as current database value if it is non-empty
335 for (String key : this.pref.values.keySet()) { 338 for (String key : this.pref.values.keySet()) {
336 Preference pref = this.findPreference(key); 339 Preference pref = this.findPreference(key);
340
337 if (pref == null) continue; 341 if (pref == null) continue;
342
338 if (pref instanceof CheckBoxPreference) continue; 343 if (pref instanceof CheckBoxPreference) continue;
344
339 CharSequence value = this.pref.getString(key, ""); 345 CharSequence value = this.pref.getString(key, "");
340 346
341 if (key.equals(HostDatabase.FIELD_HOST_PUBKEYID)) { 347 if (key.equals(HostDatabase.FIELD_HOST_PUBKEYID)) {
342 try { 348 try {
343 int pubkeyId = Integer.parseInt(value.toString()); 349 int pubkeyId = Integer.parseInt(value.toString());
356 } 362 }
357 } 363 }
358 else if ((pref instanceof ListPreference) && (value != null)) { 364 else if ((pref instanceof ListPreference) && (value != null)) {
359 ListPreference listPref = (ListPreference) pref; 365 ListPreference listPref = (ListPreference) pref;
360 int entryIndex = listPref.findIndexOfValue(value.toString()); 366 int entryIndex = listPref.findIndexOfValue(value.toString());
367
361 if (entryIndex >= 0) value = listPref.getEntries()[entryIndex]; 368 if (entryIndex >= 0) value = listPref.getEntries()[entryIndex];
362 } 369 }
363 370
364 if ((value == null) || (value.length() == 0)) value = summaries.get(key); 371 if ((value == null) || (value.length() == 0)) value = summaries.get(key);
372
365 pref.setSummary(value); 373 pref.setSummary(value);
366 } 374 }
367 } 375 }
368 376
369 private void initCharsetPref(final ListPreference charsetPref) { 377 private void initCharsetPref(final ListPreference charsetPref) {