From f75b7f9f0a37a54b3f62355c7d9a57a969c0047e Mon Sep 17 00:00:00 2001 From: campbeb Date: Sat, 17 Mar 2012 10:05:10 +0900 Subject: Prompt user to install missing calendar add-on from Google Play --- main/res/values/strings.xml | 8 ++++++-- main/src/cgeo/geocaching/CacheDetailActivity.java | 24 ++++++++++++++++++++++- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/main/res/values/strings.xml b/main/res/values/strings.xml index 8e7d6ed..f64ea4d 100644 --- a/main/res/values/strings.xml +++ b/main/res/values/strings.xml @@ -774,7 +774,7 @@ Manual Comprehensive manual for c:geo that contains description of all possibilities of this application (even hidden ones). c:geo calendar add-on - c:geo calendar add-on not installed + c:geo calendar add-on not installed. Enables you to export event caches into the calendar on your device. Locus Simple usable application showing Online maps and allowing to download them directly into Offline mode (raster maps only). Also support track recording, POI handling and many other useful functions. @@ -784,7 +784,11 @@ Allows you to use external GPS device to get better reception, more precise location and can spare battery of your phone. Barcode Scanner There are Greasemonkey scripts and websites which allow to display a geocode as barcode. With this app c:geo can read that geocode directly from the screen of your computer. - + + + Missing Add-On + Get it now from Google Play. + Dogs allowed Dogs not allowed diff --git a/main/src/cgeo/geocaching/CacheDetailActivity.java b/main/src/cgeo/geocaching/CacheDetailActivity.java index 4649477..349a73f 100644 --- a/main/src/cgeo/geocaching/CacheDetailActivity.java +++ b/main/src/cgeo/geocaching/CacheDetailActivity.java @@ -121,6 +121,8 @@ public class CacheDetailActivity extends AbstractActivity { private static final int CONTEXT_MENU_WAYPOINT_CACHES_AROUND = 1239; private static final int CONTEXT_MENU_WAYPOINT_DEFAULT_NAVIGATION = 1240; + private static final String CALENDAR_ADDON_URI = "market://details?id=cgeo.calendar"; + private cgGeo geolocation; private cgCache cache; private final Progress progress = new Progress(); @@ -814,7 +816,27 @@ public class CacheDetailActivity extends AbstractActivity { startActivity(new Intent(ICalendar.INTENT, Uri.parse(ICalendar.URI_SCHEME + "://" + ICalendar.URI_HOST + "?" + params.toString()))); } else { - showToast(res.getString(R.string.helper_calendar_missing)); + // Inform user the calendar add-on is not installed and let them get it from Google Play + new AlertDialog.Builder(this) + .setTitle(res.getString(R.string.addon_missing_title)) + .setMessage(new StringBuilder(res.getString(R.string.helper_calendar_missing)) + .append(" ") + .append(res.getString(R.string.addon_download_prompt)) + .toString()) + .setPositiveButton(getString(android.R.string.yes), new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + Intent intent = new Intent(Intent.ACTION_VIEW); + intent.setData(Uri.parse(CALENDAR_ADDON_URI)); + startActivity(intent); + } + }) + .setNegativeButton(getString(android.R.string.no), new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int id) { + dialog.cancel(); + } + }) + .create() + .show(); } } -- cgit v1.1