diff options
Diffstat (limited to 'main/src/cgeo')
| -rw-r--r-- | main/src/cgeo/geocaching/CacheMenuHandler.java | 10 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/Geocache.java | 9 |
2 files changed, 19 insertions, 0 deletions
diff --git a/main/src/cgeo/geocaching/CacheMenuHandler.java b/main/src/cgeo/geocaching/CacheMenuHandler.java index 542f8ef..6937bac 100644 --- a/main/src/cgeo/geocaching/CacheMenuHandler.java +++ b/main/src/cgeo/geocaching/CacheMenuHandler.java @@ -54,6 +54,16 @@ public class CacheMenuHandler extends AbstractUIFactory { case R.id.menu_show_in_browser: cache.openInBrowser(activity); return true; + case R.id.menu_share: + /* If the share menu is a shareActionProvider do nothing and let the share ActionProvider do the work */ + final ShareActionProvider shareActionProvider = (ShareActionProvider) + MenuItemCompat.getActionProvider(item); + if (shareActionProvider == null) { + cache.shareCache(activity, res); + return true; + } else { + return false; + } case R.id.menu_calendar: CalendarAddon.addToCalendarWithIntent(activity, cache); return true; diff --git a/main/src/cgeo/geocaching/Geocache.java b/main/src/cgeo/geocaching/Geocache.java index 14a1313..f3ff487 100644 --- a/main/src/cgeo/geocaching/Geocache.java +++ b/main/src/cgeo/geocaching/Geocache.java @@ -713,6 +713,15 @@ public class Geocache implements ICache, IWaypoint { return getConnector() instanceof ISearchByCenter; } + public void shareCache(final Activity fromActivity, final Resources res) { + if (geocode == null) { + return; + } + + final Intent intent = getShareIntent(); + + fromActivity.startActivity(Intent.createChooser(intent, res.getText(R.string.cache_menu_share))); + } public Intent getShareIntent() { final StringBuilder subject = new StringBuilder("Geocache "); subject.append(geocode); |
