diff options
author | Marco Jacob <mjacob@union06.de> | 2012-01-14 21:07:47 +0100 |
---|---|---|
committer | Marco Jacob <mjacob@union06.de> | 2012-01-14 21:07:47 +0100 |
commit | 7fcca178c44c08aae6aa81516b1090401a7d2658 (patch) | |
tree | 47b870e83456f8d63bbee61034622befff7a5c95 /main/src/cgeo/geocaching/apps/cache/navi | |
parent | 78e4138738fb948eee5db9795c8d00ab6656d615 (diff) | |
parent | e61a40fc8a4a3d5ab5a59346eddd1c43bcc4857e (diff) | |
download | cgeo-7fcca178c44c08aae6aa81516b1090401a7d2658.zip cgeo-7fcca178c44c08aae6aa81516b1090401a7d2658.tar.gz cgeo-7fcca178c44c08aae6aa81516b1090401a7d2658.tar.bz2 |
Merge git://github.com/cgeo/c-geo-opensource
Diffstat (limited to 'main/src/cgeo/geocaching/apps/cache/navi')
-rw-r--r-- | main/src/cgeo/geocaching/apps/cache/navi/NavigationAppFactory.java | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/main/src/cgeo/geocaching/apps/cache/navi/NavigationAppFactory.java b/main/src/cgeo/geocaching/apps/cache/navi/NavigationAppFactory.java index bfda2ea..67ecfed 100644 --- a/main/src/cgeo/geocaching/apps/cache/navi/NavigationAppFactory.java +++ b/main/src/cgeo/geocaching/apps/cache/navi/NavigationAppFactory.java @@ -1,5 +1,6 @@ package cgeo.geocaching.apps.cache.navi; +import cgeo.geocaching.R; import cgeo.geocaching.SearchResult; import cgeo.geocaching.Settings; import cgeo.geocaching.cgCache; @@ -11,6 +12,8 @@ import cgeo.geocaching.geopoint.Geopoint; import org.apache.commons.lang3.ArrayUtils; import android.app.Activity; +import android.app.AlertDialog; +import android.content.DialogInterface; import android.util.Log; import android.view.Menu; import android.view.MenuItem; @@ -54,6 +57,25 @@ public final class NavigationAppFactory extends AbstractAppFactory { } } + public static void showNavigationMenu(final cgGeo geo, final Activity activity, final cgCache cache, final SearchResult search) { + AlertDialog.Builder builder = new AlertDialog.Builder(activity); + builder.setTitle(R.string.cache_menu_navigate); + builder.setIcon(android.R.drawable.ic_menu_mapmode); + final List<NavigationApp> installed = getInstalledNavigationApps(activity); + String[] items = new String[installed.size()]; + for (int i = 0; i < installed.size(); i++) { + items[i] = installed.get(i).getName(); + } + builder.setItems(items, new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int item) { + installed.get(item).invoke(geo, activity, cache, search, null, null); + } + }); + AlertDialog alert = builder.create(); + alert.show(); + + } + public static List<NavigationApp> getInstalledNavigationApps(final Activity activity) { final List<NavigationApp> installedNavigationApps = new ArrayList<NavigationApp>(); for (NavigationApp app : getNavigationApps()) { |