Fix poi editing
This commit is contained in:
parent
8c49de0d6f
commit
0671b7a736
3 changed files with 23 additions and 21 deletions
|
@ -21,7 +21,6 @@ import android.widget.Button;
|
||||||
import android.widget.ImageButton;
|
import android.widget.ImageButton;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import net.osmand.PlatformUtil;
|
import net.osmand.PlatformUtil;
|
||||||
import net.osmand.StringMatcher;
|
import net.osmand.StringMatcher;
|
||||||
import net.osmand.osm.AbstractPoiType;
|
import net.osmand.osm.AbstractPoiType;
|
||||||
|
@ -82,7 +81,15 @@ public class AdvancedEditPoiFragment extends Fragment
|
||||||
final MapPoiTypes mapPoiTypes = ((OsmandApplication) getActivity().getApplication()).getPoiTypes();
|
final MapPoiTypes mapPoiTypes = ((OsmandApplication) getActivity().getApplication()).getPoiTypes();
|
||||||
mAdapter = new TagAdapterLinearLayoutHack(editTagsLineaLayout, getData());
|
mAdapter = new TagAdapterLinearLayoutHack(editTagsLineaLayout, getData());
|
||||||
// It is possible to not restart initialization every time, and probably move initialization to appInit
|
// It is possible to not restart initialization every time, and probably move initialization to appInit
|
||||||
new InitTagsAndValuesAutocompleteTask(mapPoiTypes).execute();
|
Map<String, PoiType> translatedTypes = getData().getAllTranslatedSubTypes();
|
||||||
|
HashSet<String> tagKeys = new HashSet<>();
|
||||||
|
HashSet<String> valueKeys = new HashSet<>();
|
||||||
|
for (AbstractPoiType abstractPoiType : translatedTypes.values()) {
|
||||||
|
addPoiToStringSet(abstractPoiType, tagKeys, valueKeys);
|
||||||
|
}
|
||||||
|
addPoiToStringSet(mapPoiTypes.getOtherMapCategory(), tagKeys, valueKeys);
|
||||||
|
mAdapter.setTagData(tagKeys.toArray(new String[tagKeys.size()]));
|
||||||
|
mAdapter.setValueData(valueKeys.toArray(new String[valueKeys.size()]));
|
||||||
Button addTagButton = (Button) view.findViewById(R.id.addTagButton);
|
Button addTagButton = (Button) view.findViewById(R.id.addTagButton);
|
||||||
addTagButton.setOnClickListener(new View.OnClickListener() {
|
addTagButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -294,7 +301,7 @@ public class AdvancedEditPoiFragment extends Fragment
|
||||||
Set<String> values) {
|
Set<String> values) {
|
||||||
if (abstractPoiType instanceof PoiType) {
|
if (abstractPoiType instanceof PoiType) {
|
||||||
PoiType poiType = (PoiType) abstractPoiType;
|
PoiType poiType = (PoiType) abstractPoiType;
|
||||||
if (poiType.isNotEditableOsm()) {
|
if (poiType.isNotEditableOsm() || poiType.getBaseLangType() != null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (poiType.getOsmTag() != null &&
|
if (poiType.getOsmTag() != null &&
|
||||||
|
@ -352,14 +359,7 @@ public class AdvancedEditPoiFragment extends Fragment
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPostExecute(Map<String, AbstractPoiType> result) {
|
protected void onPostExecute(Map<String, AbstractPoiType> result) {
|
||||||
HashSet<String> tagKeys = new HashSet<>();
|
|
||||||
HashSet<String> valueKeys = new HashSet<>();
|
|
||||||
for (AbstractPoiType abstractPoiType : result.values()) {
|
|
||||||
addPoiToStringSet(abstractPoiType, tagKeys, valueKeys);
|
|
||||||
}
|
|
||||||
addPoiToStringSet(mapPoiTypes.getOtherMapCategory(), tagKeys, valueKeys);
|
|
||||||
mAdapter.setTagData(tagKeys.toArray(new String[tagKeys.size()]));
|
|
||||||
mAdapter.setValueData(valueKeys.toArray(new String[valueKeys.size()]));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -511,7 +511,11 @@ public class EditPoiDialogFragment extends DialogFragment {
|
||||||
//noinspection SuspiciousMethodCalls
|
//noinspection SuspiciousMethodCalls
|
||||||
if (subCategories.containsKey(item)) {
|
if (subCategories.containsKey(item)) {
|
||||||
//noinspection SuspiciousMethodCalls
|
//noinspection SuspiciousMethodCalls
|
||||||
String keyName = subCategories.get(item).getKeyName();
|
PoiType pt = subCategories.get(item);
|
||||||
|
String keyName = pt.getKeyName();
|
||||||
|
if(pt != null) {
|
||||||
|
poiTypeTextInputLayout.setHint(pt.getCategory().getTranslation());
|
||||||
|
}
|
||||||
poiTypeEditText.setText(keyName);
|
poiTypeEditText.setText(keyName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,12 @@
|
||||||
package net.osmand.plus.osmedit.dialogs;
|
package net.osmand.plus.osmedit.dialogs;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.osmand.osm.MapPoiTypes;
|
||||||
|
import net.osmand.osm.PoiCategory;
|
||||||
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
import net.osmand.plus.osmedit.EditPoiDialogFragment;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
@ -7,15 +14,6 @@ import android.support.annotation.NonNull;
|
||||||
import android.support.v4.app.DialogFragment;
|
import android.support.v4.app.DialogFragment;
|
||||||
import android.support.v7.app.AlertDialog;
|
import android.support.v7.app.AlertDialog;
|
||||||
|
|
||||||
import net.osmand.data.Amenity;
|
|
||||||
import net.osmand.osm.MapPoiTypes;
|
|
||||||
import net.osmand.osm.PoiCategory;
|
|
||||||
import net.osmand.plus.OsmandApplication;
|
|
||||||
import net.osmand.plus.osmedit.EditPoiDialogFragment;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class PoiTypeDialogFragment extends DialogFragment {
|
public class PoiTypeDialogFragment extends DialogFragment {
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
|
|
Loading…
Reference in a new issue