aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/cgeo/geocaching/cgCache.java
diff options
context:
space:
mode:
authorbananeweizen <bananeweizen@gmx.de>2011-09-27 20:15:53 +0200
committerbananeweizen <bananeweizen@gmx.de>2011-09-27 20:15:53 +0200
commit2b8c492fbe9115347533da4050597aa785d7526c (patch)
tree56afd0a13a0ae4f3278a5e42b48beece2967faa3 /main/src/cgeo/geocaching/cgCache.java
parentb038e34facb59ccc7ef87a35124632f3a5445caa (diff)
downloadcgeo-2b8c492fbe9115347533da4050597aa785d7526c.zip
cgeo-2b8c492fbe9115347533da4050597aa785d7526c.tar.gz
cgeo-2b8c492fbe9115347533da4050597aa785d7526c.tar.bz2
fix #554: Forwarding OC-caches not possible
* use getUrl() of caches for forwarding * unify URL construction * move twitter stuff into own class
Diffstat (limited to 'main/src/cgeo/geocaching/cgCache.java')
-rw-r--r--main/src/cgeo/geocaching/cgCache.java23
1 files changed, 23 insertions, 0 deletions
diff --git a/main/src/cgeo/geocaching/cgCache.java b/main/src/cgeo/geocaching/cgCache.java
index 8bea2e3..6fe7331 100644
--- a/main/src/cgeo/geocaching/cgCache.java
+++ b/main/src/cgeo/geocaching/cgCache.java
@@ -466,4 +466,27 @@ public class cgCache implements ICache {
return getConnector().supportsCachesAround();
}
+ public void shareCache(Activity fromActivity, Resources res) {
+ if (geocode == null) {
+ return;
+ }
+
+ StringBuilder subject = new StringBuilder("Geocache ");
+ subject.append(geocode.toUpperCase());
+ if (StringUtils.isNotBlank(name)) {
+ subject.append(" - ").append(name);
+ }
+
+ final Intent intent = new Intent(Intent.ACTION_SEND);
+ intent.setType("text/plain");
+ intent.putExtra(Intent.EXTRA_SUBJECT, subject.toString());
+ intent.putExtra(Intent.EXTRA_TEXT, getUrl());
+
+ fromActivity.startActivity(Intent.createChooser(intent, res.getText(R.string.action_bar_share_title)));
+ }
+
+ public String getUrl() {
+ return getConnector().getCacheUrl(this);
+ }
+
}