Merge pull request #6001 from osmandapp/EditingImprovements
Fix deleting basic tags in offline mode
This commit is contained in:
commit
1635c0995f
1 changed files with 6 additions and 2 deletions
|
@ -47,6 +47,8 @@ public class BasicEditPoiFragment extends BaseOsmAndFragment
|
||||||
private EditText descriptionEditText;
|
private EditText descriptionEditText;
|
||||||
OpeningHoursAdapter mOpeningHoursAdapter;
|
OpeningHoursAdapter mOpeningHoursAdapter;
|
||||||
|
|
||||||
|
private boolean basicTagsInitialized = false;
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
|
@ -130,7 +132,7 @@ public class BasicEditPoiFragment extends BaseOsmAndFragment
|
||||||
if (data != null && !data.isInEdit()) {
|
if (data != null && !data.isInEdit()) {
|
||||||
if (!TextUtils.isEmpty(s)) {
|
if (!TextUtils.isEmpty(s)) {
|
||||||
data.putTag(tag, s.toString());
|
data.putTag(tag, s.toString());
|
||||||
} else {
|
} else if (basicTagsInitialized && isResumed()) {
|
||||||
data.removeTag(tag);
|
data.removeTag(tag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -163,6 +165,7 @@ public class BasicEditPoiFragment extends BaseOsmAndFragment
|
||||||
if (data == null) {
|
if (data == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
basicTagsInitialized = false;
|
||||||
Map<String, String> tagValues = data.getTagValues();
|
Map<String, String> tagValues = data.getTagValues();
|
||||||
streetEditText.setText(tagValues.get(OSMSettings.OSMTagKey.ADDR_STREET.getValue()));
|
streetEditText.setText(tagValues.get(OSMSettings.OSMTagKey.ADDR_STREET.getValue()));
|
||||||
houseNumberEditText.setText(tagValues.get(OSMSettings.OSMTagKey.ADDR_HOUSE_NUMBER.getValue()));
|
houseNumberEditText.setText(tagValues.get(OSMSettings.OSMTagKey.ADDR_HOUSE_NUMBER.getValue()));
|
||||||
|
@ -178,6 +181,7 @@ public class BasicEditPoiFragment extends BaseOsmAndFragment
|
||||||
}
|
}
|
||||||
mOpeningHoursAdapter.replaceOpeningHours(openingHours);
|
mOpeningHoursAdapter.replaceOpeningHours(openingHours);
|
||||||
mOpeningHoursAdapter.updateViews();
|
mOpeningHoursAdapter.updateViews();
|
||||||
|
basicTagsInitialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private class OpeningHoursAdapter {
|
private class OpeningHoursAdapter {
|
||||||
|
@ -223,7 +227,7 @@ public class BasicEditPoiFragment extends BaseOsmAndFragment
|
||||||
data.putTag(OSMSettings.OSMTagKey.OPENING_HOURS.getValue(),
|
data.putTag(OSMSettings.OSMTagKey.OPENING_HOURS.getValue(),
|
||||||
openingHoursString);
|
openingHoursString);
|
||||||
}
|
}
|
||||||
} else {
|
} else if (basicTagsInitialized && isResumed()) {
|
||||||
data.removeTag(OSMSettings.OSMTagKey.OPENING_HOURS.getValue());
|
data.removeTag(OSMSettings.OSMTagKey.OPENING_HOURS.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue