diff options
Diffstat (limited to 'main/src/cgeo/geocaching/Geocache.java')
| -rw-r--r-- | main/src/cgeo/geocaching/Geocache.java | 47 |
1 files changed, 11 insertions, 36 deletions
diff --git a/main/src/cgeo/geocaching/Geocache.java b/main/src/cgeo/geocaching/Geocache.java index 156c4b6..bac4600 100644 --- a/main/src/cgeo/geocaching/Geocache.java +++ b/main/src/cgeo/geocaching/Geocache.java @@ -165,7 +165,7 @@ public class Geocache implements ICache, IWaypoint { * * @param gpxParser */ - public Geocache(GPXParser gpxParser) { + public Geocache(@SuppressWarnings("unused") GPXParser gpxParser) { setReliableLatLon(true); setAttributes(Collections.<String> emptyList()); setWaypoints(Collections.<Waypoint> emptyList(), false); @@ -370,6 +370,7 @@ public class Geocache implements ICache, IWaypoint { * the other cache to compare this one to * @return true if both caches have the same content */ + @SuppressWarnings("deprecation") @SuppressFBWarnings("FE_FLOATING_POINT_EQUALITY") private boolean isEqualTo(final Geocache other) { return detailed == other.detailed && @@ -438,22 +439,6 @@ public class Geocache implements ICache, IWaypoint { return hidden.compareTo(cal.getTime()) >= 0; } - /** - * Checks if a page contains the guid of a cache - * - * @param page - * the page to search in, may be null - * @return true if the page contains the guid of the cache, false otherwise - */ - public boolean isGuidContainedInPage(final String page) { - if (StringUtils.isBlank(page) || StringUtils.isBlank(guid)) { - return false; - } - final Boolean found = Pattern.compile(guid, Pattern.CASE_INSENSITIVE).matcher(page).find(); - Log.i("Geocache.isGuidContainedInPage: guid '" + guid + "' " + (found ? "" : "not ") + "found"); - return found; - } - public boolean isEventCache() { return cacheType.getValue().isEvent(); } @@ -817,13 +802,7 @@ public class Geocache implements ICache, IWaypoint { } public boolean showSize() { - if (size == CacheSize.NOT_CHOSEN) { - return false; - } - if (isEventCache() || isVirtual()) { - return false; - } - return true; + return !(size == CacheSize.NOT_CHOSEN || isEventCache() || isVirtual()); } public long getUpdated() { @@ -1373,17 +1352,6 @@ public class Geocache implements ICache, IWaypoint { } /** - * Retrieve a given waypoint. - * - * @param index - * the index of the waypoint - * @return waypoint or <code>null</code> if index is out of range - */ - public Waypoint getWaypoint(final int index) { - return index >= 0 && index < waypoints.size() ? waypoints.get(index) : null; - } - - /** * Lookup a waypoint by its id. * * @param id @@ -1660,6 +1628,8 @@ public class Geocache implements ICache, IWaypoint { StaticMapsProvider.downloadMaps(cache); + imgGetter.waitForBackgroundLoading(handler); + if (handler != null) { handler.sendMessage(Message.obtain()); } @@ -1719,8 +1689,9 @@ public class Geocache implements ICache, IWaypoint { patterns.add(Pattern.compile("\\b(\\d{1,2})(?:\\.00)?\\s+" + Pattern.quote(hourLocalized), Pattern.CASE_INSENSITIVE)); } + final String searchText = getShortDescription() + ' ' + getDescription(); for (Pattern pattern : patterns) { - final MatcherWrapper matcher = new MatcherWrapper(pattern, getDescription()); + final MatcherWrapper matcher = new MatcherWrapper(pattern, searchText); while (matcher.find()) { try { final int hours = Integer.parseInt(matcher.group(1)); @@ -1831,4 +1802,8 @@ public class Geocache implements ICache, IWaypoint { return 0; } + public boolean applyDistanceRule() { + return (getType().applyDistanceRule() || hasUserModifiedCoords()) && getConnector() == GCConnector.getInstance(); + } + } |
