diff options
| author | Bananeweizen <bananeweizen@gmx.de> | 2013-05-07 20:03:29 +0200 |
|---|---|---|
| committer | Bananeweizen <bananeweizen@gmx.de> | 2013-05-07 20:03:56 +0200 |
| commit | 0726be7130feda75973101aa8ff94eaf80163fcc (patch) | |
| tree | 61d419028284e6c5d426249faadedf731368ae7b | |
| parent | 558631036998333e221d7be5466c0a5c5b01f9c0 (diff) | |
| download | cgeo-0726be7130feda75973101aa8ff94eaf80163fcc.zip cgeo-0726be7130feda75973101aa8ff94eaf80163fcc.tar.gz cgeo-0726be7130feda75973101aa8ff94eaf80163fcc.tar.bz2 | |
refactoring: simplify log types handling
| -rw-r--r-- | main/src/cgeo/geocaching/Geocache.java | 4 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/VisitCacheActivity.java | 1 | ||||
| -rw-r--r-- | main/src/cgeo/geocaching/connector/gc/GCParser.java | 14 |
3 files changed, 6 insertions, 13 deletions
diff --git a/main/src/cgeo/geocaching/Geocache.java b/main/src/cgeo/geocaching/Geocache.java index 705f2ed..fe5de91 100644 --- a/main/src/cgeo/geocaching/Geocache.java +++ b/main/src/cgeo/geocaching/Geocache.java @@ -47,7 +47,6 @@ import java.util.Collections; import java.util.Date; import java.util.EnumSet; import java.util.HashMap; -import java.util.LinkedList; import java.util.List; import java.util.Locale; import java.util.Map; @@ -484,7 +483,7 @@ public class Geocache implements ICache, IWaypoint { } public List<LogType> getPossibleLogTypes() { - final List<LogType> logTypes = new LinkedList<LogType>(); + final List<LogType> logTypes = new ArrayList<LogType>(); if (isEventCache()) { logTypes.add(LogType.WILL_ATTEND); logTypes.add(LogType.NOTE); @@ -511,7 +510,6 @@ public class Geocache implements ICache, IWaypoint { logTypes.add(LogType.TEMP_DISABLE_LISTING); logTypes.add(LogType.ENABLE_LISTING); logTypes.add(LogType.ARCHIVE); - logTypes.remove(LogType.UPDATE_COORDINATES); } return logTypes; } diff --git a/main/src/cgeo/geocaching/VisitCacheActivity.java b/main/src/cgeo/geocaching/VisitCacheActivity.java index 864ebf8..198186c 100644 --- a/main/src/cgeo/geocaching/VisitCacheActivity.java +++ b/main/src/cgeo/geocaching/VisitCacheActivity.java @@ -110,7 +110,6 @@ public class VisitCacheActivity extends AbstractLoggingActivity implements DateD viewstates = Login.getViewstates(page); trackables = GCParser.parseTrackableLog(page); possibleLogTypes = GCParser.parseTypes(page); - possibleLogTypes.remove(LogType.UPDATE_COORDINATES); if (possibleLogTypes.isEmpty()) { showErrorLoadingData(); diff --git a/main/src/cgeo/geocaching/connector/gc/GCParser.java b/main/src/cgeo/geocaching/connector/gc/GCParser.java index 4273da5..c637579 100644 --- a/main/src/cgeo/geocaching/connector/gc/GCParser.java +++ b/main/src/cgeo/geocaching/connector/gc/GCParser.java @@ -1586,15 +1586,8 @@ public abstract class GCParser { final List<LogType> types = new ArrayList<LogType>(); final MatcherWrapper typeBoxMatcher = new MatcherWrapper(GCConstants.PATTERN_TYPEBOX, page); - String typesText = null; - if (typeBoxMatcher.find()) { - if (typeBoxMatcher.groupCount() > 0) { - typesText = typeBoxMatcher.group(1); - } - } - - if (typesText != null) { - + if (typeBoxMatcher.find() && typeBoxMatcher.groupCount() > 0) { + String typesText = typeBoxMatcher.group(1); final MatcherWrapper typeMatcher = new MatcherWrapper(GCConstants.PATTERN_TYPE2, typesText); while (typeMatcher.find()) { if (typeMatcher.groupCount() > 1) { @@ -1610,6 +1603,9 @@ public abstract class GCParser { } } + // we don't support this log type + types.remove(LogType.UPDATE_COORDINATES); + return types; } |
