diff options
Diffstat (limited to 'main/src/cgeo/geocaching/Geocache.java')
| -rw-r--r-- | main/src/cgeo/geocaching/Geocache.java | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/main/src/cgeo/geocaching/Geocache.java b/main/src/cgeo/geocaching/Geocache.java index db36740..0000fcc 100644 --- a/main/src/cgeo/geocaching/Geocache.java +++ b/main/src/cgeo/geocaching/Geocache.java @@ -1,7 +1,9 @@ package cgeo.geocaching; +import android.os.Parcelable; import cgeo.geocaching.DataStore.StorageLocation; import cgeo.geocaching.activity.ActivityMixin; +import cgeo.geocaching.activity.SimpleWebviewActivity; import cgeo.geocaching.connector.ConnectorFactory; import cgeo.geocaching.connector.IConnector; import cgeo.geocaching.connector.ILoggingManager; @@ -497,9 +499,25 @@ public class Geocache implements ICache, IWaypoint { } public void openInBrowser(Activity fromActivity) { - fromActivity.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(getBrowserCacheUrl()))); + Intent viewIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(getUrl())); + + // Check if cgeo is the default, show the chooser to let the user choose a browser + if (viewIntent.resolveActivity(fromActivity.getPackageManager()).getPackageName().equals(fromActivity.getPackageName())) { + Intent chooser = Intent.createChooser(viewIntent, fromActivity.getString(R.string.cache_menu_browser)); + + Intent internalBrowser = new Intent(fromActivity, SimpleWebviewActivity.class); + internalBrowser.setData(Uri.parse(getUrl())); + + chooser.putExtra(Intent.EXTRA_INITIAL_INTENTS, new Parcelable[] {internalBrowser}); + + + fromActivity.startActivity(chooser); + } + else + fromActivity.startActivity(viewIntent); } + private String getCacheUrl() { return getConnector().getCacheUrl(this); } @@ -731,6 +749,8 @@ public class Geocache implements ICache, IWaypoint { return getConnector().getCacheUrl(this); } + public String getCgeoUrl() { return getConnector().getCacheUrl(this); } + public boolean supportsGCVote() { return StringUtils.startsWithIgnoreCase(geocode, "GC"); } |
