diff options
| author | Rainer <rschum@web.de> | 2011-08-02 09:56:06 +0200 |
|---|---|---|
| committer | Rainer <rschum@web.de> | 2011-08-02 09:56:06 +0200 |
| commit | c153cf1a0c86480568f0aea016fa0428689a1dc2 (patch) | |
| tree | 0d7d5318e312f684a77bb3c66eb7cfb819d026c1 /src/cgeo/geocaching/cgCache.java | |
| parent | 62e208f0dbdecfae56694bb359267df1d146b594 (diff) | |
| parent | 6118f6489847f98d2c257671c352082974134b14 (diff) | |
| download | cgeo-c153cf1a0c86480568f0aea016fa0428689a1dc2.zip cgeo-c153cf1a0c86480568f0aea016fa0428689a1dc2.tar.gz cgeo-c153cf1a0c86480568f0aea016fa0428689a1dc2.tar.bz2 | |
Merge branch 'master' of https://github.com/cgeo/c-geo-opensource
Conflicts:
src/cgeo/geocaching/cgeospoilers.java
Diffstat (limited to 'src/cgeo/geocaching/cgCache.java')
| -rw-r--r-- | src/cgeo/geocaching/cgCache.java | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/src/cgeo/geocaching/cgCache.java b/src/cgeo/geocaching/cgCache.java index 8b2bb00..a878a1f 100644 --- a/src/cgeo/geocaching/cgCache.java +++ b/src/cgeo/geocaching/cgCache.java @@ -3,8 +3,11 @@ package cgeo.geocaching; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import android.text.Spannable; +import android.util.Log; public class cgCache { @@ -52,7 +55,7 @@ public class cgCache { public boolean onWatchlist = false; public ArrayList<String> attributes = null; public ArrayList<cgWaypoint> waypoints = null; - public ArrayList<cgSpoiler> spoilers = null; + public ArrayList<cgImage> spoilers = null; public ArrayList<cgLog> logs = null; public ArrayList<cgTrackable> inventory = null; public HashMap<Integer, Integer> logCounts = new HashMap<Integer, Integer>(); @@ -233,4 +236,30 @@ public class cgCache { } return true; } + + /** + * checks if a page contains the guid of a cache + * + * @param cache the cache to look for + * @param page the page to search in + * + * @return true: page contains guid of cache, false: otherwise + */ + boolean isGuidContainedInPage(final String page) { + // check if the guid of the cache is anywhere in the page + if (guid == null || guid.length() == 0) { + return false; + } + Pattern patternOk = Pattern.compile(guid, Pattern.CASE_INSENSITIVE); + Matcher matcherOk = patternOk.matcher(page); + if (matcherOk.find()) { + Log.i(cgSettings.tag, "cgCache.isGuidContainedInPage: guid '" + guid + "' found"); + return true; + } else { + Log.i(cgSettings.tag, "cgCache.isGuidContainedInPage: guid '" + guid + "' not found"); + return false; + } + } + + } |
