Fix deleting basic tags in offline mode

This commit is contained in:
Chumva 2018-09-07 17:48:04 +03:00
parent aecf98195c
commit 1ae6e344b1

View file

@ -46,6 +46,8 @@ public class BasicEditPoiFragment extends BaseOsmAndFragment
private EditText webSiteEditText;
private EditText descriptionEditText;
OpeningHoursAdapter mOpeningHoursAdapter;
private boolean basicTagsInitialized = false;
@Nullable
@Override
@ -130,7 +132,7 @@ public class BasicEditPoiFragment extends BaseOsmAndFragment
if (data != null && !data.isInEdit()) {
if (!TextUtils.isEmpty(s)) {
data.putTag(tag, s.toString());
} else {
} else if (basicTagsInitialized && isResumed()) {
data.removeTag(tag);
}
}
@ -178,6 +180,7 @@ public class BasicEditPoiFragment extends BaseOsmAndFragment
}
mOpeningHoursAdapter.replaceOpeningHours(openingHours);
mOpeningHoursAdapter.updateViews();
basicTagsInitialized = true;
}
private class OpeningHoursAdapter {
@ -223,7 +226,7 @@ public class BasicEditPoiFragment extends BaseOsmAndFragment
data.putTag(OSMSettings.OSMTagKey.OPENING_HOURS.getValue(),
openingHoursString);
}
} else {
} else if (basicTagsInitialized && isResumed()) {
data.removeTag(OSMSettings.OSMTagKey.OPENING_HOURS.getValue());
}
}