aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo
diff options
context:
space:
mode:
authorMarco Jacob <mjacob@union06.de>2012-06-08 22:46:12 +0200
committerMarco Jacob <mjacob@union06.de>2012-06-08 22:46:12 +0200
commit40a31725135be73d9f850d83857ca6771135ed70 (patch)
tree0db12face9dfcd009224b3d2b421e5014457d84d /main/src/cgeo
parentb335983a2a9ceef86af0d60ced2cd84397899281 (diff)
downloadcgeo-40a31725135be73d9f850d83857ca6771135ed70.zip
cgeo-40a31725135be73d9f850d83857ca6771135ed70.tar.gz
cgeo-40a31725135be73d9f850d83857ca6771135ed70.tar.bz2
fixes #1725: no static maps apps as default nav app
Diffstat (limited to 'main/src/cgeo')
-rw-r--r--main/src/cgeo/geocaching/SettingsActivity.java3
-rw-r--r--main/src/cgeo/geocaching/apps/AbstractApp.java5
-rw-r--r--main/src/cgeo/geocaching/apps/App.java2
-rw-r--r--main/src/cgeo/geocaching/apps/cache/navi/AbstractStaticMapsApp.java5
-rw-r--r--main/src/cgeo/geocaching/apps/cache/navi/NavigationAppFactory.java15
5 files changed, 29 insertions, 1 deletions
diff --git a/main/src/cgeo/geocaching/SettingsActivity.java b/main/src/cgeo/geocaching/SettingsActivity.java
index b87bd73..cf4a358 100644
--- a/main/src/cgeo/geocaching/SettingsActivity.java
+++ b/main/src/cgeo/geocaching/SettingsActivity.java
@@ -19,6 +19,7 @@ import cgeo.geocaching.utils.LogTemplateProvider;
import cgeo.geocaching.utils.LogTemplateProvider.LogTemplate;
import ch.boye.httpclientandroidlib.HttpResponse;
+
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.ImmutablePair;
@@ -594,7 +595,7 @@ public class SettingsActivity extends AbstractActivity {
// Default navigation tool settings
Spinner defaultNavigationToolSelector = (Spinner) findViewById(R.id.default_navigation_tool);
- final List<NavigationAppsEnum> apps = NavigationAppFactory.getInstalledNavigationApps();
+ final List<NavigationAppsEnum> apps = NavigationAppFactory.getInstalledDefaultNavigationApps();
ArrayAdapter<NavigationAppsEnum> naviAdapter = new ArrayAdapter<NavigationAppsEnum>(this, android.R.layout.simple_spinner_item, apps) {
@Override
public View getView(int position, View convertView, ViewGroup parent) {
diff --git a/main/src/cgeo/geocaching/apps/AbstractApp.java b/main/src/cgeo/geocaching/apps/AbstractApp.java
index 9acc0ae..5bed2d9 100644
--- a/main/src/cgeo/geocaching/apps/AbstractApp.java
+++ b/main/src/cgeo/geocaching/apps/AbstractApp.java
@@ -47,6 +47,11 @@ public abstract class AbstractApp implements App {
}
@Override
+ public boolean isDefaultNavigationApp() {
+ return true;
+ }
+
+ @Override
public String getName() {
return name;
}
diff --git a/main/src/cgeo/geocaching/apps/App.java b/main/src/cgeo/geocaching/apps/App.java
index 2e5e730..9d6d371 100644
--- a/main/src/cgeo/geocaching/apps/App.java
+++ b/main/src/cgeo/geocaching/apps/App.java
@@ -5,6 +5,8 @@ import cgeo.geocaching.cgCache;
public interface App {
public boolean isInstalled();
+ public boolean isDefaultNavigationApp();
+
public String getName();
int getId();
diff --git a/main/src/cgeo/geocaching/apps/cache/navi/AbstractStaticMapsApp.java b/main/src/cgeo/geocaching/apps/cache/navi/AbstractStaticMapsApp.java
index 3716f0c..dacb03f 100644
--- a/main/src/cgeo/geocaching/apps/cache/navi/AbstractStaticMapsApp.java
+++ b/main/src/cgeo/geocaching/apps/cache/navi/AbstractStaticMapsApp.java
@@ -24,6 +24,11 @@ abstract class AbstractStaticMapsApp extends AbstractApp implements CacheNavigat
return true;
}
+ @Override
+ public boolean isDefaultNavigationApp() {
+ return false;
+ }
+
protected static boolean hasStaticMap(cgCache cache) {
String geocode = cache.getGeocode();
if (StringUtils.isNotEmpty(geocode) && cgeoapplication.getInstance().isOffline(geocode, null)) {
diff --git a/main/src/cgeo/geocaching/apps/cache/navi/NavigationAppFactory.java b/main/src/cgeo/geocaching/apps/cache/navi/NavigationAppFactory.java
index cd8fea4..bf0517f 100644
--- a/main/src/cgeo/geocaching/apps/cache/navi/NavigationAppFactory.java
+++ b/main/src/cgeo/geocaching/apps/cache/navi/NavigationAppFactory.java
@@ -178,6 +178,21 @@ public final class NavigationAppFactory extends AbstractAppFactory {
}
/**
+ * Returns all installed navigation apps for default navigation.
+ *
+ * @return
+ */
+ public static List<NavigationAppsEnum> getInstalledDefaultNavigationApps() {
+ final List<NavigationAppsEnum> installedNavigationApps = new ArrayList<NavigationAppsEnum>();
+ for (NavigationAppsEnum appEnum : NavigationAppsEnum.values()) {
+ if (appEnum.app.isInstalled() && appEnum.app.isDefaultNavigationApp()) {
+ installedNavigationApps.add(appEnum);
+ }
+ }
+ return installedNavigationApps;
+ }
+
+ /**
* This offset is used to build unique menu ids to avoid collisions of ids in menus
*/
private static final int MENU_ITEM_OFFSET = 12345;