diff options
Diffstat (limited to 'main/src/cgeo/geocaching/connector/oc/OCApiLiveConnector.java')
-rw-r--r-- | main/src/cgeo/geocaching/connector/oc/OCApiLiveConnector.java | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/main/src/cgeo/geocaching/connector/oc/OCApiLiveConnector.java b/main/src/cgeo/geocaching/connector/oc/OCApiLiveConnector.java index dd25c5e..2c783fb 100644 --- a/main/src/cgeo/geocaching/connector/oc/OCApiLiveConnector.java +++ b/main/src/cgeo/geocaching/connector/oc/OCApiLiveConnector.java @@ -3,7 +3,6 @@ package cgeo.geocaching.connector.oc; import cgeo.geocaching.CgeoApplication; import cgeo.geocaching.DataStore; import cgeo.geocaching.Geocache; -import cgeo.geocaching.ICache; import cgeo.geocaching.LogCacheActivity; import cgeo.geocaching.SearchResult; import cgeo.geocaching.connector.ILoggingManager; @@ -15,9 +14,10 @@ import cgeo.geocaching.connector.capability.ISearchByOwner; import cgeo.geocaching.connector.capability.ISearchByViewPort; import cgeo.geocaching.connector.gc.MapTokens; import cgeo.geocaching.connector.oc.UserInfo.UserInfoStatus; -import cgeo.geocaching.geopoint.Geopoint; -import cgeo.geocaching.geopoint.Viewport; import cgeo.geocaching.loaders.RecaptchaReceiver; +import cgeo.geocaching.location.Geopoint; +import cgeo.geocaching.location.Viewport; +import cgeo.geocaching.sensors.Sensors; import cgeo.geocaching.settings.Settings; import cgeo.geocaching.utils.CryptUtils; @@ -50,7 +50,8 @@ public class OCApiLiveConnector extends OCApiConnector implements ISearchByCente } @Override - public SearchResult searchByViewport(@NonNull final Viewport viewport, final MapTokens tokens) { + @NonNull + public SearchResult searchByViewport(@NonNull final Viewport viewport, @NonNull final MapTokens tokens) { return new SearchResult(OkapiClient.getCachesBBox(viewport, this)); } @@ -99,7 +100,7 @@ public class OCApiLiveConnector extends OCApiConnector implements ISearchByCente } @Override - public boolean addToWatchlist(final Geocache cache) { + public boolean addToWatchlist(@NonNull final Geocache cache) { final boolean added = OkapiClient.setWatchState(cache, true, this); if (added) { @@ -110,7 +111,7 @@ public class OCApiLiveConnector extends OCApiConnector implements ISearchByCente } @Override - public boolean removeFromWatchlist(final Geocache cache) { + public boolean removeFromWatchlist(@NonNull final Geocache cache) { final boolean removed = OkapiClient.setWatchState(cache, false, this); if (removed) { @@ -126,12 +127,13 @@ public class OCApiLiveConnector extends OCApiConnector implements ISearchByCente } @Override - public ILoggingManager getLoggingManager(final LogCacheActivity activity, final Geocache cache) { + @NonNull + public ILoggingManager getLoggingManager(@NonNull final LogCacheActivity activity, @NonNull final Geocache cache) { return new OkapiLoggingManager(activity, this, cache); } @Override - public boolean canLog(final Geocache cache) { + public boolean canLog(@NonNull final Geocache cache) { return true; } @@ -150,7 +152,7 @@ public class OCApiLiveConnector extends OCApiConnector implements ISearchByCente } @Override - public boolean isOwner(final ICache cache) { + public boolean isOwner(@NonNull final Geocache cache) { return StringUtils.isNotEmpty(getUserName()) && StringUtils.equals(cache.getOwnerDisplayName(), getUserName()); } @@ -176,8 +178,7 @@ public class OCApiLiveConnector extends OCApiConnector implements ISearchByCente @Override public SearchResult searchByKeyword(final @NonNull String name, final @NonNull RecaptchaReceiver recaptchaReceiver) { - final Geopoint currentPos = CgeoApplication.getInstance().currentGeo().getCoords(); - return new SearchResult(OkapiClient.getCachesNamed(currentPos, name, this)); + return new SearchResult(OkapiClient.getCachesNamed(Sensors.getInstance().currentGeo().getCoords(), name, this)); } @Override |