This commit is contained in:
Victor Shcherb 2017-04-04 00:12:37 +02:00
parent 14c7645aa4
commit c2530eb81a
2 changed files with 15 additions and 2 deletions

View file

@ -89,6 +89,7 @@ public class OpeningHoursParser {
* list of the different rules
*/
private ArrayList<OpeningHoursRule> rules;
private String original;
/**
* Constructor
@ -266,6 +267,14 @@ public class OpeningHoursParser {
return s.substring(0, s.length() - 2);
}
public void setOriginal(String original) {
this.original = original;
}
public String getOriginal() {
return original;
}
}
/**
@ -1419,6 +1428,7 @@ public class OpeningHoursParser {
String[] rules = format.split(";"); //$NON-NLS-1$
// FIXME: What if the semicolon is inside a quoted string?
OpeningHours rs = new OpeningHours();
rs.setOriginal(format);
for (String r : rules) {
r = r.trim();
if (r.length() == 0) {
@ -1448,6 +1458,7 @@ public class OpeningHoursParser {
}
String[] rules = format.split(";"); //$NON-NLS-1$
OpeningHoursParser.OpeningHours rs = new OpeningHoursParser.OpeningHours();
rs.setOriginal(format);
for (String r : rules) {
r = r.trim();
if (r.length() == 0) {

View file

@ -214,8 +214,10 @@ public class BasicEditPoiFragment extends BaseOsmAndFragment
if (!data.isInEdit()) {
String openingHoursString = openingHours.toString();
if (!TextUtils.isEmpty(openingHoursString)) {
data.putTag(OSMSettings.OSMTagKey.OPENING_HOURS.getValue(),
openingHoursString);
if(!OpeningHoursParser.parseOpenedHoursHandleErrors(openingHours.getOriginal()).toString().equals(openingHoursString)) {
data.putTag(OSMSettings.OSMTagKey.OPENING_HOURS.getValue(),
openingHoursString);
}
} else {
data.removeTag(OSMSettings.OSMTagKey.OPENING_HOURS.getValue());
}