diff options
author | bananeweizen <bananeweizen@gmx.de> | 2011-09-27 20:15:53 +0200 |
---|---|---|
committer | bananeweizen <bananeweizen@gmx.de> | 2011-09-27 20:15:53 +0200 |
commit | 2b8c492fbe9115347533da4050597aa785d7526c (patch) | |
tree | 56afd0a13a0ae4f3278a5e42b48beece2967faa3 /main/src/cgeo/geocaching/cgeodetail.java | |
parent | b038e34facb59ccc7ef87a35124632f3a5445caa (diff) | |
download | cgeo-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/cgeodetail.java')
-rw-r--r-- | main/src/cgeo/geocaching/cgeodetail.java | 33 |
1 files changed, 6 insertions, 27 deletions
diff --git a/main/src/cgeo/geocaching/cgeodetail.java b/main/src/cgeo/geocaching/cgeodetail.java index 676d719..3f05c82 100644 --- a/main/src/cgeo/geocaching/cgeodetail.java +++ b/main/src/cgeo/geocaching/cgeodetail.java @@ -560,8 +560,11 @@ public class cgeodetail extends AbstractActivity { addToCalendar(); return true; } else if (menuItem == 12) { - shareCache(); - return true; + if (cache != null) { + cache.shareCache(this, res); + return true; + } + return false; } if (NavigationAppFactory.onMenuItemSelected(item, geo, this, res, cache, searchId, null, null)) { return true; @@ -1504,8 +1507,7 @@ public class cgeodetail extends AbstractActivity { eventDate.setSeconds(0); StringBuilder description = new StringBuilder(); - description.append("http://coord.info/"); - description.append(cache.geocode.toUpperCase()); + description.append(cache.getUrl()); description.append("\n\n"); if (StringUtils.isNotBlank(cache.shortdesc)) { description.append(Html.fromHtml(cache.shortdesc).toString()); @@ -1572,29 +1574,6 @@ public class cgeodetail extends AbstractActivity { startActivity(navigateIntent); } - public void shareCache() { - if (geocode == null && cache == null) { - return; - } - - final Intent intent = new Intent(Intent.ACTION_SEND); - intent.setType("text/plain"); - - if (cache != null && cache.geocode != null) { - String subject = cache.geocode.toUpperCase(); - if (StringUtils.isNotBlank(cache.name)) { - subject = subject + " - " + cache.name; - } - intent.putExtra(Intent.EXTRA_SUBJECT, "Geocache " + subject); - intent.putExtra(Intent.EXTRA_TEXT, "http://coord.info/" + cache.geocode.toUpperCase()); - } else if (geocode != null) { - intent.putExtra(Intent.EXTRA_SUBJECT, "Geocache " + geocode.toUpperCase()); - intent.putExtra(Intent.EXTRA_TEXT, "http://coord.info/" + geocode.toUpperCase()); - } - - startActivity(Intent.createChooser(intent, res.getText(R.string.action_bar_share_title))); - } - private class waypointInfo implements View.OnClickListener { private int id = -1; |