aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/apps/cache
diff options
context:
space:
mode:
authorMarco Jacob <mjacob@union06.de>2012-05-04 22:51:19 +0200
committerMarco Jacob <mjacob@union06.de>2012-05-04 22:51:19 +0200
commit382f769741372593ce62fa0f35f95ce9579d5f72 (patch)
treed9ba02d96cfa7fc8f413f3bceaa5dfa9ced808ad /main/src/cgeo/geocaching/apps/cache
parent7424d471c8b57dbce2acf79c09660bf1a7222b3e (diff)
downloadcgeo-382f769741372593ce62fa0f35f95ce9579d5f72.zip
cgeo-382f769741372593ce62fa0f35f95ce9579d5f72.tar.gz
cgeo-382f769741372593ce62fa0f35f95ce9579d5f72.tar.bz2
added navigation app for downloading static maps
Diffstat (limited to 'main/src/cgeo/geocaching/apps/cache')
-rw-r--r--main/src/cgeo/geocaching/apps/cache/navi/DownloadStaticMapsApp.java46
1 files changed, 46 insertions, 0 deletions
diff --git a/main/src/cgeo/geocaching/apps/cache/navi/DownloadStaticMapsApp.java b/main/src/cgeo/geocaching/apps/cache/navi/DownloadStaticMapsApp.java
new file mode 100644
index 0000000..d43cfc9
--- /dev/null
+++ b/main/src/cgeo/geocaching/apps/cache/navi/DownloadStaticMapsApp.java
@@ -0,0 +1,46 @@
+package cgeo.geocaching.apps.cache.navi;
+
+import cgeo.geocaching.IGeoData;
+import cgeo.geocaching.ILogable;
+import cgeo.geocaching.R;
+import cgeo.geocaching.StaticMapsActivity;
+import cgeo.geocaching.cgCache;
+import cgeo.geocaching.cgWaypoint;
+import cgeo.geocaching.activity.ActivityMixin;
+import cgeo.geocaching.geopoint.Geopoint;
+
+import android.app.Activity;
+import android.content.Context;
+import android.content.Intent;
+
+class DownloadStaticMapsApp extends AbstractNavigationApp {
+
+ DownloadStaticMapsApp() {
+ super(getString(R.string.cache_menu_download_map_static), null);
+ }
+
+ @Override
+ public boolean isInstalled(Context context) {
+ return true;
+ }
+
+ @Override
+ public boolean invoke(IGeoData geo, Activity activity, cgCache cache, cgWaypoint waypoint, final Geopoint coords) {
+ final ILogable logable = cache != null && cache.getListId() != 0 ? cache : waypoint;
+ final String geocode = logable.getGeocode().toUpperCase();
+ if (geocode == null) {
+ ActivityMixin.showToast(activity, getString(R.string.err_detail_no_map_static));
+ return true;
+ }
+
+ final Intent intent = new Intent(activity, StaticMapsActivity.class);
+ intent.putExtra("download", true);
+ intent.putExtra("geocode", geocode);
+ if (waypoint != null) {
+ intent.putExtra("waypoint", waypoint.getId());
+ }
+ activity.startActivity(intent);
+
+ return true;
+ }
+}