diff options
| author | rsudev <rasch@munin-soft.de> | 2013-05-28 23:17:56 -0700 |
|---|---|---|
| committer | rsudev <rasch@munin-soft.de> | 2013-05-28 23:17:56 -0700 |
| commit | f6779ac30d6ac1357d67654ea17afa1f1d6fa770 (patch) | |
| tree | e1e84fca95948ef7ba13be7e12809388b24d3267 /main/src/cgeo/geocaching/CacheDetailActivity.java | |
| parent | d6f1bc648361076c3b2038a6ab9b175e1de39b3d (diff) | |
| parent | a7de49db675048db5ae0c05ccd730a8579e6876e (diff) | |
| download | cgeo-f6779ac30d6ac1357d67654ea17afa1f1d6fa770.zip cgeo-f6779ac30d6ac1357d67654ea17afa1f1d6fa770.tar.gz cgeo-f6779ac30d6ac1357d67654ea17afa1f1d6fa770.tar.bz2 | |
Merge pull request #2787 from rsudev/ocde_okapi_2
Implements OKAPI access for opencaching.de
Diffstat (limited to 'main/src/cgeo/geocaching/CacheDetailActivity.java')
| -rw-r--r-- | main/src/cgeo/geocaching/CacheDetailActivity.java | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/main/src/cgeo/geocaching/CacheDetailActivity.java b/main/src/cgeo/geocaching/CacheDetailActivity.java index fe6693b..33a6504 100644 --- a/main/src/cgeo/geocaching/CacheDetailActivity.java +++ b/main/src/cgeo/geocaching/CacheDetailActivity.java @@ -117,7 +117,7 @@ import java.util.regex.Pattern; * e.g. details, description, logs, waypoints, inventory... */ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailActivity.Page> - implements EditNoteDialogListener { + implements EditNoteDialogListener { private static final int MENU_FIELD_COPY = 1; private static final int MENU_FIELD_TRANSLATE = 2; @@ -259,6 +259,23 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc finish(); return; } + } else if (uriHost.contains("opencaching.de")) { + if (uriPath != null && uriPath.startsWith("/oc")) { + geocode = uriPath.substring(1).toUpperCase(Locale.US); + } else { + geocode = uri.getQueryParameter("wp"); + if (StringUtils.isNotBlank(geocode)) { + geocode = geocode.toUpperCase(Locale.US); + } else { + showToast(res.getString(R.string.err_detail_open)); + finish(); + return; + } + } + } else { + showToast(res.getString(R.string.err_detail_open)); + finish(); + return; } } @@ -1472,7 +1489,7 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc @Override public void run() { - handler.sendEmptyMessage(GCConnector.addToWatchlist(cache) ? 1 : -1); + handler.sendEmptyMessage(ConnectorFactory.getConnector(cache).addToWatchlist(cache) ? 1 : -1); } } @@ -1486,7 +1503,7 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc @Override public void run() { - handler.sendEmptyMessage(GCConnector.removeFromWatchlist(cache) ? 1 : -1); + handler.sendEmptyMessage(ConnectorFactory.getConnector(cache).removeFromWatchlist(cache) ? 1 : -1); } } @@ -2242,8 +2259,7 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc } /** - * Read the position of the cursor pointed to by this holder. - * <br/> + * Read the position of the cursor pointed to by this holder. <br/> * This must be called by the UI thread. * * @return the cursor position @@ -2253,11 +2269,11 @@ public class CacheDetailActivity extends AbstractViewPagerActivity<CacheDetailAc } /** - * Set the position of the cursor pointed to by this holder. - * <br/> + * Set the position of the cursor pointed to by this holder. <br/> * This must be called by the UI thread. * - * @param position the cursor position + * @param position + * the cursor position */ public void setPosition(final int position) { this.position = position; |
