diff options
author | Bananeweizen <Bananeweizen@gmx.de> | 2012-02-18 12:01:10 +0100 |
---|---|---|
committer | Bananeweizen <Bananeweizen@gmx.de> | 2012-02-18 12:01:10 +0100 |
commit | 34c0e4065a45c55daf5c230c5d27df2d63703b23 (patch) | |
tree | 65b6164d229552ffcaa0941a372857b511c815be /main/src/cgeo/geocaching/apps | |
parent | 80ca9619a38e105c953da22bdd15f0dd3087aa0e (diff) | |
download | cgeo-34c0e4065a45c55daf5c230c5d27df2d63703b23.zip cgeo-34c0e4065a45c55daf5c230c5d27df2d63703b23.tar.gz cgeo-34c0e4065a45c55daf5c230c5d27df2d63703b23.tar.bz2 |
#945: unify navigation methods
* removed search result parameter from navigation invocation
* removed "fromDetail" differentiation in popup
Diffstat (limited to 'main/src/cgeo/geocaching/apps')
10 files changed, 18 insertions, 37 deletions
diff --git a/main/src/cgeo/geocaching/apps/cache/navi/AbstractPointNavigationApp.java b/main/src/cgeo/geocaching/apps/cache/navi/AbstractPointNavigationApp.java index dc51a15..bf7ebb1 100644 --- a/main/src/cgeo/geocaching/apps/cache/navi/AbstractPointNavigationApp.java +++ b/main/src/cgeo/geocaching/apps/cache/navi/AbstractPointNavigationApp.java @@ -1,6 +1,5 @@ package cgeo.geocaching.apps.cache.navi; -import cgeo.geocaching.SearchResult; import cgeo.geocaching.cgCache; import cgeo.geocaching.cgGeo; import cgeo.geocaching.cgWaypoint; @@ -25,7 +24,7 @@ abstract class AbstractPointNavigationApp extends AbstractNavigationApp { } @Override - public final boolean invoke(cgGeo geo, Activity activity, cgCache cache, SearchResult search, cgWaypoint waypoint, Geopoint coords) { + public final boolean invoke(cgGeo geo, Activity activity, cgCache cache, cgWaypoint waypoint, Geopoint coords) { if (cache == null && waypoint == null && coords == null) { return false; } diff --git a/main/src/cgeo/geocaching/apps/cache/navi/CompassApp.java b/main/src/cgeo/geocaching/apps/cache/navi/CompassApp.java index 3442f9a..b741175 100644 --- a/main/src/cgeo/geocaching/apps/cache/navi/CompassApp.java +++ b/main/src/cgeo/geocaching/apps/cache/navi/CompassApp.java @@ -1,7 +1,6 @@ package cgeo.geocaching.apps.cache.navi; import cgeo.geocaching.R; -import cgeo.geocaching.SearchResult; import cgeo.geocaching.cgCache; import cgeo.geocaching.cgGeo; import cgeo.geocaching.cgWaypoint; @@ -24,7 +23,7 @@ class CompassApp extends AbstractNavigationApp { @Override public boolean invoke(cgGeo geo, Activity activity, cgCache cache, - final SearchResult search, cgWaypoint waypoint, final Geopoint coords) { + cgWaypoint waypoint, final Geopoint coords) { if (cache != null && cache.getGeocode() != null) { cgeonavigate.startActivity(activity, cache.getGeocode(), cache.getName(), cache.getCoords(), null); diff --git a/main/src/cgeo/geocaching/apps/cache/navi/GoogleNavigationApp.java b/main/src/cgeo/geocaching/apps/cache/navi/GoogleNavigationApp.java index 84bfa41..f94a623 100644 --- a/main/src/cgeo/geocaching/apps/cache/navi/GoogleNavigationApp.java +++ b/main/src/cgeo/geocaching/apps/cache/navi/GoogleNavigationApp.java @@ -1,7 +1,6 @@ package cgeo.geocaching.apps.cache.navi; import cgeo.geocaching.R; -import cgeo.geocaching.SearchResult; import cgeo.geocaching.Settings; import cgeo.geocaching.cgCache; import cgeo.geocaching.cgGeo; @@ -27,8 +26,7 @@ class GoogleNavigationApp extends AbstractNavigationApp { } @Override - public boolean invoke(final cgGeo geo, final Activity activity, final cgCache cache, - final SearchResult search, final cgWaypoint waypoint, final Geopoint coords) { + public boolean invoke(final cgGeo geo, final Activity activity, final cgCache cache, final cgWaypoint waypoint, final Geopoint coords) { if (activity == null) { return false; } diff --git a/main/src/cgeo/geocaching/apps/cache/navi/InternalMap.java b/main/src/cgeo/geocaching/apps/cache/navi/InternalMap.java index f8d5c0f..44f151e 100644 --- a/main/src/cgeo/geocaching/apps/cache/navi/InternalMap.java +++ b/main/src/cgeo/geocaching/apps/cache/navi/InternalMap.java @@ -1,7 +1,6 @@ package cgeo.geocaching.apps.cache.navi; import cgeo.geocaching.R; -import cgeo.geocaching.SearchResult; import cgeo.geocaching.cgCache; import cgeo.geocaching.cgGeo; import cgeo.geocaching.cgWaypoint; @@ -20,12 +19,10 @@ class InternalMap extends AbstractNavigationApp { @Override public boolean invoke(cgGeo geo, Activity activity, cgCache cache, - final SearchResult search, cgWaypoint waypoint, final Geopoint coords) { - if (search != null) { - CGeoMap.startActivitySearch(activity, search, cache != null ? cache.getGeocode() : null, true); - } - else if (cache != null) { + cgWaypoint waypoint, final Geopoint coords) { + if (cache != null) { CGeoMap.startActivityGeoCode(activity, cache.getGeocode()); + // may need some code from CGeoMap.startActivitySearch(activity, search, cache != null ? cache.getGeocode() : null, true); } else if (waypoint != null) { CGeoMap.startActivityCoords(activity, waypoint.getCoords(), waypoint.getWaypointType(), waypoint.getName()); diff --git a/main/src/cgeo/geocaching/apps/cache/navi/LocusApp.java b/main/src/cgeo/geocaching/apps/cache/navi/LocusApp.java index 976292b..260d933 100644 --- a/main/src/cgeo/geocaching/apps/cache/navi/LocusApp.java +++ b/main/src/cgeo/geocaching/apps/cache/navi/LocusApp.java @@ -1,6 +1,5 @@ package cgeo.geocaching.apps.cache.navi; -import cgeo.geocaching.SearchResult; import cgeo.geocaching.cgCache; import cgeo.geocaching.cgGeo; import cgeo.geocaching.cgWaypoint; @@ -21,8 +20,7 @@ class LocusApp extends AbstractLocusApp implements NavigationApp { * @author koem */ @Override - public boolean invoke(cgGeo geo, Activity activity, cgCache cache, - final SearchResult search, cgWaypoint waypoint, final Geopoint coords) { + public boolean invoke(cgGeo geo, Activity activity, cgCache cache, cgWaypoint waypoint, final Geopoint coords) { final ArrayList<Object> points = new ArrayList<Object>(); diff --git a/main/src/cgeo/geocaching/apps/cache/navi/NavigationApp.java b/main/src/cgeo/geocaching/apps/cache/navi/NavigationApp.java index 333d1b5..119d27b 100644 --- a/main/src/cgeo/geocaching/apps/cache/navi/NavigationApp.java +++ b/main/src/cgeo/geocaching/apps/cache/navi/NavigationApp.java @@ -1,6 +1,5 @@ package cgeo.geocaching.apps.cache.navi; -import cgeo.geocaching.SearchResult; import cgeo.geocaching.cgCache; import cgeo.geocaching.cgGeo; import cgeo.geocaching.cgWaypoint; @@ -11,7 +10,6 @@ import android.app.Activity; public interface NavigationApp extends App { public boolean invoke(final cgGeo geo, final Activity activity, - final cgCache cache, - final SearchResult search, final cgWaypoint waypoint, + final cgCache cache, final cgWaypoint waypoint, final Geopoint coords); } diff --git a/main/src/cgeo/geocaching/apps/cache/navi/NavigationAppFactory.java b/main/src/cgeo/geocaching/apps/cache/navi/NavigationAppFactory.java index 0ec3a0a..dfef8fa 100644 --- a/main/src/cgeo/geocaching/apps/cache/navi/NavigationAppFactory.java +++ b/main/src/cgeo/geocaching/apps/cache/navi/NavigationAppFactory.java @@ -79,13 +79,12 @@ public final class NavigationAppFactory extends AbstractAppFactory { * @param geo * @param activity * @param cache - * @param search * @param waypoint * @param destination */ public static void showNavigationMenu(final cgGeo geo, final Activity activity, - final cgCache cache, final SearchResult search, final cgWaypoint waypoint, final Geopoint destination) { - showNavigationMenu(geo, activity, cache, search, waypoint, destination, true, false); + final cgCache cache, final cgWaypoint waypoint, final Geopoint destination) { + showNavigationMenu(geo, activity, cache, waypoint, destination, true, false); } /** @@ -96,8 +95,6 @@ public final class NavigationAppFactory extends AbstractAppFactory { * @param activity * @param cache * may be <code>null</code> - * @param search - * may be <code>null</code> * @param waypoint * may be <code>null</code> * @param destination @@ -110,7 +107,7 @@ public final class NavigationAppFactory extends AbstractAppFactory { * @see #showNavigationMenu(cgGeo, Activity, cgCache, SearchResult, cgWaypoint, Geopoint) */ public static void showNavigationMenu(final cgGeo geo, final Activity activity, - final cgCache cache, final SearchResult search, final cgWaypoint waypoint, final Geopoint destination, + final cgCache cache, final cgWaypoint waypoint, final Geopoint destination, final boolean showInternalMap, final boolean showDefaultNavigation) { final AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.setTitle(R.string.cache_menu_navigate); @@ -152,7 +149,7 @@ public final class NavigationAppFactory extends AbstractAppFactory { builder.setAdapter(adapter, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int item) { NavigationAppsEnum selectedItem = adapter.getItem(item); - selectedItem.app.invoke(geo, activity, cache, search, waypoint, destination); + selectedItem.app.invoke(geo, activity, cache, waypoint, destination); } }); final AlertDialog alert = builder.create(); @@ -260,8 +257,7 @@ public final class NavigationAppFactory extends AbstractAppFactory { final NavigationApp app = getAppFromMenuItem(item); if (app != null) { try { - return app.invoke(geo, activity, cache, - search, waypoint, destination); + return app.invoke(geo, activity, cache, waypoint, destination); } catch (Exception e) { Log.e(Settings.tag, "NavigationAppFactory.onMenuItemSelected: " + e.toString()); } @@ -290,12 +286,12 @@ public final class NavigationAppFactory extends AbstractAppFactory { * @param destination */ public static void startDefaultNavigationApplication(final cgGeo geo, Activity activity, cgCache cache, - final SearchResult search, cgWaypoint waypoint, final Geopoint destination) { + cgWaypoint waypoint, final Geopoint destination) { final NavigationApp app = getDefaultNavigationApplication(activity); if (app != null) { try { - app.invoke(geo, activity, cache, search, waypoint, destination); + app.invoke(geo, activity, cache, waypoint, destination); } catch (Exception e) { Log.e(Settings.tag, "NavigationAppFactory.startDefaultNavigationApplication: " + e.toString()); } diff --git a/main/src/cgeo/geocaching/apps/cache/navi/RMapsApp.java b/main/src/cgeo/geocaching/apps/cache/navi/RMapsApp.java index 4fa73c7..a87e61b 100644 --- a/main/src/cgeo/geocaching/apps/cache/navi/RMapsApp.java +++ b/main/src/cgeo/geocaching/apps/cache/navi/RMapsApp.java @@ -1,7 +1,6 @@ package cgeo.geocaching.apps.cache.navi; import cgeo.geocaching.R; -import cgeo.geocaching.SearchResult; import cgeo.geocaching.cgCache; import cgeo.geocaching.cgGeo; import cgeo.geocaching.cgWaypoint; @@ -22,8 +21,7 @@ class RMapsApp extends AbstractNavigationApp { } @Override - public boolean invoke(cgGeo geo, Activity activity, cgCache cache, - final SearchResult search, cgWaypoint waypoint, final Geopoint coords) { + public boolean invoke(cgGeo geo, Activity activity, cgCache cache, cgWaypoint waypoint, final Geopoint coords) { try { final ArrayList<String> locations = new ArrayList<String>(); if (cache != null && cache.getCoords() != null) { diff --git a/main/src/cgeo/geocaching/apps/cache/navi/StaticMapApp.java b/main/src/cgeo/geocaching/apps/cache/navi/StaticMapApp.java index 0bf2f56..a0eb5a1 100644 --- a/main/src/cgeo/geocaching/apps/cache/navi/StaticMapApp.java +++ b/main/src/cgeo/geocaching/apps/cache/navi/StaticMapApp.java @@ -1,7 +1,6 @@ package cgeo.geocaching.apps.cache.navi; import cgeo.geocaching.R; -import cgeo.geocaching.SearchResult; import cgeo.geocaching.StaticMapsActivity; import cgeo.geocaching.cgCache; import cgeo.geocaching.cgGeo; @@ -25,8 +24,7 @@ class StaticMapApp extends AbstractNavigationApp { } @Override - public boolean invoke(cgGeo geo, Activity activity, cgCache cache, - final SearchResult search, cgWaypoint waypoint, final Geopoint coords) { + public boolean invoke(cgGeo geo, Activity activity, cgCache cache, cgWaypoint waypoint, final Geopoint coords) { String geocode = null; if (cache != null && cache.getListId() != 0) { diff --git a/main/src/cgeo/geocaching/apps/cachelist/InternalCacheListMap.java b/main/src/cgeo/geocaching/apps/cachelist/InternalCacheListMap.java index e3cbb4b..5eaefc9 100644 --- a/main/src/cgeo/geocaching/apps/cachelist/InternalCacheListMap.java +++ b/main/src/cgeo/geocaching/apps/cachelist/InternalCacheListMap.java @@ -25,7 +25,7 @@ class InternalCacheListMap extends AbstractApp implements CacheListApp { @Override public boolean invoke(cgGeo geo, List<cgCache> caches, Activity activity, final SearchResult search) { - CGeoMap.startActivitySearch(activity, search, null, false); + CGeoMap.startActivitySearch(activity, search, null); return true; } } |