diff options
| author | SammysHP <sven@sammyshp.de> | 2013-03-08 10:47:30 +0100 |
|---|---|---|
| committer | SammysHP <sven@sammyshp.de> | 2013-03-08 10:47:30 +0100 |
| commit | 7e580ae62220814ff4d5092860faf6788a31bb99 (patch) | |
| tree | 580573971572de0f4c85758a854deb3fe37d5fd5 /main/src | |
| parent | 3b28333928e68736273e7105aa05b67fc89f04f8 (diff) | |
| download | cgeo-7e580ae62220814ff4d5092860faf6788a31bb99.zip cgeo-7e580ae62220814ff4d5092860faf6788a31bb99.tar.gz cgeo-7e580ae62220814ff4d5092860faf6788a31bb99.tar.bz2 | |
Fix #2258: Share function should use http://coord.info/ URL
Diffstat (limited to 'main/src')
4 files changed, 29 insertions, 6 deletions
diff --git a/main/src/cgeo/geocaching/Geocache.java b/main/src/cgeo/geocaching/Geocache.java index e672ca8..9a8325d 100644 --- a/main/src/cgeo/geocaching/Geocache.java +++ b/main/src/cgeo/geocaching/Geocache.java @@ -516,13 +516,17 @@ public class Geocache implements ICache, IWaypoint { } public void openInBrowser(Activity fromActivity) { - fromActivity.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(getCacheUrl()))); + fromActivity.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(getBrowserCacheUrl()))); } private String getCacheUrl() { return getConnector().getCacheUrl(this); } + private String getBrowserCacheUrl() { + return getConnector().getLongCacheUrl(this); + } + private IConnector getConnector() { return ConnectorFactory.getConnector(this); } diff --git a/main/src/cgeo/geocaching/connector/AbstractConnector.java b/main/src/cgeo/geocaching/connector/AbstractConnector.java index 1eb8fbb..413291c 100644 --- a/main/src/cgeo/geocaching/connector/AbstractConnector.java +++ b/main/src/cgeo/geocaching/connector/AbstractConnector.java @@ -102,6 +102,11 @@ public abstract class AbstractConnector implements IConnector { abstract protected String getCacheUrlPrefix(); + @Override + public String getLongCacheUrl(final Geocache cache) { + return getCacheUrl(cache); + } + /** * {@link IConnector} */ diff --git a/main/src/cgeo/geocaching/connector/IConnector.java b/main/src/cgeo/geocaching/connector/IConnector.java index da626f2..9169b4a 100644 --- a/main/src/cgeo/geocaching/connector/IConnector.java +++ b/main/src/cgeo/geocaching/connector/IConnector.java @@ -1,7 +1,7 @@ package cgeo.geocaching.connector; -import cgeo.geocaching.ICache; import cgeo.geocaching.Geocache; +import cgeo.geocaching.ICache; import cgeo.geocaching.enumerations.CacheRealm; import cgeo.geocaching.geopoint.Geopoint; @@ -30,6 +30,14 @@ public interface IConnector { public String getCacheUrl(final Geocache cache); /** + * get long browser URL for the given cache + * + * @param cache + * @return + */ + public String getLongCacheUrl(final Geocache cache); + + /** * enable/disable watchlist controls in cache details * * @return diff --git a/main/src/cgeo/geocaching/connector/gc/GCConnector.java b/main/src/cgeo/geocaching/connector/gc/GCConnector.java index 2a38bd9..50bf096 100644 --- a/main/src/cgeo/geocaching/connector/gc/GCConnector.java +++ b/main/src/cgeo/geocaching/connector/gc/GCConnector.java @@ -24,7 +24,9 @@ import java.util.regex.Pattern; public class GCConnector extends AbstractConnector implements ISearchByGeocode, ISearchByCenter, ISearchByViewPort { - private static final String HTTP_COORD_INFO = "http://coord.info/"; + private static final String CACHE_URL_SHORT = "http://coord.info/"; + // Double slash is used to force open in browser + private static final String CACHE_URL_LONG = "http://www.geocaching.com//seek/cache_details.aspx?wp="; private static final Pattern gpxZipFilePattern = Pattern.compile("\\d{7,}(_.+)?\\.zip", Pattern.CASE_INSENSITIVE); private GCConnector() { @@ -51,9 +53,13 @@ public class GCConnector extends AbstractConnector implements ISearchByGeocode, } @Override + public String getLongCacheUrl(Geocache cache) { + return CACHE_URL_LONG + cache.getGeocode(); + } + + @Override public String getCacheUrl(Geocache cache) { - // it would also be possible to use "http://www.geocaching.com/seek/cache_details.aspx?wp=" + cache.getGeocode(); - return "http://www.geocaching.com//seek/cache_details.aspx?wp=" + cache.getGeocode(); + return CACHE_URL_SHORT + cache.getGeocode(); } @Override @@ -224,7 +230,7 @@ public class GCConnector extends AbstractConnector implements ISearchByGeocode, @Override protected String getCacheUrlPrefix() { - return HTTP_COORD_INFO; + return CACHE_URL_SHORT; } @Override |
