diff options
| author | Bananeweizen <bananeweizen@gmx.de> | 2011-10-24 08:07:35 +0200 |
|---|---|---|
| committer | Bananeweizen <bananeweizen@gmx.de> | 2011-10-24 08:07:35 +0200 |
| commit | e5efa831a88cab7675b65a3fb596990d88975ee2 (patch) | |
| tree | a2925262ccd9b3e9999a19b94036b64f3b4faff2 /main/src | |
| parent | c7cdd4a13083094ef9160eacc88137a1befd7a03 (diff) | |
| download | cgeo-e5efa831a88cab7675b65a3fb596990d88975ee2.zip cgeo-e5efa831a88cab7675b65a3fb596990d88975ee2.tar.gz cgeo-e5efa831a88cab7675b65a3fb596990d88975ee2.tar.bz2 | |
new: invoke all other navigation tools from map options menu
Diffstat (limited to 'main/src')
| -rw-r--r-- | main/src/cgeo/geocaching/apps/cache/navi/NavigationAppFactory.java | 15 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/maps/CGeoMap.java | 9 |
2 files changed, 20 insertions, 4 deletions
diff --git a/main/src/cgeo/geocaching/apps/cache/navi/NavigationAppFactory.java b/main/src/cgeo/geocaching/apps/cache/navi/NavigationAppFactory.java index 15ee464..1ee7c23 100644 --- a/main/src/cgeo/geocaching/apps/cache/navi/NavigationAppFactory.java +++ b/main/src/cgeo/geocaching/apps/cache/navi/NavigationAppFactory.java @@ -1,8 +1,8 @@ package cgeo.geocaching.apps.cache.navi; +import cgeo.geocaching.Settings; import cgeo.geocaching.cgCache; import cgeo.geocaching.cgGeo; -import cgeo.geocaching.Settings; import cgeo.geocaching.cgWaypoint; import cgeo.geocaching.apps.AbstractAppFactory; import cgeo.geocaching.geopoint.Geopoint; @@ -37,11 +37,18 @@ public final class NavigationAppFactory extends AbstractAppFactory { return apps; } - public static void addMenuItems(Menu menu, Activity activity, - Resources res) { + public static void addMenuItems(final Menu menu, final Activity activity, + final Resources res) { + addMenuItems(menu, activity, res, true); + } + + public static void addMenuItems(final Menu menu, final Activity activity, + final Resources res, final boolean showInternalMap) { for (NavigationApp app : getNavigationApps(res)) { if (app.isInstalled(activity)) { - menu.add(0, app.getId(), 0, app.getName()); + if (showInternalMap || !(app instanceof InternalMap)) { + menu.add(0, app.getId(), 0, app.getName()); + } } } } diff --git a/main/src/cgeo/geocaching/maps/CGeoMap.java b/main/src/cgeo/geocaching/maps/CGeoMap.java index 78232a0..6f85027 100644 --- a/main/src/cgeo/geocaching/maps/CGeoMap.java +++ b/main/src/cgeo/geocaching/maps/CGeoMap.java @@ -16,6 +16,7 @@ import cgeo.geocaching.cgWaypoint; import cgeo.geocaching.cgeoapplication; import cgeo.geocaching.cgeocaches; import cgeo.geocaching.activity.ActivityMixin; +import cgeo.geocaching.apps.cache.navi.NavigationAppFactory; import cgeo.geocaching.enumerations.WaypointType; import cgeo.geocaching.geopoint.Geopoint; import cgeo.geocaching.maps.interfaces.CachesOverlayItemImpl; @@ -78,6 +79,7 @@ public class CGeoMap extends AbstractMap implements OnDragListener, ViewFactory private static final int MENU_TRAIL_MODE = 4; private static final int MENU_CIRCLE_MODE = 5; private static final int MENU_AS_LIST = 6; + private static final int MENU_NAVIGATE = 7; private static final int SUBMENU_VIEW_GOOGLE_MAP = 10; private static final int SUBMENU_VIEW_GOOGLE_SAT = 11; @@ -505,6 +507,8 @@ public class CGeoMap extends AbstractMap implements OnDragListener, ViewFactory menu.add(0, MENU_TRAIL_MODE, 0, res.getString(R.string.map_trail_hide)).setIcon(android.R.drawable.ic_menu_recent_history); menu.add(0, MENU_CIRCLE_MODE, 0, res.getString(R.string.map_circles_hide)).setIcon(R.drawable.ic_menu_circle); menu.add(0, MENU_AS_LIST, 0, res.getString(R.string.map_as_list)).setIcon(android.R.drawable.ic_menu_agenda); + submenu = menu.addSubMenu(2, MENU_NAVIGATE, 0, res.getString(R.string.cache_menu_navigate)).setIcon(android.R.drawable.ic_menu_more); + NavigationAppFactory.addMenuItems(submenu, this.activity, res, false); return true; } @@ -561,6 +565,8 @@ public class CGeoMap extends AbstractMap implements OnDragListener, ViewFactory item = menu.findItem(MENU_AS_LIST); item.setVisible(live); item.setEnabled(CollectionUtils.isNotEmpty(caches)); + + menu.findItem(MENU_NAVIGATE).setEnabled(cachesCnt <= 1); } catch (Exception e) { Log.e(Settings.tag, "cgeomap.onPrepareOptionsMenu: " + e.toString()); } @@ -708,6 +714,9 @@ public class CGeoMap extends AbstractMap implements OnDragListener, ViewFactory return true; } + else { + NavigationAppFactory.onMenuItemSelected(item, geo, activity, res, caches != null && caches.size() > 0 ? caches.get(0) : null, searchId, null, coordsIntent); + } break; } return false; |
