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.java419
-rw-r--r--main/src/cgeo/geocaching/maps/CachesOverlay.java21
-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/GoogleMapView.java4
-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/MapsforgeMapView.java4
-rw-r--r--main/src/cgeo/geocaching/maps/mapsforge/MapsforgeOverlay.java3
-rw-r--r--main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeMapActivity024.java8
-rw-r--r--main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeMapView024.java4
15 files changed, 264 insertions, 255 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 e48ca70..c917a37 100644
--- a/main/src/cgeo/geocaching/maps/CGeoMap.java
+++ b/main/src/cgeo/geocaching/maps/CGeoMap.java
@@ -1,15 +1,14 @@
package cgeo.geocaching.maps;
import cgeo.geocaching.DirectionProvider;
+import cgeo.geocaching.Geocache;
import cgeo.geocaching.IGeoData;
-import cgeo.geocaching.IWaypoint;
-import cgeo.geocaching.LiveMapInfo;
import cgeo.geocaching.R;
import cgeo.geocaching.SearchResult;
import cgeo.geocaching.Settings;
import cgeo.geocaching.StoredList;
-import cgeo.geocaching.cgCache;
-import cgeo.geocaching.cgWaypoint;
+import cgeo.geocaching.Waypoint;
+import cgeo.geocaching.cgData;
import cgeo.geocaching.cgeoapplication;
import cgeo.geocaching.cgeocaches;
import cgeo.geocaching.activity.ActivityMixin;
@@ -31,11 +30,13 @@ import cgeo.geocaching.maps.interfaces.MapProvider;
import cgeo.geocaching.maps.interfaces.MapSource;
import cgeo.geocaching.maps.interfaces.MapViewImpl;
import cgeo.geocaching.maps.interfaces.OnMapDragListener;
+import cgeo.geocaching.ui.dialog.LiveMapInfoDialogBuilder;
import cgeo.geocaching.utils.AngleUtils;
import cgeo.geocaching.utils.CancellableHandler;
import cgeo.geocaching.utils.GeoDirHandler;
import cgeo.geocaching.utils.LeastRecentlyUsedSet;
import cgeo.geocaching.utils.Log;
+import cgeo.geocaching.utils.RunnableWithArgument;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
@@ -177,9 +178,9 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
/** Count of caches currently visible */
private int cachesCnt = 0;
/** List of caches in the viewport */
- private LeastRecentlyUsedSet<cgCache> caches = null;
+ private LeastRecentlyUsedSet<Geocache> 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());
@@ -335,13 +336,13 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
}
protected void countVisibleCaches() {
- final List<cgCache> protectedCaches = caches.getAsList();
+ final List<Geocache> protectedCaches = caches.getAsList();
int count = 0;
- if (protectedCaches.size() > 0) {
+ if (!protectedCaches.isEmpty()) {
final Viewport viewport = mapView.getViewport();
- for (final cgCache cache : protectedCaches) {
+ for (final Geocache cache : protectedCaches) {
if (cache != null && cache.getCoords() != null) {
if (viewport.contains(cache)) {
count++;
@@ -368,8 +369,8 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
activity = this.getActivity();
app = (cgeoapplication) activity.getApplication();
- int countBubbleCnt = app.getAllStoredCachesCount(true, CacheType.ALL);
- caches = new LeastRecentlyUsedSet<cgCache>(MAX_CACHES + countBubbleCnt);
+ int countBubbleCnt = cgData.getAllCachesCount();
+ caches = new LeastRecentlyUsedSet<Geocache>(MAX_CACHES + countBubbleCnt);
final MapProvider mapProvider = Settings.getMapProvider();
mapItemFactory = mapProvider.getMapItemFactory();
@@ -469,9 +470,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
prepareFilterBar();
if (!app.isLiveMapHintShown() && !Settings.getHideLiveMapHint()) {
- Intent hintIntent = new Intent(activity, LiveMapInfo.class);
- activity.startActivity(hintIntent);
- app.setLiveMapHintShown();
+ LiveMapInfoDialogBuilder.create(activity).show();
}
}
@@ -494,10 +493,11 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
if (!CollectionUtils.isEmpty(dirtyCaches)) {
for (String geocode : dirtyCaches) {
- cgCache cache = app.loadCache(geocode, LoadFlags.LOAD_WAYPOINTS);
+ Geocache cache = cgData.loadCache(geocode, LoadFlags.LOAD_WAYPOINTS);
if (cache != null) {
- // remove to update the cache
+ // new collection type needs to remove first
caches.remove(cache);
+ // re-add to update the freshness
caches.add(cache);
}
}
@@ -579,9 +579,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 {
@@ -596,7 +595,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()) {
@@ -612,7 +611,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
menu.findItem(SUBMENU_STRATEGY).setEnabled(isLiveEnabled);
} catch (Exception e) {
- Log.e("cgeomap.onPrepareOptionsMenu: " + e);
+ Log.e("cgeomap.onPrepareOptionsMenu", e);
}
return true;
@@ -642,7 +641,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);
}
}
@@ -656,42 +655,18 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
return true;
}
- final LoadDetailsHandler loadDetailsHandler = new LoadDetailsHandler();
-
- waitDialog = new ProgressDialog(activity);
- waitDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
- waitDialog.setCancelable(true);
- waitDialog.setCancelMessage(loadDetailsHandler.cancelMessage());
- waitDialog.setMax(detailTotal);
- waitDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
-
- @Override
- public void onCancel(DialogInterface arg0) {
- try {
- if (loadDetailsThread != null) {
- loadDetailsThread.stopIt();
- }
-
- geoDirUpdate.startDir();
- } catch (Exception e) {
- Log.e("cgeocaches.onPrepareOptionsMenu.onCancel: " + e.toString());
- }
- }
- });
-
- float etaTime = detailTotal * 7.0f / 60.0f;
- int roundedEta = Math.round(etaTime);
- if (etaTime < 0.4) {
- waitDialog.setMessage(res.getString(R.string.caches_downloading) + " " + res.getString(R.string.caches_eta_ltm));
- } else {
- waitDialog.setMessage(res.getString(R.string.caches_downloading) + " " + roundedEta + " " + res.getQuantityString(R.plurals.caches_eta_mins, roundedEta));
+ if (Settings.getChooseList()) {
+ // let user select list to store cache in
+ new StoredList.UserInterface(activity).promptForListSelection(R.string.list_title,
+ new RunnableWithArgument<Integer>() {
+ @Override
+ public void run(final Integer selectedListId) {
+ storeCaches(geocodes, selectedListId);
+ }
+ }, true, StoredList.TEMPORARY_LIST_ID);
+ } else {
+ storeCaches(geocodes, StoredList.STANDARD_LIST_ID);
}
- waitDialog.show();
-
- detailProgressTime = System.currentTimeMillis();
-
- loadDetailsThread = new LoadDetails(loadDetailsHandler, geocodes);
- loadDetailsThread.start();
}
return true;
case MENU_CIRCLE_MODE:
@@ -752,9 +727,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();
@@ -768,7 +743,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
@@ -792,15 +767,15 @@ 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>();
- final List<cgCache> cachesProtected = caches.getAsList();
+ final List<Geocache> cachesProtected = caches.getAsList();
final Viewport viewport = mapView.getViewport();
- for (final cgCache cache : cachesProtected) {
+ for (final Geocache cache : cachesProtected) {
if (viewport.contains(cache)) {
geocodes.add(cache.getGeocode());
}
@@ -1053,22 +1028,11 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
// check if map moved or zoomed
//TODO Portree Use Rectangle inside with bigger search window. That will stop reloading on every move
- boolean moved = false;
-
- if (liveChanged) {
- moved = true;
- } else if (isLiveEnabled && !downloaded) {
- moved = true;
- } else if (viewport == null) {
- moved = true;
- } else if (zoomNow != zoom) {
- moved = true;
- } else if (mapMoved(viewport, viewportNow) && (cachesCnt <= 0 || CollectionUtils.isEmpty(caches) || !viewport.includes(viewportNow))) {
- moved = true;
- }
+ final boolean moved = liveChanged || (isLiveEnabled && !downloaded) || (viewport == null) || zoomNow != zoom ||
+ (mapMoved(viewport, viewportNow) && (cachesCnt <= 0 || CollectionUtils.isEmpty(caches) || !viewport.includes(viewportNow)));
// update title on any change
- if (moved || zoomNow != zoom || !viewportNow.equals(viewport)) {
+ if (moved || !viewportNow.equals(viewport)) {
displayHandler.sendEmptyMessage(UPDATE_TITLE);
}
zoom = zoomNow;
@@ -1088,7 +1052,7 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
yield();
} catch (Exception e) {
- Log.w("cgeomap.LoadTimer.run: " + e.toString());
+ Log.w("cgeomap.LoadTimer.run", e);
}
}
}
@@ -1120,38 +1084,33 @@ 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());
}
downloaded = true;
- Set<cgCache> cachesFromSearchResult = searchResult.getCachesFromSearchResult(LoadFlags.LOAD_WAYPOINTS);
- // to update the caches they have to be removed first
- caches.removeAll(cachesFromSearchResult);
+ Set<Geocache> cachesFromSearchResult = searchResult.getCachesFromSearchResult(LoadFlags.LOAD_WAYPOINTS);
+ // update the caches
caches.addAll(cachesFromSearchResult);
if (mapMode == MapMode.LIVE) {
final boolean excludeMine = Settings.isExcludeMyCaches();
final boolean excludeDisabled = Settings.isExcludeDisabledCaches();
- final List<cgCache> tempList = caches.getAsList();
+ final List<Geocache> tempList = caches.getAsList();
- for (cgCache cache : tempList) {
- if ((cache.isFound() && excludeMine) || (cache.isOwn() && excludeMine) || (cache.isDisabled() && excludeDisabled)) {
+ for (Geocache cache : tempList) {
+ if ((cache.isFound() && excludeMine) || (cache.isOwner() && excludeMine) || (cache.isDisabled() && excludeDisabled)) {
caches.remove(cache);
}
}
@@ -1162,13 +1121,13 @@ 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
{
//All waypoints from the viewed caches
- for (cgCache c : caches.getAsList()) {
+ for (Geocache c : caches.getAsList()) {
waypoints.addAll(c.getWaypoints());
}
}
@@ -1229,9 +1188,8 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
} while (count < 2);
if (searchResult != null) {
- Set<cgCache> result = searchResult.getCachesFromSearchResult(LoadFlags.LOAD_CACHE_OR_DB);
- // to update the caches they have to be removed first
- caches.removeAll(result);
+ Set<Geocache> result = searchResult.getCachesFromSearchResult(LoadFlags.LOAD_CACHE_OR_DB);
+ // update the caches
caches.addAll(result);
lastSearchResult = searchResult;
}
@@ -1266,29 +1224,29 @@ 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<Geocache> cachesToDisplay = caches.getAsList();
+ 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;
}
- itemsToDisplay.add(getItem(waypoint, null, waypoint));
+ itemsToDisplay.add(getWaypointItem(waypoint));
}
}
- for (cgCache cache : cachesToDisplay) {
+ for (Geocache cache : cachesToDisplay) {
if (cache == null || cache.getCoords() == null) {
continue;
}
- itemsToDisplay.add(getItem(cache, cache, null));
+ itemsToDisplay.add(getCacheItem(cache));
}
overlayCaches.updateItems(itemsToDisplay);
@@ -1322,10 +1280,10 @@ 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);
+ final CachesOverlayItemImpl item = getWaypointItem(waypoint);
overlayCaches.updateItems(item);
displayHandler.sendEmptyMessage(INVALIDATE_MAP);
@@ -1342,7 +1300,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;
}
@@ -1364,6 +1322,51 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
}
/**
+ * store caches, invoked by "store offline" menu item
+ *
+ * @param listId
+ * the list to store the caches in
+ */
+ private void storeCaches(List<String> geocodes, int listId) {
+ final LoadDetailsHandler loadDetailsHandler = new LoadDetailsHandler();
+
+ waitDialog = new ProgressDialog(activity);
+ waitDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
+ waitDialog.setCancelable(true);
+ waitDialog.setCancelMessage(loadDetailsHandler.cancelMessage());
+ waitDialog.setMax(detailTotal);
+ waitDialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
+
+ @Override
+ public void onCancel(DialogInterface arg0) {
+ try {
+ if (loadDetailsThread != null) {
+ loadDetailsThread.stopIt();
+ }
+
+ geoDirUpdate.startDir();
+ } catch (Exception e) {
+ Log.e("cgeocaches.onPrepareOptionsMenu.onCancel", e);
+ }
+ }
+ });
+
+ float etaTime = detailTotal * 7.0f / 60.0f;
+ int roundedEta = Math.round(etaTime);
+ if (etaTime < 0.4) {
+ waitDialog.setMessage(res.getString(R.string.caches_downloading) + " " + res.getString(R.string.caches_eta_ltm));
+ } else {
+ waitDialog.setMessage(res.getString(R.string.caches_downloading) + " " + roundedEta + " " + res.getQuantityString(R.plurals.caches_eta_mins, roundedEta));
+ }
+ waitDialog.show();
+
+ detailProgressTime = System.currentTimeMillis();
+
+ loadDetailsThread = new LoadDetails(loadDetailsHandler, geocodes, listId);
+ loadDetailsThread.start();
+ }
+
+ /**
* Thread to store the caches in the viewport. Started by Activity.
*/
@@ -1371,11 +1374,13 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
final private CancellableHandler handler;
final private List<String> geocodes;
+ final private int listId;
private long last = 0L;
- public LoadDetails(final CancellableHandler handler, final List<String> geocodes) {
+ public LoadDetails(final CancellableHandler handler, final List<String> geocodes, final int listId) {
this.handler = handler;
this.geocodes = geocodes;
+ this.listId = listId;
}
public void stopIt() {
@@ -1396,7 +1401,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);
@@ -1416,10 +1421,10 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
break;
}
- cgCache.storeCache(null, geocode, StoredList.STANDARD_LIST_ID, false, handler);
+ Geocache.storeCache(null, geocode, listId, false, handler);
}
} catch (Exception e) {
- Log.e("cgeocaches.LoadDetails.run: " + e.toString());
+ Log.e("cgeocaches.LoadDetails.run", e);
} finally {
// one more cache over
detailProgress++;
@@ -1486,9 +1491,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) {
@@ -1621,116 +1626,100 @@ public class CGeoMap extends AbstractMap implements OnMapDragListener, ViewFacto
dirtyCaches.add(geocode);
}
- /**
- * Returns a OverlayItem represented by an icon
- *
- * @param coord
- * The coords
- * @param cache
- * Cache
- * @param waypoint
- * Waypoint. Mutally exclusive with cache
- * @return
- */
- private CachesOverlayItemImpl getItem(final IWaypoint coord, final cgCache cache, final cgWaypoint waypoint) {
- if (cache != null) {
- final CachesOverlayItemImpl item = mapItemFactory.getCachesOverlayItem(coord, cache.getType());
-
- final int hashcode = new HashCodeBuilder()
- .append(cache.isReliableLatLon())
- .append(cache.getType().id)
- .append(cache.isDisabled() || cache.isArchived())
- .append(cache.isOwn())
- .append(cache.isFound())
- .append(cache.hasUserModifiedCoords())
- .append(cache.getPersonalNote())
- .append(cache.isLogOffline())
- .append(cache.getListId() > 0)
- .toHashCode();
-
- final LayerDrawable ldFromCache = overlaysCache.get(hashcode);
- if (ldFromCache != null) {
- item.setMarker(ldFromCache);
- return item;
- }
-
- // Set initial capacities to the maximum of layers and insets to avoid dynamic reallocation
- final ArrayList<Drawable> layers = new ArrayList<Drawable>(9);
- 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);
- layers.add(marker);
- final int resolution = marker.getIntrinsicWidth() > 40 ? 1 : 0;
- // reliable or not
- if (!cache.isReliableLatLon()) {
- insets.add(INSET_RELIABLE[resolution]);
- layers.add(getResources().getDrawable(R.drawable.marker_notreliable));
- }
- // cache type
- layers.add(getResources().getDrawable(cache.getType().markerId));
- insets.add(INSET_TYPE[resolution]);
- // own
- if (cache.isOwn()) {
- layers.add(getResources().getDrawable(R.drawable.marker_own));
- insets.add(INSET_OWN[resolution]);
- // if not, checked if stored
- } else if (cache.getListId() > 0) {
- layers.add(getResources().getDrawable(R.drawable.marker_stored));
- insets.add(INSET_OWN[resolution]);
- }
- // found
- if (cache.isFound()) {
- layers.add(getResources().getDrawable(R.drawable.marker_found));
- insets.add(INSET_FOUND[resolution]);
- // if not, perhaps logged offline
- } else if (cache.isLogOffline()) {
- layers.add(getResources().getDrawable(R.drawable.marker_found_offline));
- insets.add(INSET_FOUND[resolution]);
- }
- // user modified coords
- if (cache.hasUserModifiedCoords()) {
- layers.add(getResources().getDrawable(R.drawable.marker_usermodifiedcoords));
- insets.add(INSET_USERMODIFIEDCOORDS[resolution]);
- }
- // personal note
- if (cache.getPersonalNote() != null) {
- layers.add(getResources().getDrawable(R.drawable.marker_personalnote));
- insets.add(INSET_PERSONALNOTE[resolution]);
- }
-
- final LayerDrawable ld = new LayerDrawable(layers.toArray(new Drawable[layers.size()]));
-
- int index = 1;
- for (final int[] inset : insets) {
- ld.setLayerInset(index++, inset[0], inset[1], inset[2], inset[3]);
- }
-
- overlaysCache.put(hashcode, ld);
-
- item.setMarker(ld);
+ private CachesOverlayItemImpl getCacheItem(final Geocache cache) {
+ final CachesOverlayItemImpl item = mapItemFactory.getCachesOverlayItem(cache, cache.getType());
+
+ final int hashcode = new HashCodeBuilder()
+ .append(cache.isReliableLatLon())
+ .append(cache.getType().id)
+ .append(cache.isDisabled() || cache.isArchived())
+ .append(cache.getCacheRealm().id)
+ .append(cache.isOwner())
+ .append(cache.isFound())
+ .append(cache.hasUserModifiedCoords())
+ .append(cache.getPersonalNote())
+ .append(cache.isLogOffline())
+ .append(cache.getListId() > 0)
+ .toHashCode();
+
+ final LayerDrawable ldFromCache = overlaysCache.get(hashcode);
+ if (ldFromCache != null) {
+ item.setMarker(ldFromCache);
return item;
}
- if (waypoint != null) {
-
- final CachesOverlayItemImpl item = mapItemFactory.getCachesOverlayItem(coord, null);
- Drawable[] layers = new Drawable[2];
- layers[0] = getResources().getDrawable(R.drawable.marker);
- layers[1] = getResources().getDrawable(waypoint.getWaypointType().markerId);
+ // Set initial capacities to the maximum of layers and insets to avoid dynamic reallocation
+ final ArrayList<Drawable> layers = new ArrayList<Drawable>(9);
+ final ArrayList<int[]> insets = new ArrayList<int[]>(8);
+
+ // background: disabled or not
+ 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
+ if (!cache.isReliableLatLon()) {
+ insets.add(INSET_RELIABLE[resolution]);
+ layers.add(getResources().getDrawable(R.drawable.marker_notreliable));
+ }
+ // cache type
+ layers.add(getResources().getDrawable(cache.getType().markerId));
+ insets.add(INSET_TYPE[resolution]);
+ // own
+ if (cache.isOwner()) {
+ layers.add(getResources().getDrawable(R.drawable.marker_own));
+ insets.add(INSET_OWN[resolution]);
+ // if not, checked if stored
+ } else if (cache.getListId() > 0) {
+ layers.add(getResources().getDrawable(R.drawable.marker_stored));
+ insets.add(INSET_OWN[resolution]);
+ }
+ // found
+ if (cache.isFound()) {
+ layers.add(getResources().getDrawable(R.drawable.marker_found));
+ insets.add(INSET_FOUND[resolution]);
+ // if not, perhaps logged offline
+ } else if (cache.isLogOffline()) {
+ layers.add(getResources().getDrawable(R.drawable.marker_found_offline));
+ insets.add(INSET_FOUND[resolution]);
+ }
+ // user modified coords
+ if (cache.hasUserModifiedCoords()) {
+ layers.add(getResources().getDrawable(R.drawable.marker_usermodifiedcoords));
+ insets.add(INSET_USERMODIFIEDCOORDS[resolution]);
+ }
+ // personal note
+ if (cache.getPersonalNote() != null) {
+ layers.add(getResources().getDrawable(R.drawable.marker_personalnote));
+ insets.add(INSET_PERSONALNOTE[resolution]);
+ }
+
+ final LayerDrawable ld = new LayerDrawable(layers.toArray(new Drawable[layers.size()]));
+
+ int index = 1;
+ for (final int[] inset : insets) {
+ ld.setLayerInset(index++, inset[0], inset[1], inset[2], inset[3]);
+ }
+
+ overlaysCache.put(hashcode, ld);
+
+ item.setMarker(ld);
+ return item;
+ }
- LayerDrawable ld = new LayerDrawable(layers);
- if (layers[0].getIntrinsicWidth() > 40) {
- ld.setLayerInset(1, 9, 12, 10, 13);
- } else {
- ld.setLayerInset(1, 9, 12, 8, 12);
- }
- item.setMarker(ld);
- return item;
+ private CachesOverlayItemImpl getWaypointItem(final Waypoint waypoint) {
+ final CachesOverlayItemImpl item = mapItemFactory.getCachesOverlayItem(waypoint, null);
+ final Drawable[] layers = new Drawable[] {
+ getResources().getDrawable(R.drawable.marker),
+ getResources().getDrawable(waypoint.getWaypointType().markerId)
+ };
+ final LayerDrawable ld = new LayerDrawable(layers);
+ if (layers[0].getIntrinsicWidth() > 40) {
+ ld.setLayerInset(1, 9, 12, 10, 13);
+ } else {
+ ld.setLayerInset(1, 9, 12, 8, 12);
}
-
- return null;
-
+ item.setMarker(ld);
+ return item;
}
}
diff --git a/main/src/cgeo/geocaching/maps/CachesOverlay.java b/main/src/cgeo/geocaching/maps/CachesOverlay.java
index b656900..9bb4cef 100644
--- a/main/src/cgeo/geocaching/maps/CachesOverlay.java
+++ b/main/src/cgeo/geocaching/maps/CachesOverlay.java
@@ -5,8 +5,8 @@ import cgeo.geocaching.IWaypoint;
import cgeo.geocaching.R;
import cgeo.geocaching.Settings;
import cgeo.geocaching.WaypointPopup;
-import cgeo.geocaching.cgCache;
-import cgeo.geocaching.cgeoapplication;
+import cgeo.geocaching.Geocache;
+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);
+ Geocache 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
@@ -238,7 +237,7 @@ public class CachesOverlay extends AbstractItemizedOverlay {
return true;
}
- if (coordinate.getCoordType() != null && coordinate.getCoordType().equalsIgnoreCase("waypoint") && coordinate.getId() > 0) {
+ if (coordinate.getCoordType() != null && coordinate.getCoordType().equalsIgnoreCase("waypoint") && coordinate.getId() >= 0) {
CGeoMap.markCacheAsDirty(coordinate.getGeocode());
WaypointPopup.startActivity(context, coordinate.getId(), coordinate.getGeocode());
} else {
@@ -248,7 +247,7 @@ public class CachesOverlay extends AbstractItemizedOverlay {
progress.dismiss();
} catch (Exception e) {
- Log.e("cgMapOverlay.onTap: " + e.toString());
+ Log.e("cgMapOverlay.onTap", e);
if (progress != null) {
progress.dismiss();
}
@@ -262,7 +261,7 @@ public class CachesOverlay extends AbstractItemizedOverlay {
try {
return items.get(index);
} catch (Exception e) {
- Log.e("cgMapOverlay.createItem: " + e.toString());
+ Log.e("cgMapOverlay.createItem", e);
}
return null;
@@ -273,7 +272,7 @@ public class CachesOverlay extends AbstractItemizedOverlay {
try {
return items.size();
} catch (Exception e) {
- Log.e("cgMapOverlay.size: " + e.toString());
+ Log.e("cgMapOverlay.size", e);
}
return 0;
@@ -281,9 +280,9 @@ public class CachesOverlay extends AbstractItemizedOverlay {
private class RequestDetailsThread extends Thread {
- private final cgCache cache;
+ private final Geocache cache;
- public RequestDetailsThread(cgCache cache) {
+ public RequestDetailsThread(Geocache cache) {
this.cache = cache;
}
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/GoogleMapView.java b/main/src/cgeo/geocaching/maps/google/GoogleMapView.java
index 9c134a4..154c3f3 100644
--- a/main/src/cgeo/geocaching/maps/google/GoogleMapView.java
+++ b/main/src/cgeo/geocaching/maps/google/GoogleMapView.java
@@ -61,7 +61,7 @@ public class GoogleMapView extends MapView implements MapViewImpl {
super.draw(canvas);
} catch (Exception e) {
- Log.e("GoogleMapView.draw: " + e.toString());
+ Log.e("GoogleMapView.draw", e);
}
}
@@ -75,7 +75,7 @@ public class GoogleMapView extends MapView implements MapViewImpl {
super.displayZoomControls(takeFocus);
} catch (Exception e) {
- Log.e("GoogleMapView.displayZoomControls: " + e.toString());
+ Log.e("GoogleMapView.displayZoomControls", e);
}
}
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/MapsforgeMapView.java b/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeMapView.java
index 1e4a756..083e5bb 100644
--- a/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeMapView.java
+++ b/main/src/cgeo/geocaching/maps/mapsforge/MapsforgeMapView.java
@@ -59,7 +59,7 @@ public class MapsforgeMapView extends MapView implements MapViewImpl {
super.draw(canvas);
} catch (Exception e) {
- Log.e("MapsforgeMapView.draw: " + e.toString());
+ Log.e("MapsforgeMapView.draw", e);
}
}
@@ -264,7 +264,7 @@ public class MapsforgeMapView extends MapView implements MapViewImpl {
}
} catch (Exception e) {
- Log.e("MapsforgeMapView.repaintRequired: " + e.toString());
+ Log.e("MapsforgeMapView.repaintRequired", 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
+ }
}
diff --git a/main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeMapView024.java b/main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeMapView024.java
index d177a47..85d61fe 100644
--- a/main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeMapView024.java
+++ b/main/src/cgeo/geocaching/maps/mapsforge/v024/MapsforgeMapView024.java
@@ -53,7 +53,7 @@ public class MapsforgeMapView024 extends MapView implements MapViewImpl {
super.draw(canvas);
} catch (Exception e) {
- Log.e("MapsforgeMapView.draw: " + e.toString());
+ Log.e("MapsforgeMapView.draw", e);
}
}
@@ -208,7 +208,7 @@ public class MapsforgeMapView024 extends MapView implements MapViewImpl {
}
} catch (Exception e) {
- Log.e("MapsforgeMapView.repaintRequired: " + e.toString());
+ Log.e("MapsforgeMapView.repaintRequired", e);
}
}
}