Fix poi editing
This commit is contained in:
parent
f3584ea58a
commit
64345810e0
4 changed files with 22 additions and 9 deletions
|
@ -8,7 +8,7 @@
|
||||||
If you are making/correcting English translations make sure:
|
If you are making/correcting English translations make sure:
|
||||||
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
|
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
|
||||||
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
|
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
|
||||||
-->
|
-->
|
||||||
<string name="access_from_map_description">Places a dashboard button on the map screen</string>
|
<string name="access_from_map_description">Places a dashboard button on the map screen</string>
|
||||||
<string name="access_from_map">Access from map</string>
|
<string name="access_from_map">Access from map</string>
|
||||||
<string name="show_on_start_description">\'Off\' directly launches the map screen</string>
|
<string name="show_on_start_description">\'Off\' directly launches the map screen</string>
|
||||||
|
|
|
@ -187,6 +187,7 @@ public class EditPoiData {
|
||||||
if(pt != null) {
|
if(pt != null) {
|
||||||
tagValues.remove(pt.getOsmTag());
|
tagValues.remove(pt.getOsmTag());
|
||||||
tagValues.remove(pt.getOsmTag2());
|
tagValues.remove(pt.getOsmTag2());
|
||||||
|
category = pt.getCategory();
|
||||||
}
|
}
|
||||||
notifyDatasetChanged(POI_TYPE_TAG);
|
notifyDatasetChanged(POI_TYPE_TAG);
|
||||||
}
|
}
|
||||||
|
|
|
@ -316,14 +316,16 @@ public class EditPoiDialogFragment extends DialogFragment {
|
||||||
HashSet<String> tagsCopy = new HashSet<>();
|
HashSet<String> tagsCopy = new HashSet<>();
|
||||||
tagsCopy.addAll(editPoiData.getTagValues().keySet());
|
tagsCopy.addAll(editPoiData.getTagValues().keySet());
|
||||||
tagsCopy.removeAll(BASIC_TAGS);
|
tagsCopy.removeAll(BASIC_TAGS);
|
||||||
if (tagsCopy.isEmpty() || editPoiData.getPoiCategory() == getMyApplication().getPoiTypes().getOtherPoiCategory()) {
|
if (tagsCopy.isEmpty()) {
|
||||||
poiTypeEditText.setError(getResources().getString(R.string.please_specify_poi_type));
|
poiTypeEditText.setError(getResources().getString(R.string.please_specify_poi_type));
|
||||||
} else {
|
} else {
|
||||||
new SaveWithAdvancedTagsDialogFragment().show(getChildFragmentManager(), "dialog");
|
new SaveWithAdvancedTagsDialogFragment().show(getChildFragmentManager(), "dialog");
|
||||||
}
|
}
|
||||||
return;
|
} else if(editPoiData.getPoiCategory() == getMyApplication().getPoiTypes().getOtherPoiCategory()) {
|
||||||
|
poiTypeEditText.setError(getResources().getString(R.string.please_specify_poi_type));
|
||||||
|
} else {
|
||||||
|
save();
|
||||||
}
|
}
|
||||||
save();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void save() {
|
private void save() {
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package net.osmand.plus.osmedit.dialogs;
|
package net.osmand.plus.osmedit.dialogs;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
|
|
||||||
|
@ -27,10 +25,14 @@ public class PoiSubTypeDialogFragment extends DialogFragment {
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||||
final PoiCategory a = poiTypes.getPoiCategoryByName((String) getArguments().getSerializable(KEY_POI_CATEGORY));
|
final PoiCategory a = poiTypes.getPoiCategoryByName((String) getArguments().getSerializable(KEY_POI_CATEGORY));
|
||||||
Set<String> strings = new TreeSet<>();
|
Set<String> strings = new TreeSet<>();
|
||||||
for (PoiType s : a.getPoiTypes()) {
|
if(a == poiTypes.getOtherPoiCategory()) {
|
||||||
if (!s.isReference() && !s.isNotEditableOsm() && s.getBaseLangType() == null) {
|
for (PoiCategory category : poiTypes.getCategories(false)) {
|
||||||
strings.add(s.getTranslation());
|
if (!category.isNotEditableOsm()) {
|
||||||
|
addCategory(category, strings);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
addCategory(a, strings);
|
||||||
}
|
}
|
||||||
final String[] subCats = strings.toArray(new String[strings.size()]);
|
final String[] subCats = strings.toArray(new String[strings.size()]);
|
||||||
builder.setItems(subCats, new DialogInterface.OnClickListener() {
|
builder.setItems(subCats, new DialogInterface.OnClickListener() {
|
||||||
|
@ -43,6 +45,14 @@ public class PoiSubTypeDialogFragment extends DialogFragment {
|
||||||
return builder.create();
|
return builder.create();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void addCategory(final PoiCategory a, Set<String> strings) {
|
||||||
|
for (PoiType s : a.getPoiTypes()) {
|
||||||
|
if (!s.isReference() && !s.isNotEditableOsm() && s.getBaseLangType() == null) {
|
||||||
|
strings.add(s.getTranslation());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static PoiSubTypeDialogFragment createInstance(PoiCategory cat) {
|
public static PoiSubTypeDialogFragment createInstance(PoiCategory cat) {
|
||||||
PoiSubTypeDialogFragment fragment = new PoiSubTypeDialogFragment();
|
PoiSubTypeDialogFragment fragment = new PoiSubTypeDialogFragment();
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
|
|
Loading…
Reference in a new issue