diff options
author | Marco Jacob <mjacob@union06.de> | 2012-05-16 20:56:51 +0200 |
---|---|---|
committer | Marco Jacob <mjacob@union06.de> | 2012-05-16 20:56:51 +0200 |
commit | faf78fc0e3f6442c6f6bf29b783ad3384c6f6565 (patch) | |
tree | 788bd9fec99b6e082ee4b5c995f893f7a943f235 /main/src/cgeo/geocaching/apps | |
parent | f7ffa6ec91937a81415c6251583d951bbe3abd0e (diff) | |
download | cgeo-faf78fc0e3f6442c6f6bf29b783ad3384c6f6565.zip cgeo-faf78fc0e3f6442c6f6bf29b783ad3384c6f6565.tar.gz cgeo-faf78fc0e3f6442c6f6bf29b783ad3384c6f6565.tar.bz2 |
fixes #1580: No static maps item on any destination navigation menu
Diffstat (limited to 'main/src/cgeo/geocaching/apps')
7 files changed, 38 insertions, 19 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..979a030 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 true; + } } diff --git a/main/src/cgeo/geocaching/apps/cache/navi/AbstractStaticMapsApp.java b/main/src/cgeo/geocaching/apps/cache/navi/AbstractStaticMapsApp.java index ffcac8e..d6e82ec 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; @@ -66,4 +67,28 @@ abstract class AbstractStaticMapsApp extends AbstractNavigationApp { return true; } + @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); + } + + @Override + public boolean isEnabled(Geopoint geopoint) { + if (geopoint == null) { + return true; + } + return false; + } + } diff --git a/main/src/cgeo/geocaching/apps/cache/navi/DownloadStaticMapsApp.java b/main/src/cgeo/geocaching/apps/cache/navi/DownloadStaticMapsApp.java index e104f9b..d9434f8 100644 --- a/main/src/cgeo/geocaching/apps/cache/navi/DownloadStaticMapsApp.java +++ b/main/src/cgeo/geocaching/apps/cache/navi/DownloadStaticMapsApp.java @@ -18,13 +18,4 @@ class DownloadStaticMapsApp extends AbstractStaticMapsApp { return invoke(activity, cache, waypoint, true); } - @Override - public boolean isEnabled(cgCache cache) { - return !hasStaticMap(cache); - } - - @Override - public boolean isEnabled(cgWaypoint waypoint) { - 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..4680778 100644 --- a/main/src/cgeo/geocaching/apps/cache/navi/StaticMapApp.java +++ b/main/src/cgeo/geocaching/apps/cache/navi/StaticMapApp.java @@ -18,13 +18,4 @@ class StaticMapApp extends AbstractStaticMapsApp { return invoke(activity, cache, waypoint, false); } - @Override - public boolean isEnabled(cgCache cache) { - return hasStaticMap(cache); - } - - @Override - public boolean isEnabled(cgWaypoint waypoint) { - return hasStaticMap(waypoint); - } } |