diff options
| author | rsudev <rasch@munin-soft.de> | 2013-10-18 15:02:48 +0200 |
|---|---|---|
| committer | rsudev <rasch@munin-soft.de> | 2013-10-18 15:02:48 +0200 |
| commit | 2a74f5c1f3c11ba217d6b8cb732ddc3ce4610d4b (patch) | |
| tree | 1ab2c052bb0cf5178a98c57846f1f7cccb247ae9 /main/src/cgeo/geocaching/settings/SettingsActivity.java | |
| parent | 65bb33e849dd0f101df801d5e1334fe30ea974b8 (diff) | |
| parent | e6606ad7690c84c9ee03c9195859382e9ae1de6b (diff) | |
| download | cgeo-2a74f5c1f3c11ba217d6b8cb732ddc3ce4610d4b.zip cgeo-2a74f5c1f3c11ba217d6b8cb732ddc3ce4610d4b.tar.gz cgeo-2a74f5c1f3c11ba217d6b8cb732ddc3ce4610d4b.tar.bz2 | |
Merge branch 'release' into master_dev
Diffstat (limited to 'main/src/cgeo/geocaching/settings/SettingsActivity.java')
| -rw-r--r-- | main/src/cgeo/geocaching/settings/SettingsActivity.java | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/main/src/cgeo/geocaching/settings/SettingsActivity.java b/main/src/cgeo/geocaching/settings/SettingsActivity.java index 5afd817..629debd 100644 --- a/main/src/cgeo/geocaching/settings/SettingsActivity.java +++ b/main/src/cgeo/geocaching/settings/SettingsActivity.java @@ -414,9 +414,21 @@ public class SettingsActivity extends PreferenceActivity { case R.string.pref_mapDirectory: if (data.hasExtra(Intents.EXTRA_MAP_FILE)) { final String mapFile = data.getStringExtra(Intents.EXTRA_MAP_FILE); - Settings.setMapFile(mapFile); - if (!Settings.isValidMapFile(Settings.getMapFile())) { - ActivityMixin.showToast(this, R.string.warn_invalid_mapfile); + File file = new File(mapFile); + if (!file.isDirectory()) { + Settings.setMapFile(mapFile); + if (!Settings.isValidMapFile(Settings.getMapFile())) { + ActivityMixin.showToast(this, R.string.warn_invalid_mapfile); + } else { + // Ensure map source preference is updated accordingly. + // TODO: There should be a better way to find and select the map source for a map file + Integer mapSourceId = mapFile.hashCode(); + ListPreference mapSource = (ListPreference) getPreference(R.string.pref_mapsource); + mapSource.setValue(mapSourceId.toString()); + VALUE_CHANGE_LISTENER.onPreferenceChange(mapSource, mapSourceId); + } + } else { + Settings.setMapFileDirectory(mapFile); } } initMapSourcePreference(); |
