aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/cgeoinit.java
diff options
context:
space:
mode:
authorrsudev <rasch@munin-soft.de>2011-11-15 22:04:20 +0100
committerrsudev <rasch@munin-soft.de>2011-11-15 22:04:20 +0100
commitafb9a89209cf2e64eca726549f0da93a1da5ff80 (patch)
treeddd96b3e03722e3e32861a3e7944a8c7cbf4265f /main/src/cgeo/geocaching/cgeoinit.java
parent2d9773fa90cba4bafff3bd71b9b7d3baaaff4766 (diff)
downloadcgeo-afb9a89209cf2e64eca726549f0da93a1da5ff80.zip
cgeo-afb9a89209cf2e64eca726549f0da93a1da5ff80.tar.gz
cgeo-afb9a89209cf2e64eca726549f0da93a1da5ff80.tar.bz2
Implementing #179, refactor maps to single source, last part
Diffstat (limited to 'main/src/cgeo/geocaching/cgeoinit.java')
-rw-r--r--main/src/cgeo/geocaching/cgeoinit.java13
1 files changed, 7 insertions, 6 deletions
diff --git a/main/src/cgeo/geocaching/cgeoinit.java b/main/src/cgeo/geocaching/cgeoinit.java
index 13a358c..9248876 100644
--- a/main/src/cgeo/geocaching/cgeoinit.java
+++ b/main/src/cgeo/geocaching/cgeoinit.java
@@ -1,10 +1,10 @@
package cgeo.geocaching;
import cgeo.geocaching.LogTemplateProvider.LogTemplate;
-import cgeo.geocaching.Settings.mapSourceEnum;
import cgeo.geocaching.activity.AbstractActivity;
import cgeo.geocaching.compatibility.Compatibility;
import cgeo.geocaching.enumerations.StatusCode;
+import cgeo.geocaching.maps.MapProviderFactory;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpResponse;
@@ -33,6 +33,7 @@ import android.widget.Spinner;
import android.widget.TextView;
import java.io.File;
+import java.util.SortedMap;
import java.util.concurrent.atomic.AtomicReference;
public class cgeoinit extends AbstractActivity {
@@ -518,13 +519,13 @@ public class cgeoinit extends AbstractActivity {
webAuth.setOnClickListener(new webAuth());
// Map source settings
+ SortedMap<Integer, String> mapSources = MapProviderFactory.getMapSources();
Spinner mapSourceSelector = (Spinner) findViewById(R.id.mapsource);
- ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(
- this, R.array.map_sources, android.R.layout.simple_spinner_item);
+ ArrayAdapter<CharSequence> adapter = new ArrayAdapter<CharSequence>(this, android.R.layout.simple_spinner_item, mapSources.values().toArray(new String[] {}));
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
mapSourceSelector.setAdapter(adapter);
int mapsource = prefs.getInt("mapsource", 0);
- mapSourceSelector.setSelection(mapsource);
+ mapSourceSelector.setSelection(MapProviderFactory.getSourceOrdinalFromId(mapsource));
mapSourceSelector.setOnItemSelectedListener(new cgeoChangeMapSource());
initMapfileEdittext(false);
@@ -657,12 +658,12 @@ public class cgeoinit extends AbstractActivity {
@Override
public void onItemSelected(AdapterView<?> arg0, View arg1, int arg2,
long arg3) {
- Settings.setMapSource(mapSourceEnum.fromInt(arg2));
+ Settings.setMapSource(MapProviderFactory.getSourceIdFromOrdinal(arg2));
}
@Override
public void onNothingSelected(AdapterView<?> arg0) {
- arg0.setSelection(Settings.getMapSource().ordinal());
+ arg0.setSelection(MapProviderFactory.getSourceIdFromOrdinal(Settings.getMapSource()));
}
}