aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/apps
diff options
context:
space:
mode:
authorBananeweizen <Bananeweizen@gmx.de>2012-05-19 10:12:01 +0200
committerBananeweizen <Bananeweizen@gmx.de>2012-05-19 10:12:01 +0200
commit75e09e254cb2d5338e16b311ce9be376ddab62a9 (patch)
treedc1f75e0aea32905cb11b66c94d515a3bc167424 /main/src/cgeo/geocaching/apps
parent19309a8c799e22fc180b9d65cee42f20707b7fe8 (diff)
parent06c8e383d3f483c874922c9fa70cd360b09116c1 (diff)
downloadcgeo-75e09e254cb2d5338e16b311ce9be376ddab62a9.zip
cgeo-75e09e254cb2d5338e16b311ce9be376ddab62a9.tar.gz
cgeo-75e09e254cb2d5338e16b311ce9be376ddab62a9.tar.bz2
Merge remote-tracking branch 'marco-jacob/issue#1580-staticMapsOnAnyDestNavigation'
Diffstat (limited to 'main/src/cgeo/geocaching/apps')
-rw-r--r--main/src/cgeo/geocaching/apps/cache/navi/AbstractNavigationApp.java6
-rw-r--r--main/src/cgeo/geocaching/apps/cache/navi/AbstractStaticMapsApp.java7
-rw-r--r--main/src/cgeo/geocaching/apps/cache/navi/DownloadStaticMapsApp.java6
-rw-r--r--main/src/cgeo/geocaching/apps/cache/navi/LocusApp.java4
-rw-r--r--main/src/cgeo/geocaching/apps/cache/navi/NavigationApp.java2
-rw-r--r--main/src/cgeo/geocaching/apps/cache/navi/NavigationAppFactory.java2
-rw-r--r--main/src/cgeo/geocaching/apps/cache/navi/StaticMapApp.java6
7 files changed, 32 insertions, 1 deletions
diff --git a/main/src/cgeo/geocaching/apps/cache/navi/AbstractNavigationApp.java b/main/src/cgeo/geocaching/apps/cache/navi/AbstractNavigationApp.java
index 9d58457..8cb86e7 100644
--- a/main/src/cgeo/geocaching/apps/cache/navi/AbstractNavigationApp.java
+++ b/main/src/cgeo/geocaching/apps/cache/navi/AbstractNavigationApp.java
@@ -2,6 +2,7 @@ package cgeo.geocaching.apps.cache.navi;
import cgeo.geocaching.cgWaypoint;
import cgeo.geocaching.apps.AbstractApp;
+import cgeo.geocaching.geopoint.Geopoint;
abstract class AbstractNavigationApp extends AbstractApp implements NavigationApp {
@@ -17,4 +18,9 @@ abstract class AbstractNavigationApp extends AbstractApp implements NavigationAp
public boolean isEnabled(cgWaypoint waypoint) {
return true;
}
+
+ @Override
+ public boolean isEnabled(Geopoint geopoint) {
+ return false;
+ }
}
diff --git a/main/src/cgeo/geocaching/apps/cache/navi/AbstractStaticMapsApp.java b/main/src/cgeo/geocaching/apps/cache/navi/AbstractStaticMapsApp.java
index 2edd030..23cb982 100644
--- a/main/src/cgeo/geocaching/apps/cache/navi/AbstractStaticMapsApp.java
+++ b/main/src/cgeo/geocaching/apps/cache/navi/AbstractStaticMapsApp.java
@@ -8,6 +8,7 @@ import cgeo.geocaching.cgCache;
import cgeo.geocaching.cgWaypoint;
import cgeo.geocaching.cgeoapplication;
import cgeo.geocaching.activity.ActivityMixin;
+import cgeo.geocaching.geopoint.Geopoint;
import org.apache.commons.lang3.StringUtils;
@@ -56,4 +57,10 @@ abstract class AbstractStaticMapsApp extends AbstractNavigationApp {
return true;
}
+
+ @Override
+ public boolean isEnabled(Geopoint geopoint) {
+ return geopoint == null;
+ }
+
}
diff --git a/main/src/cgeo/geocaching/apps/cache/navi/DownloadStaticMapsApp.java b/main/src/cgeo/geocaching/apps/cache/navi/DownloadStaticMapsApp.java
index e104f9b..1625ef7 100644
--- a/main/src/cgeo/geocaching/apps/cache/navi/DownloadStaticMapsApp.java
+++ b/main/src/cgeo/geocaching/apps/cache/navi/DownloadStaticMapsApp.java
@@ -20,11 +20,17 @@ class DownloadStaticMapsApp extends AbstractStaticMapsApp {
@Override
public boolean isEnabled(cgCache cache) {
+ if (cache == null) {
+ return false;
+ }
return !hasStaticMap(cache);
}
@Override
public boolean isEnabled(cgWaypoint waypoint) {
+ if (waypoint == null) {
+ return false;
+ }
return !hasStaticMap(waypoint);
}
}
diff --git a/main/src/cgeo/geocaching/apps/cache/navi/LocusApp.java b/main/src/cgeo/geocaching/apps/cache/navi/LocusApp.java
index cd2440e..b9d818d 100644
--- a/main/src/cgeo/geocaching/apps/cache/navi/LocusApp.java
+++ b/main/src/cgeo/geocaching/apps/cache/navi/LocusApp.java
@@ -41,4 +41,8 @@ class LocusApp extends AbstractLocusApp implements NavigationApp {
return true;
}
+ @Override
+ public boolean isEnabled(Geopoint geopoint) {
+ return true;
+ }
}
diff --git a/main/src/cgeo/geocaching/apps/cache/navi/NavigationApp.java b/main/src/cgeo/geocaching/apps/cache/navi/NavigationApp.java
index 9ec273e..52d16cf 100644
--- a/main/src/cgeo/geocaching/apps/cache/navi/NavigationApp.java
+++ b/main/src/cgeo/geocaching/apps/cache/navi/NavigationApp.java
@@ -13,4 +13,6 @@ public interface NavigationApp extends App {
final Geopoint coords);
boolean isEnabled(final cgWaypoint waypoint);
+
+ boolean isEnabled(final Geopoint geopoint);
}
diff --git a/main/src/cgeo/geocaching/apps/cache/navi/NavigationAppFactory.java b/main/src/cgeo/geocaching/apps/cache/navi/NavigationAppFactory.java
index 666c443..8184f5a 100644
--- a/main/src/cgeo/geocaching/apps/cache/navi/NavigationAppFactory.java
+++ b/main/src/cgeo/geocaching/apps/cache/navi/NavigationAppFactory.java
@@ -119,7 +119,7 @@ public final class NavigationAppFactory extends AbstractAppFactory {
for (NavigationAppsEnum navApp : getInstalledNavigationApps()) {
if ((showInternalMap || !(navApp.app instanceof InternalMap)) &&
(showDefaultNavigation || defaultNavigationTool != navApp.id)) {
- if ((cache != null && navApp.app.isEnabled(cache)) || (waypoint != null && navApp.app.isEnabled(waypoint)) || destination != null) {
+ if (navApp.app.isEnabled(cache) || navApp.app.isEnabled(waypoint) || navApp.app.isEnabled(destination)) {
items.add(navApp);
}
}
diff --git a/main/src/cgeo/geocaching/apps/cache/navi/StaticMapApp.java b/main/src/cgeo/geocaching/apps/cache/navi/StaticMapApp.java
index 078343b..d805656 100644
--- a/main/src/cgeo/geocaching/apps/cache/navi/StaticMapApp.java
+++ b/main/src/cgeo/geocaching/apps/cache/navi/StaticMapApp.java
@@ -20,11 +20,17 @@ class StaticMapApp extends AbstractStaticMapsApp {
@Override
public boolean isEnabled(cgCache cache) {
+ if (cache == null) {
+ return false;
+ }
return hasStaticMap(cache);
}
@Override
public boolean isEnabled(cgWaypoint waypoint) {
+ if (waypoint == null) {
+ return false;
+ }
return hasStaticMap(waypoint);
}
}