aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBananeweizen <bananeweizen@gmx.de>2015-02-21 06:59:37 +0100
committerBananeweizen <bananeweizen@gmx.de>2015-02-21 06:59:37 +0100
commitaa33a5cf8e55609c9eec52ef947cad8f7220307b (patch)
treef216de01d783cd6e35345df553cbd31f78ee2395
parent843f98395a839bf3a569bbc2f57da9986a01e528 (diff)
downloadcgeo-aa33a5cf8e55609c9eec52ef947cad8f7220307b.zip
cgeo-aa33a5cf8e55609c9eec52ef947cad8f7220307b.tar.gz
cgeo-aa33a5cf8e55609c9eec52ef947cad8f7220307b.tar.bz2
better event start time detection
-rw-r--r--main/res/values/changelog_master.xml1
-rw-r--r--main/src/cgeo/geocaching/Geocache.java6
-rw-r--r--tests/src/cgeo/geocaching/GeocacheTest.java1
3 files changed, 5 insertions, 3 deletions
diff --git a/main/res/values/changelog_master.xml b/main/res/values/changelog_master.xml
index a01610e..51cf8f9 100644
--- a/main/res/values/changelog_master.xml
+++ b/main/res/values/changelog_master.xml
@@ -14,6 +14,7 @@
· New: Allow export of waypoints without coords to Locus\n
· New: Confirmation on backup/restore\n
· New: Links in personal notes can be clicked\n
+ · Fix: Improve detection pattern for event start time\n
· Fix: Don\'t allow logs in the future\n
· Fix: Allow shortcut creation for All caches list\n
· Fix: Some menus not available when invoking map from compass\n
diff --git a/main/src/cgeo/geocaching/Geocache.java b/main/src/cgeo/geocaching/Geocache.java
index e87495f..e2eed56 100644
--- a/main/src/cgeo/geocaching/Geocache.java
+++ b/main/src/cgeo/geocaching/Geocache.java
@@ -24,8 +24,8 @@ import cgeo.geocaching.list.StoredList;
import cgeo.geocaching.location.Geopoint;
import cgeo.geocaching.network.HtmlImage;
import cgeo.geocaching.settings.Settings;
-import cgeo.geocaching.utils.CancellableHandler;
import cgeo.geocaching.utils.CalendarUtils;
+import cgeo.geocaching.utils.CancellableHandler;
import cgeo.geocaching.utils.ImageUtils;
import cgeo.geocaching.utils.LazyInitializedList;
import cgeo.geocaching.utils.Log;
@@ -1646,7 +1646,7 @@ public class Geocache implements IWaypoint {
// 17 - 20 o'clock
patterns.add(Pattern.compile("\\b(\\d{1,2})(?:\\.00)?" + "\\s*(?:-|[a-z]+)\\s*" + "(?:\\d{1,2})(?:\\.00)?" + "\\s+" + Pattern.quote(hourLocalized), Pattern.CASE_INSENSITIVE));
// 12 o'clock, 12.00 o'clock
- patterns.add(Pattern.compile("\\b(\\d{1,2})(?:\\.00)?\\s+" + Pattern.quote(hourLocalized), Pattern.CASE_INSENSITIVE));
+ patterns.add(Pattern.compile("\\b(\\d{1,2})(?:\\.(00|15|30|45))?\\s+" + Pattern.quote(hourLocalized), Pattern.CASE_INSENSITIVE));
}
final String searchText = getShortDescription() + ' ' + getDescription();
@@ -1656,7 +1656,7 @@ public class Geocache implements IWaypoint {
try {
final int hours = Integer.parseInt(matcher.group(1));
int minutes = 0;
- if (matcher.groupCount() >= 2) {
+ if (matcher.groupCount() >= 2 && !StringUtils.isEmpty(matcher.group(2))) {
minutes = Integer.parseInt(matcher.group(2));
}
if (hours >= 0 && hours < 24 && minutes >= 0 && minutes < 60) {
diff --git a/tests/src/cgeo/geocaching/GeocacheTest.java b/tests/src/cgeo/geocaching/GeocacheTest.java
index 3e29bcf..26c677d 100644
--- a/tests/src/cgeo/geocaching/GeocacheTest.java
+++ b/tests/src/cgeo/geocaching/GeocacheTest.java
@@ -295,6 +295,7 @@ public class GeocacheTest extends CGeoTestCase {
assertTime("<u><em>Uhrzeit:</em></u> 17-20 " + timeHours + "</span></strong>", 17, 00);
assertTime("von 11 bis 13 " + timeHours, 11, 00);
assertTime("from 11 to 13 " + timeHours, 11, 00);
+ assertTime("von 19.15 " + timeHours + " bis ca.20.30 " + timeHours + " statt", 19, 15);
}
public static void testGuessEventTimeShortDescription() {