diff options
author | Torsten Keil <github@torsten-keil.net> | 2012-01-14 21:57:16 +0100 |
---|---|---|
committer | Torsten Keil <github@torsten-keil.net> | 2012-01-14 21:57:16 +0100 |
commit | 85897b9e368b4f85377e5cfb7fd6c8a5185d1531 (patch) | |
tree | adef96e9b7ca4784f1c802ef9b2731079e0e710a /main/src/cgeo/geocaching | |
parent | e61a40fc8a4a3d5ab5a59346eddd1c43bcc4857e (diff) | |
download | cgeo-85897b9e368b4f85377e5cfb7fd6c8a5185d1531.zip cgeo-85897b9e368b4f85377e5cfb7fd6c8a5185d1531.tar.gz cgeo-85897b9e368b4f85377e5cfb7fd6c8a5185d1531.tar.bz2 |
Implementation for issue #985: replace term standard navigation
Diffstat (limited to 'main/src/cgeo/geocaching')
-rw-r--r-- | main/src/cgeo/geocaching/CacheDetailActivity.java | 4 | ||||
-rw-r--r-- | main/src/cgeo/geocaching/apps/cache/navi/NavigationAppFactory.java | 21 | ||||
-rw-r--r-- | main/src/cgeo/geocaching/cgeocaches.java | 2 | ||||
-rw-r--r-- | main/src/cgeo/geocaching/cgeopoint.java | 2 | ||||
-rw-r--r-- | main/src/cgeo/geocaching/cgeopopup.java | 2 | ||||
-rw-r--r-- | main/src/cgeo/geocaching/cgeowaypoint.java | 2 |
6 files changed, 19 insertions, 14 deletions
diff --git a/main/src/cgeo/geocaching/CacheDetailActivity.java b/main/src/cgeo/geocaching/CacheDetailActivity.java index 5fa4c55..325ef38 100644 --- a/main/src/cgeo/geocaching/CacheDetailActivity.java +++ b/main/src/cgeo/geocaching/CacheDetailActivity.java @@ -384,7 +384,7 @@ public class CacheDetailActivity extends AbstractActivity { menu.add(CONTEXT_MENU_WAYPOINT_DELETE, index, 0, R.string.waypoint_delete); } if (waypoint.getCoords() != null) { - menu.add(CONTEXT_MENU_WAYPOINT_DEFAULT_NAVIGATION, index, 0, R.string.cache_menu_default_navigation); + menu.add(CONTEXT_MENU_WAYPOINT_DEFAULT_NAVIGATION, index, 0, NavigationAppFactory.getDefaultNavigationApplication(this).getName()); SubMenu subMenu = menu.addSubMenu(CONTEXT_MENU_WAYPOINT_NAVIGATE, index, 0, R.string.cache_menu_navigate).setIcon(android.R.drawable.ic_menu_mapmode); NavigationAppFactory.addMenuItems(subMenu, this); menu.add(CONTEXT_MENU_WAYPOINT_CACHES_AROUND, index, 0, R.string.cache_menu_around); @@ -476,7 +476,7 @@ public class CacheDetailActivity extends AbstractActivity { @Override public boolean onCreateOptionsMenu(Menu menu) { if (null != cache) { - menu.add(0, MENU_DEFAULT_NAVIGATION, 0, res.getString(R.string.cache_menu_default_navigation)).setIcon(android.R.drawable.ic_menu_compass); // default navigation tool + menu.add(0, MENU_DEFAULT_NAVIGATION, 0, NavigationAppFactory.getDefaultNavigationApplication(this).getName()).setIcon(android.R.drawable.ic_menu_compass); // default navigation tool final SubMenu subMenu = menu.addSubMenu(1, 0, 0, res.getString(R.string.cache_menu_navigate)).setIcon(android.R.drawable.ic_menu_mapmode); NavigationAppFactory.addMenuItems(subMenu, this); diff --git a/main/src/cgeo/geocaching/apps/cache/navi/NavigationAppFactory.java b/main/src/cgeo/geocaching/apps/cache/navi/NavigationAppFactory.java index 67ecfed..5bad5ea 100644 --- a/main/src/cgeo/geocaching/apps/cache/navi/NavigationAppFactory.java +++ b/main/src/cgeo/geocaching/apps/cache/navi/NavigationAppFactory.java @@ -118,6 +118,18 @@ public final class NavigationAppFactory extends AbstractAppFactory { public static void startDefaultNavigationApplication(final cgGeo geo, Activity activity, cgCache cache, final SearchResult search, cgWaypoint waypoint, final Geopoint destination) { + NavigationApp app = getDefaultNavigationApplication(activity); + + if (app != null) { + try { + app.invoke(geo, activity, cache, search, waypoint, destination); + } catch (Exception e) { + Log.e(Settings.tag, "NavigationAppFactory.startDefaultNavigationApplication: " + e.toString()); + } + } + } + + public static NavigationApp getDefaultNavigationApplication(Activity activity) { final int defaultNavigationTool = Settings.getDefaultNavigationTool(); NavigationApp app = null; @@ -134,14 +146,7 @@ public final class NavigationAppFactory extends AbstractAppFactory { } } } - - if (app != null) { - try { - app.invoke(geo, activity, cache, search, waypoint, destination); - } catch (Exception e) { - Log.e(Settings.tag, "NavigationAppFactory.startDefaultNavigationApplication: " + e.toString()); - } - } + return app; } } diff --git a/main/src/cgeo/geocaching/cgeocaches.java b/main/src/cgeo/geocaching/cgeocaches.java index aa90336..01465e9 100644 --- a/main/src/cgeo/geocaching/cgeocaches.java +++ b/main/src/cgeo/geocaching/cgeocaches.java @@ -1147,7 +1147,7 @@ public class cgeocaches extends AbstractListActivity { } if (cache.getCoords() != null) { - menu.add(0, MENU_DEFAULT_NAVIGATION, 0, res.getString(R.string.cache_menu_default_navigation)); + menu.add(0, MENU_DEFAULT_NAVIGATION, 0, NavigationAppFactory.getDefaultNavigationApplication(this).getName()); final SubMenu subMenu = menu.addSubMenu(1, 0, 0, res.getString(R.string.cache_menu_navigate)).setIcon(android.R.drawable.ic_menu_mapmode); NavigationAppFactory.addMenuItems(subMenu, this); addVisitMenu(menu, cache); diff --git a/main/src/cgeo/geocaching/cgeopoint.java b/main/src/cgeo/geocaching/cgeopoint.java index e44a4e1..5d109c4 100644 --- a/main/src/cgeo/geocaching/cgeopoint.java +++ b/main/src/cgeo/geocaching/cgeopoint.java @@ -301,7 +301,7 @@ public class cgeopoint extends AbstractActivity { @Override public boolean onCreateOptionsMenu(Menu menu) { - menu.add(0, MENU_DEFAULT_NAVIGATION, 0, res.getString(R.string.cache_menu_default_navigation)).setIcon(android.R.drawable.ic_menu_compass); // default navigation tool + menu.add(0, MENU_DEFAULT_NAVIGATION, 0, NavigationAppFactory.getDefaultNavigationApplication(this).getName()).setIcon(android.R.drawable.ic_menu_compass); // default navigation tool SubMenu subMenu = menu.addSubMenu(1, MENU_NAVIGATE, 0, res.getString(R.string.cache_menu_navigate)).setIcon(android.R.drawable.ic_menu_more); NavigationAppFactory.addMenuItems(subMenu, this); diff --git a/main/src/cgeo/geocaching/cgeopopup.java b/main/src/cgeo/geocaching/cgeopopup.java index bdc3d1b..2fe1805 100644 --- a/main/src/cgeo/geocaching/cgeopopup.java +++ b/main/src/cgeo/geocaching/cgeopopup.java @@ -133,7 +133,7 @@ public class cgeopopup extends AbstractActivity { @Override public boolean onCreateOptionsMenu(Menu menu) { - menu.add(0, 2, 0, res.getString(R.string.cache_menu_default_navigation)).setIcon(android.R.drawable.ic_menu_compass); // default navigation tool + menu.add(0, 2, 0, NavigationAppFactory.getDefaultNavigationApplication(this).getName()).setIcon(android.R.drawable.ic_menu_compass); // default navigation tool SubMenu subMenu = menu.addSubMenu(1, 0, 0, res.getString(R.string.cache_menu_navigate)).setIcon(android.R.drawable.ic_menu_mapmode); NavigationAppFactory.addMenuItems(subMenu, this); diff --git a/main/src/cgeo/geocaching/cgeowaypoint.java b/main/src/cgeo/geocaching/cgeowaypoint.java index 3d35189..addc4fe 100644 --- a/main/src/cgeo/geocaching/cgeowaypoint.java +++ b/main/src/cgeo/geocaching/cgeowaypoint.java @@ -209,7 +209,7 @@ public class cgeowaypoint extends AbstractActivity { @Override public boolean onCreateOptionsMenu(Menu menu) { - menu.add(0, MENU_ID_DEFAULT_NAVIGATION, 0, res.getString(R.string.cache_menu_default_navigation)).setIcon(android.R.drawable.ic_menu_compass); // default navigation tool + menu.add(0, MENU_ID_DEFAULT_NAVIGATION, 0, NavigationAppFactory.getDefaultNavigationApplication(this).getName()).setIcon(android.R.drawable.ic_menu_compass); // default navigation tool SubMenu subMenu = menu.addSubMenu(1, MENU_ID_NAVIGATION, 0, res.getString(R.string.cache_menu_navigate)).setIcon(android.R.drawable.ic_menu_mapmode); addNavigationMenuItems(subMenu); |