aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/maps
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/cgeo/geocaching/maps')
-rw-r--r--main/src/cgeo/geocaching/maps/AbstractMapSource.java2
-rw-r--r--main/src/cgeo/geocaching/maps/CGeoMap.java57
-rw-r--r--main/src/cgeo/geocaching/maps/CachesOverlay.java7
-rw-r--r--main/src/cgeo/geocaching/maps/MapProviderFactory.java2
-rw-r--r--main/src/cgeo/geocaching/maps/PositionOverlay.java9
-rw-r--r--main/src/cgeo/geocaching/maps/google/GoogleMapActivity.java7
-rw-r--r--main/src/cgeo/geocaching/maps/google/GoogleMapProvider.java14
-rw-r--r--main/src/cgeo/geocaching/maps/google/GoogleOverlay.java3
-rw-r--r--main/src/cgeo/geocaching/maps/mapsforge/MapsforgeMapActivity.java8
-rw-r--r--main/src/cgeo/geocaching/maps/mapsforge/MapsforgeMapProvider.java11
-rw-r--r--main/src/cgeo/geocaching/maps/mapsforge/MapsforgeOverlay.java3
-rw-r--r--main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeMapActivity024.java8
12 files changed, 74 insertions, 57 deletions
diff --git a/main/src/cgeo/geocaching/maps/AbstractMapSource.java b/main/src/cgeo/geocaching/maps/AbstractMapSource.java
index 90a61d2..1d219d3 100644
--- a/main/src/cgeo/geocaching/maps/AbstractMapSource.java
+++ b/main/src/cgeo/geocaching/maps/AbstractMapSource.java
@@ -9,7 +9,7 @@ public abstract class AbstractMapSource implements MapSource {
private final MapProvider mapProvider;
private final String id;
- public AbstractMapSource(final String id, final MapProvider mapProvider, final String name) {
+ protected AbstractMapSource(final String id, final MapProvider mapProvider, final String name) {
this.id = id;
this.mapProvider = mapProvider;
this.name = name;
diff --git a/main/src/cgeo/geocaching/maps/CGeoMap.java b/main/src/cgeo/geocaching/maps/CGeoMap.java
index 6856a63..a470672 100644
--- a/main/src/cgeo/geocaching/maps/CGeoMap.java
+++ b/main/src/cgeo/geocaching/maps/CGeoMap.java
@@ -8,8 +8,9 @@ import cgeo.geocaching.R;
import cgeo.geocaching.SearchResult;
import cgeo.geocaching.Settings;
import cgeo.geocaching.StoredList;
+import cgeo.geocaching.Waypoint;
import cgeo.geocaching.cgCache;
-import cgeo.geocaching.cgWaypoint;
+import cgeo.geocaching.cgData;
import cgeo.geocaching.cgeoapplication;
import cgeo.geocaching.cgeocaches;
import cgeo.geocaching.activity.ActivityMixin;
@@ -179,7 +180,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
/** List of caches in the viewport */
private LeastRecentlyUsedSet<cgCache> caches = null;
/** List of waypoints in the viewport */
- private final LeastRecentlyUsedSet<cgWaypoint> waypoints = new LeastRecentlyUsedSet<cgWaypoint>(MAX_CACHES);
+ private final LeastRecentlyUsedSet<Waypoint> waypoints = new LeastRecentlyUsedSet<Waypoint>(MAX_CACHES);
// storing for offline
private ProgressDialog waitDialog = null;
private int detailTotal = 0;
@@ -226,7 +227,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
}
countVisibleCaches();
- if (caches != null && caches.size() > 0 && !mapTitle.contains("[")) {
+ if (caches != null && !caches.isEmpty() && !mapTitle.contains("[")) {
title.append(" [").append(cachesCnt);
if (cachesCnt != caches.size()) {
title.append('/').append(caches.size());
@@ -338,7 +339,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
final List<cgCache> protectedCaches = caches.getAsList();
int count = 0;
- if (protectedCaches.size() > 0) {
+ if (!protectedCaches.isEmpty()) {
final Viewport viewport = mapView.getViewport();
for (final cgCache cache : protectedCaches) {
@@ -368,7 +369,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
activity = this.getActivity();
app = (cgeoapplication) activity.getApplication();
- int countBubbleCnt = app.getAllStoredCachesCount(true, CacheType.ALL);
+ int countBubbleCnt = cgData.getAllCachesCount();
caches = new LeastRecentlyUsedSet<cgCache>(MAX_CACHES + countBubbleCnt);
final MapProvider mapProvider = Settings.getMapProvider();
@@ -494,7 +495,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
if (!CollectionUtils.isEmpty(dirtyCaches)) {
for (String geocode : dirtyCaches) {
- cgCache cache = app.loadCache(geocode, LoadFlags.LOAD_WAYPOINTS);
+ cgCache cache = cgData.loadCache(geocode, LoadFlags.LOAD_WAYPOINTS);
// remove to update the cache
caches.remove(cache);
caches.add(cache);
@@ -577,9 +578,8 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
}
}
- MenuItem item;
try {
- item = menu.findItem(MENU_TRAIL_MODE); // show trail
+ MenuItem item = menu.findItem(MENU_TRAIL_MODE);
if (Settings.isMapTrail()) {
item.setTitle(res.getString(R.string.map_trail_hide));
} else {
@@ -594,7 +594,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
}
final Set<String> geocodesInViewport = getGeocodesForCachesInViewport();
- menu.findItem(MENU_STORE_CACHES).setEnabled(!isLoading() && CollectionUtils.isNotEmpty(geocodesInViewport) && app.hasUnsavedCaches(new SearchResult(geocodesInViewport)));
+ menu.findItem(MENU_STORE_CACHES).setEnabled(!isLoading() && CollectionUtils.isNotEmpty(geocodesInViewport) && new SearchResult(geocodesInViewport).hasUnsavedCaches());
item = menu.findItem(MENU_CIRCLE_MODE); // show circles
if (overlayCaches != null && overlayCaches.getCircles()) {
@@ -640,7 +640,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
final List<String> geocodes = new ArrayList<String>();
for (final String geocode : geocodesInViewport) {
- if (!app.isOffline(geocode, null)) {
+ if (!cgData.isOffline(geocode, null)) {
geocodes.add(geocode);
}
}
@@ -750,9 +750,9 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
currentTheme = currentThemeFile.getName();
}
- int currentItem = 0;
List<String> names = new ArrayList<String>();
names.add(res.getString(R.string.map_theme_builtin));
+ int currentItem = 0;
for (File file : themeFiles) {
if (currentTheme.equalsIgnoreCase(file.getName())) {
currentItem = names.size();
@@ -766,7 +766,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
builder.setTitle(R.string.map_theme_select);
- builder.setSingleChoiceItems(names.toArray(new String[] {}), selectedItem,
+ builder.setSingleChoiceItems(names.toArray(new String[names.size()]), selectedItem,
new DialogInterface.OnClickListener() {
@Override
@@ -790,7 +790,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
}
/**
- * @return a Set of geocodes corresponding to the caches that are shown on screen.
+ * @return a non-null Set of geocodes corresponding to the caches that are shown on screen.
*/
private Set<String> getGeocodesForCachesInViewport() {
final Set<String> geocodes = new HashSet<String>();
@@ -1118,21 +1118,17 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
SearchResult searchResult;
if (mapMode == MapMode.LIVE) {
- if (isLiveEnabled) {
- searchResult = new SearchResult();
- } else {
- searchResult = new SearchResult(app.getStoredInViewport(viewport, Settings.getCacheType()));
- }
+ searchResult = isLiveEnabled ? new SearchResult() : new SearchResult(cgData.loadStoredInViewport(viewport, Settings.getCacheType()));
} else {
// map started from another activity
- searchResult = new SearchResult(searchIntent);
+ searchResult = searchIntent != null ? new SearchResult(searchIntent) : new SearchResult();
if (geocodeIntent != null) {
searchResult.addGeocode(geocodeIntent);
}
}
// live mode search result
if (isLiveEnabled) {
- SearchResult liveResult = new SearchResult(app.getCachedInViewport(viewport, Settings.getCacheType()));
+ SearchResult liveResult = new SearchResult(cgData.loadCachedInViewport(viewport, Settings.getCacheType()));
searchResult.addGeocodes(liveResult.getGeocodes());
}
@@ -1160,7 +1156,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
if (isLiveEnabled || mapMode == MapMode.COORDS) {
//All visible waypoints
CacheType type = Settings.getCacheType();
- Set<cgWaypoint> waypointsInViewport = app.getWaypointsInViewport(viewport, Settings.isExcludeMyCaches(), Settings.isExcludeDisabledCaches(), type);
+ Set<Waypoint> waypointsInViewport = cgData.loadWaypoints(viewport, Settings.isExcludeMyCaches(), Settings.isExcludeDisabledCaches(), type);
waypoints.addAll(waypointsInViewport);
}
else
@@ -1265,14 +1261,14 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
// display caches
final List<cgCache> cachesToDisplay = caches.getAsList();
- final List<cgWaypoint> waypointsToDisplay = new ArrayList<cgWaypoint>(waypoints);
+ final List<Waypoint> waypointsToDisplay = new ArrayList<Waypoint>(waypoints);
final List<CachesOverlayItemImpl> itemsToDisplay = new ArrayList<CachesOverlayItemImpl>();
if (!cachesToDisplay.isEmpty()) {
// Only show waypoints for single view or setting
// when less than showWaypointsthreshold Caches shown
if (mapMode == MapMode.SINGLE || (cachesCnt < Settings.getWayPointsThreshold())) {
- for (cgWaypoint waypoint : waypointsToDisplay) {
+ for (Waypoint waypoint : waypointsToDisplay) {
if (waypoint == null || waypoint.getCoords() == null) {
continue;
@@ -1320,7 +1316,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
}
if (coordsIntent != null) {
- final cgWaypoint waypoint = new cgWaypoint("some place", waypointTypeIntent != null ? waypointTypeIntent : WaypointType.WAYPOINT, false);
+ final Waypoint waypoint = new Waypoint("some place", waypointTypeIntent != null ? waypointTypeIntent : WaypointType.WAYPOINT, false);
waypoint.setCoords(coordsIntent);
final CachesOverlayItemImpl item = getItem(waypoint, null, waypoint);
@@ -1340,7 +1336,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
final protected Viewport viewport;
- public DoRunnable(final Viewport viewport) {
+ protected DoRunnable(final Viewport viewport) {
this.viewport = viewport;
}
@@ -1394,7 +1390,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
break;
}
- if (!app.isOffline(geocode, null)) {
+ if (!cgData.isOffline(geocode, null)) {
if ((System.currentTimeMillis() - last) < 1500) {
try {
int delay = 1000 + (int) (Math.random() * 1000.0) - (int) (System.currentTimeMillis() - last);
@@ -1484,9 +1480,9 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
Viewport viewport = null;
if (geocodeCenter != null) {
- viewport = app.getBounds(geocodeCenter);
+ viewport = cgData.getBounds(geocodeCenter);
} else if (searchCenter != null) {
- viewport = app.getBounds(searchCenter.getGeocodes());
+ viewport = cgData.getBounds(searchCenter.getGeocodes());
}
if (viewport == null) {
@@ -1630,7 +1626,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
* Waypoint. Mutally exclusive with cache
* @return
*/
- private CachesOverlayItemImpl getItem(final IWaypoint coord, final cgCache cache, final cgWaypoint waypoint) {
+ private CachesOverlayItemImpl getItem(final IWaypoint coord, final cgCache cache, final Waypoint waypoint) {
if (cache != null) {
final CachesOverlayItemImpl item = mapItemFactory.getCachesOverlayItem(coord, cache.getType());
@@ -1638,6 +1634,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
.append(cache.isReliableLatLon())
.append(cache.getType().id)
.append(cache.isDisabled() || cache.isArchived())
+ .append(cache.getCacheRealm().id)
.append(cache.isOwn())
.append(cache.isFound())
.append(cache.hasUserModifiedCoords())
@@ -1657,7 +1654,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
final ArrayList<int[]> insets = new ArrayList<int[]>(8);
// background: disabled or not
- final Drawable marker = getResources().getDrawable(cache.isDisabled() || cache.isArchived() ? R.drawable.marker_disabled : R.drawable.marker);
+ final Drawable marker = getResources().getDrawable(cache.isDisabled() || cache.isArchived() ? cache.getCacheRealm().markerDisabledId : cache.getCacheRealm().markerId);
layers.add(marker);
final int resolution = marker.getIntrinsicWidth() > 40 ? 1 : 0;
// reliable or not
diff --git a/main/src/cgeo/geocaching/maps/CachesOverlay.java b/main/src/cgeo/geocaching/maps/CachesOverlay.java
index b656900..044f69b 100644
--- a/main/src/cgeo/geocaching/maps/CachesOverlay.java
+++ b/main/src/cgeo/geocaching/maps/CachesOverlay.java
@@ -6,7 +6,7 @@ import cgeo.geocaching.R;
import cgeo.geocaching.Settings;
import cgeo.geocaching.WaypointPopup;
import cgeo.geocaching.cgCache;
-import cgeo.geocaching.cgeoapplication;
+import cgeo.geocaching.cgData;
import cgeo.geocaching.activity.Progress;
import cgeo.geocaching.connector.gc.GCMap;
import cgeo.geocaching.enumerations.CacheType;
@@ -209,10 +209,9 @@ public class CachesOverlay extends AbstractItemizedOverlay {
progress.show(context, context.getResources().getString(R.string.map_live), context.getResources().getString(R.string.cache_dialog_loading_details), true, null);
- CachesOverlayItemImpl item = null;
-
// prevent concurrent changes
getOverlayImpl().lock();
+ CachesOverlayItemImpl item = null;
try {
if (index < items.size()) {
item = items.get(index);
@@ -228,7 +227,7 @@ public class CachesOverlay extends AbstractItemizedOverlay {
final IWaypoint coordinate = item.getCoord();
if (StringUtils.isNotBlank(coordinate.getCoordType()) && coordinate.getCoordType().equalsIgnoreCase("cache") && StringUtils.isNotBlank(coordinate.getGeocode())) {
- cgCache cache = cgeoapplication.getInstance().loadCache(coordinate.getGeocode(), LoadFlags.LOAD_CACHE_OR_DB);
+ cgCache cache = cgData.loadCache(coordinate.getGeocode(), LoadFlags.LOAD_CACHE_OR_DB);
RequestDetailsThread requestDetailsThread = new RequestDetailsThread(cache);
if (!requestDetailsThread.requestRequired()) {
// don't show popup if we have enough details
diff --git a/main/src/cgeo/geocaching/maps/MapProviderFactory.java b/main/src/cgeo/geocaching/maps/MapProviderFactory.java
index cb1f87f..483189f 100644
--- a/main/src/cgeo/geocaching/maps/MapProviderFactory.java
+++ b/main/src/cgeo/geocaching/maps/MapProviderFactory.java
@@ -23,7 +23,7 @@ public class MapProviderFactory {
MapsforgeMapProvider.getInstance();
}
- private static boolean isGoogleMapsInstalled() {
+ public static boolean isGoogleMapsInstalled() {
boolean googleMaps = true;
try {
Class.forName("com.google.android.maps.MapActivity");
diff --git a/main/src/cgeo/geocaching/maps/PositionOverlay.java b/main/src/cgeo/geocaching/maps/PositionOverlay.java
index 1aa2d3b..fec67ef 100644
--- a/main/src/cgeo/geocaching/maps/PositionOverlay.java
+++ b/main/src/cgeo/geocaching/maps/PositionOverlay.java
@@ -158,7 +158,6 @@ public class PositionOverlay implements GeneralOverlay {
if (Settings.isMapTrail()) {
int size = history.size();
if (size > 1) {
- int alpha;
int alphaCnt = size - 201;
if (alphaCnt < 1) {
alphaCnt = 1;
@@ -172,6 +171,7 @@ public class PositionOverlay implements GeneralOverlay {
projection.toPixels(mapItemFactory.getGeoPointBase(new Geopoint(prev)), historyPointP);
projection.toPixels(mapItemFactory.getGeoPointBase(new Geopoint(now)), historyPointN);
+ int alpha;
if ((alphaCnt - cnt) > 0) {
alpha = 255 / (alphaCnt - cnt);
}
@@ -211,11 +211,8 @@ public class PositionOverlay implements GeneralOverlay {
heightArrowHalf = arrow.getHeight() / 2;
}
- int marginLeft;
- int marginTop;
-
- marginLeft = center.x - widthArrowHalf;
- marginTop = center.y - heightArrowHalf;
+ int marginLeft = center.x - widthArrowHalf;
+ int marginTop = center.y - heightArrowHalf;
Matrix matrix = new Matrix();
matrix.setRotate(heading, widthArrowHalf, heightArrowHalf);
diff --git a/main/src/cgeo/geocaching/maps/google/GoogleMapActivity.java b/main/src/cgeo/geocaching/maps/google/GoogleMapActivity.java
index 0377fe9..5649d19 100644
--- a/main/src/cgeo/geocaching/maps/google/GoogleMapActivity.java
+++ b/main/src/cgeo/geocaching/maps/google/GoogleMapActivity.java
@@ -1,5 +1,6 @@
package cgeo.geocaching.maps.google;
+import cgeo.geocaching.activity.FilteredActivity;
import cgeo.geocaching.maps.AbstractMap;
import cgeo.geocaching.maps.CGeoMap;
import cgeo.geocaching.maps.interfaces.MapActivityImpl;
@@ -12,7 +13,7 @@ import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
-public class GoogleMapActivity extends MapActivity implements MapActivityImpl {
+public class GoogleMapActivity extends MapActivity implements MapActivityImpl, FilteredActivity {
private AbstractMap mapBase;
@@ -127,4 +128,8 @@ public class GoogleMapActivity extends MapActivity implements MapActivityImpl {
mapBase.goManual(view);
}
+ @Override
+ public void showFilterMenu(View view) {
+ // do nothing, the filter bar only shows the global filter
+ }
}
diff --git a/main/src/cgeo/geocaching/maps/google/GoogleMapProvider.java b/main/src/cgeo/geocaching/maps/google/GoogleMapProvider.java
index 6973338..1fa38ad 100644
--- a/main/src/cgeo/geocaching/maps/google/GoogleMapProvider.java
+++ b/main/src/cgeo/geocaching/maps/google/GoogleMapProvider.java
@@ -16,7 +16,6 @@ public final class GoogleMapProvider extends AbstractMapProvider {
public static final String GOOGLE_MAP_ID = "GOOGLE_MAP";
public static final String GOOGLE_SATELLITE_ID = "GOOGLE_SATELLITE";
- private static GoogleMapProvider instance;
private final MapItemFactory mapItemFactory;
@@ -29,15 +28,16 @@ public final class GoogleMapProvider extends AbstractMapProvider {
mapItemFactory = new GoogleMapItemFactory();
}
+ private static class Holder {
+ private static final GoogleMapProvider INSTANCE = new GoogleMapProvider();
+ }
+
public static GoogleMapProvider getInstance() {
- if (instance == null) {
- instance = new GoogleMapProvider();
- }
- return instance;
+ return Holder.INSTANCE;
}
public static boolean isSatelliteSource(final MapSource mapSource) {
- return mapSource != null && mapSource instanceof GoogleSatelliteSource;
+ return mapSource instanceof GoogleSatelliteSource;
}
@Override
@@ -67,7 +67,7 @@ public final class GoogleMapProvider extends AbstractMapProvider {
private static abstract class AbstractGoogleMapSource extends AbstractMapSource {
- public AbstractGoogleMapSource(final String id, final MapProvider mapProvider, final String name) {
+ protected AbstractGoogleMapSource(final String id, final MapProvider mapProvider, final String name) {
super(id, mapProvider, name);
}
diff --git a/main/src/cgeo/geocaching/maps/google/GoogleOverlay.java b/main/src/cgeo/geocaching/maps/google/GoogleOverlay.java
index d86eafe..773f9ff 100644
--- a/main/src/cgeo/geocaching/maps/google/GoogleOverlay.java
+++ b/main/src/cgeo/geocaching/maps/google/GoogleOverlay.java
@@ -27,6 +27,9 @@ public class GoogleOverlay extends Overlay implements OverlayImpl {
break;
case ScaleOverlay:
overlayBase = new ScaleOverlay(activityIn, this);
+ break;
+ default:
+ throw new IllegalArgumentException();
}
}
diff --git a/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeMapActivity.java b/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeMapActivity.java
index 6cb2539..f850402 100644
--- a/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeMapActivity.java
+++ b/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeMapActivity.java
@@ -1,5 +1,6 @@
package cgeo.geocaching.maps.mapsforge;
+import cgeo.geocaching.activity.FilteredActivity;
import cgeo.geocaching.maps.AbstractMap;
import cgeo.geocaching.maps.CGeoMap;
import cgeo.geocaching.maps.interfaces.MapActivityImpl;
@@ -12,7 +13,7 @@ import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
-public class MapsforgeMapActivity extends MapActivity implements MapActivityImpl {
+public class MapsforgeMapActivity extends MapActivity implements MapActivityImpl, FilteredActivity {
private AbstractMap mapBase;
@@ -121,4 +122,9 @@ public class MapsforgeMapActivity extends MapActivity implements MapActivityImpl
public void goManual(View view) {
mapBase.goManual(view);
}
+
+ @Override
+ public void showFilterMenu(View view) {
+ // do nothing, the filter bar only shows the global filter
+ }
}
diff --git a/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeMapProvider.java b/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeMapProvider.java
index ad64807..dc0dbf8 100644
--- a/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeMapProvider.java
+++ b/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeMapProvider.java
@@ -31,7 +31,6 @@ public final class MapsforgeMapProvider extends AbstractMapProvider {
public static final String MAPSFORGE_MAPNIK_ID = "MAPSFORGE_MAPNIK";
private boolean oldMap = false;
private MapItemFactory mapItemFactory = new MapsforgeMapItemFactory();
- private static MapsforgeMapProvider instance;
private MapsforgeMapProvider() {
final Resources resources = cgeoapplication.getInstance().getResources();
@@ -42,11 +41,12 @@ public final class MapsforgeMapProvider extends AbstractMapProvider {
updateOfflineMaps();
}
+ private static final class Holder {
+ private static final MapsforgeMapProvider INSTANCE = new MapsforgeMapProvider();
+ }
+
public static MapsforgeMapProvider getInstance() {
- if (instance == null) {
- instance = new MapsforgeMapProvider();
- }
- return instance;
+ return Holder.INSTANCE;
}
public static List<String> getOfflineMaps() {
@@ -65,6 +65,7 @@ public final class MapsforgeMapProvider extends AbstractMapProvider {
}
}
}
+ Collections.sort(mapFileList, String.CASE_INSENSITIVE_ORDER);
return mapFileList;
} catch (Exception e) {
Log.e("Settings.getOfflineMaps: " + e);
diff --git a/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeOverlay.java b/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeOverlay.java
index b6e31a2..dd7fb75 100644
--- a/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeOverlay.java
+++ b/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeOverlay.java
@@ -29,6 +29,9 @@ public class MapsforgeOverlay extends Overlay implements OverlayImpl {
break;
case ScaleOverlay:
overlayBase = new ScaleOverlay(activityIn, this);
+ break;
+ default:
+ throw new IllegalArgumentException();
}
}
diff --git a/main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeMapActivity024.java b/main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeMapActivity024.java
index d45db9a..ed8a7bc 100644
--- a/main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeMapActivity024.java
+++ b/main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeMapActivity024.java
@@ -1,5 +1,6 @@
package cgeo.geocaching.maps.mapsforge.v024;
+import cgeo.geocaching.activity.FilteredActivity;
import cgeo.geocaching.maps.AbstractMap;
import cgeo.geocaching.maps.CGeoMap;
import cgeo.geocaching.maps.interfaces.MapActivityImpl;
@@ -12,7 +13,7 @@ import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
-public class MapsforgeMapActivity024 extends MapActivity implements MapActivityImpl {
+public class MapsforgeMapActivity024 extends MapActivity implements MapActivityImpl, FilteredActivity {
private AbstractMap mapBase;
@@ -121,4 +122,9 @@ public class MapsforgeMapActivity024 extends MapActivity implements MapActivityI
public void goManual(View view) {
mapBase.goManual(view);
}
+
+ @Override
+ public void showFilterMenu(View view) {
+ // do nothing, the filter bar only shows the global filter
+ }
}