From 9c7e6cdd942515dea532bced4fb7cccff7fea6ad Mon Sep 17 00:00:00 2001 From: Torsten Keil Date: Mon, 2 Jan 2012 20:34:56 +0100 Subject: Small changes for the pull request. --- .../apps/cache/navi/NavigationAppFactory.java | 24 ++++++++++------------ 1 file changed, 11 insertions(+), 13 deletions(-) (limited to 'main/src/cgeo/geocaching/apps') diff --git a/main/src/cgeo/geocaching/apps/cache/navi/NavigationAppFactory.java b/main/src/cgeo/geocaching/apps/cache/navi/NavigationAppFactory.java index b761fc1..03541d0 100644 --- a/main/src/cgeo/geocaching/apps/cache/navi/NavigationAppFactory.java +++ b/main/src/cgeo/geocaching/apps/cache/navi/NavigationAppFactory.java @@ -41,16 +41,16 @@ public final class NavigationAppFactory extends AbstractAppFactory { public static void addMenuItems(final Menu menu, final Activity activity, final Resources res) { - addMenuItems(menu, activity, res, true); + addMenuItems(menu, activity, res, true, false); } 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)) { - if (showInternalMap || !(app instanceof InternalMap)) { - menu.add(0, app.getId(), 0, app.getName()); - } + final Resources res, final boolean showInternalMap, final boolean showDefaultNavigation) { + int defaultNavigationTool = Settings.getDefaultNavigationTool(); + for (NavigationApp app : getInstalledNavigationApps(activity, res)) { + if ((showInternalMap || !(app instanceof InternalMap)) && + (showDefaultNavigation || defaultNavigationTool != app.getId())) { + menu.add(0, app.getId(), 0, app.getName()); } } } @@ -67,13 +67,11 @@ public final class NavigationAppFactory extends AbstractAppFactory { public static int getOrdinalFromId(final Activity activity, final Resources res, final int id) { int ordinal = 0; - for (NavigationApp app : getNavigationApps(res)) { - if (app.isInstalled(activity)) { - if (app.getId() == id) { - return ordinal; - } - ordinal++; + for (NavigationApp app : getInstalledNavigationApps(activity, res)) { + if (app.getId() == id) { + return ordinal; } + ordinal++; } return 0; } -- cgit v1.1