issue #1500, POI dialog fix
This commit is contained in:
parent
362aecfc7a
commit
97754ea50c
1 changed files with 229 additions and 231 deletions
|
@ -29,14 +29,13 @@ import android.widget.TableLayout;
|
|||
import android.widget.TableRow;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import net.osmand.access.AccessibleToast;
|
||||
import net.osmand.data.Amenity;
|
||||
import net.osmand.osm.MapPoiTypes;
|
||||
import net.osmand.osm.MapRenderingTypes;
|
||||
import net.osmand.osm.PoiCategory;
|
||||
import net.osmand.osm.PoiType;
|
||||
import net.osmand.osm.edit.EntityInfo;
|
||||
import net.osmand.osm.edit.EntityParser;
|
||||
import net.osmand.osm.edit.Node;
|
||||
import net.osmand.osm.edit.OSMSettings.OSMTagKey;
|
||||
import net.osmand.plus.OsmAndFormatter;
|
||||
|
@ -151,23 +150,23 @@ public class EditingPOIDialogProvider implements DialogProvider {
|
|||
showPOIDialog(DIALOG_CREATE_POI, n, null);
|
||||
}
|
||||
|
||||
private void showPOIDialog(int dialogID, Node n, Amenity a) {
|
||||
Amenity am;
|
||||
if(a == null) {
|
||||
am = new Amenity();
|
||||
am.setType(poiTypes.getOtherPoiCategory());
|
||||
am.setSubType("");
|
||||
am.setAdditionalInfo(OSMTagKey.OPENING_HOURS.getValue(), "");
|
||||
private void showPOIDialog(int dialogID, Node node, Amenity amenity) {
|
||||
Amenity localAmenity;
|
||||
if(amenity == null) {
|
||||
localAmenity = new Amenity();
|
||||
localAmenity.setType(poiTypes.getOtherPoiCategory());
|
||||
localAmenity.setSubType("");
|
||||
localAmenity.setAdditionalInfo(OSMTagKey.OPENING_HOURS.getValue(), "");
|
||||
} else {
|
||||
am = new Amenity();
|
||||
am.copyNames(a);
|
||||
am.setType(a.getType());
|
||||
am.setSubType(a.getSubType());
|
||||
am.setAdditionalInfo(a.getAdditionalInfo());
|
||||
localAmenity = new Amenity();
|
||||
localAmenity.copyNames(amenity);
|
||||
localAmenity.setType(amenity.getType());
|
||||
localAmenity.setSubType(amenity.getSubType());
|
||||
localAmenity.setAdditionalInfo(amenity.getAdditionalInfo());
|
||||
}
|
||||
// Amenity a = EntityParser.parseAmenity(n, n.getTags(), type, subType, MapRenderingTypes.getDefault());
|
||||
dialogBundle.putSerializable(KEY_AMENITY, a);
|
||||
dialogBundle.putSerializable(KEY_AMENITY_NODE, n);
|
||||
// Amenity amenity = EntityParser.parseAmenity(node, node.getTags(), type, subType, MapRenderingTypes.getDefault());
|
||||
dialogBundle.putSerializable(KEY_AMENITY, localAmenity);
|
||||
dialogBundle.putSerializable(KEY_AMENITY_NODE, node);
|
||||
createPOIDialog(dialogID, dialogBundle).show();
|
||||
}
|
||||
|
||||
|
@ -222,20 +221,20 @@ public class EditingPOIDialogProvider implements DialogProvider {
|
|||
String c = comment.getText().toString();
|
||||
commitNode(OsmPoint.Action.DELETE, n, openstreetmapUtil.getEntityInfo(), c,
|
||||
closeChangeset == null ? false : closeChangeset.isSelected(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (isLocalEdit) {
|
||||
AccessibleToast.makeText(
|
||||
activity,R.string.osm_changes_added_to_local_edits,
|
||||
Toast.LENGTH_LONG).show();
|
||||
} else {
|
||||
AccessibleToast.makeText(activity, R.string.poi_remove_success, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
if(activity instanceof MapActivity){
|
||||
((MapActivity) activity).getMapView().refreshMap(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
@Override
|
||||
public void run() {
|
||||
if (isLocalEdit) {
|
||||
AccessibleToast.makeText(
|
||||
activity,R.string.osm_changes_added_to_local_edits,
|
||||
Toast.LENGTH_LONG).show();
|
||||
} else {
|
||||
AccessibleToast.makeText(activity, R.string.poi_remove_success, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
if(activity instanceof MapActivity){
|
||||
((MapActivity) activity).getMapView().refreshMap(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
return builder.create();
|
||||
|
@ -263,25 +262,25 @@ public class EditingPOIDialogProvider implements DialogProvider {
|
|||
|
||||
private void addTagValueRow(final Node n, final TableLayout layout, String tg, String vl) {
|
||||
final TableRow newTagRow = new TableRow(activity);
|
||||
TableRow.LayoutParams tlp = new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT);
|
||||
tlp.leftMargin = 5;
|
||||
tlp.gravity = Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM;
|
||||
newTagRow.setLayoutParams(tlp);
|
||||
TableRow.LayoutParams tlp = new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT);
|
||||
tlp.leftMargin = 5;
|
||||
tlp.gravity = Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM;
|
||||
newTagRow.setLayoutParams(tlp);
|
||||
|
||||
final AutoCompleteTextView tag = new AutoCompleteTextView(activity);
|
||||
final AutoCompleteTextView value = new AutoCompleteTextView(activity);
|
||||
final Button delete = new Button(activity);
|
||||
final AutoCompleteTextView tag = new AutoCompleteTextView(activity);
|
||||
final AutoCompleteTextView value = new AutoCompleteTextView(activity);
|
||||
final Button delete = new Button(activity);
|
||||
|
||||
tag.setDropDownWidth(ViewGroup.LayoutParams.MATCH_PARENT);
|
||||
value.setDropDownWidth(ViewGroup.LayoutParams.MATCH_PARENT);
|
||||
tag.setLayoutParams(tlp);
|
||||
if(tg != null) {
|
||||
tag.setText(tg);
|
||||
} else {
|
||||
tag.setHint("Tag");
|
||||
}
|
||||
tag.setDropDownWidth(ViewGroup.LayoutParams.MATCH_PARENT);
|
||||
value.setDropDownWidth(ViewGroup.LayoutParams.MATCH_PARENT);
|
||||
tag.setLayoutParams(tlp);
|
||||
if(tg != null) {
|
||||
tag.setText(tg);
|
||||
} else {
|
||||
tag.setHint("Tag");
|
||||
}
|
||||
|
||||
final Set<String> tagKeys = new TreeSet<String>();
|
||||
final Set<String> tagKeys = new TreeSet<String>();
|
||||
for (OSMTagKey t : OSMTagKey.values()) {
|
||||
if ((t != OSMTagKey.NAME) && (t != OSMTagKey.OPENING_HOURS) && (t != OSMTagKey.PHONE)
|
||||
&& (t != OSMTagKey.WEBSITE)) {
|
||||
|
@ -289,9 +288,9 @@ public class EditingPOIDialogProvider implements DialogProvider {
|
|||
}
|
||||
}
|
||||
ArrayAdapter<Object> adapter = new ArrayAdapter<Object>(activity, R.layout.list_textview, tagKeys.toArray());
|
||||
tag.setAdapter(adapter);
|
||||
tag.setThreshold(1);
|
||||
tag.setOnClickListener(new View.OnClickListener() {
|
||||
tag.setAdapter(adapter);
|
||||
tag.setThreshold(1);
|
||||
tag.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Builder builder = new AlertDialog.Builder(activity);
|
||||
|
@ -307,25 +306,25 @@ public class EditingPOIDialogProvider implements DialogProvider {
|
|||
builder.show();
|
||||
}
|
||||
});
|
||||
tlp = new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.FILL_PARENT);
|
||||
tlp.leftMargin = 5;
|
||||
tlp.gravity = Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM;
|
||||
value.setLayoutParams(tlp);
|
||||
if(vl != null) {
|
||||
value.setText(vl);
|
||||
} else {
|
||||
value.setHint("Value");
|
||||
}
|
||||
Set<String> subCategories = new LinkedHashSet<String>();
|
||||
// could be osm values
|
||||
tlp = new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.FILL_PARENT);
|
||||
tlp.leftMargin = 5;
|
||||
tlp.gravity = Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM;
|
||||
value.setLayoutParams(tlp);
|
||||
if(vl != null) {
|
||||
value.setText(vl);
|
||||
} else {
|
||||
value.setHint("Value");
|
||||
}
|
||||
Set<String> subCategories = new LinkedHashSet<String>();
|
||||
// could be osm values
|
||||
// for (String s : poiTypes.getAllTranslatedNames().keySet()) {
|
||||
// if (!subCategories.contains(s)) {
|
||||
// subCategories.add(s);
|
||||
// }
|
||||
// } ;
|
||||
ArrayAdapter<Object> valueAdapter = new ArrayAdapter<Object>(activity, R.layout.list_textview, subCategories.toArray());
|
||||
value.setThreshold(1);
|
||||
value.setAdapter(valueAdapter);
|
||||
ArrayAdapter<Object> valueAdapter = new ArrayAdapter<Object>(activity, R.layout.list_textview, subCategories.toArray());
|
||||
value.setThreshold(1);
|
||||
value.setAdapter(valueAdapter);
|
||||
value.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
|
@ -343,24 +342,24 @@ public class EditingPOIDialogProvider implements DialogProvider {
|
|||
public void onTextChanged(CharSequence s, int start, int before, int count) {
|
||||
}
|
||||
});
|
||||
tlp = new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT);
|
||||
tlp.gravity = Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM;
|
||||
tlp.rightMargin = 5;
|
||||
delete.setLayoutParams(tlp);
|
||||
delete.setText("X");
|
||||
delete.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
layout.removeView(newTagRow);
|
||||
layout.invalidate();
|
||||
n.removeTag(tag.getText().toString());
|
||||
}
|
||||
});
|
||||
newTagRow.addView(tag);
|
||||
newTagRow.addView(value);
|
||||
newTagRow.addView(delete);
|
||||
layout.addView(newTagRow);
|
||||
layout.invalidate();
|
||||
tlp = new TableRow.LayoutParams(TableRow.LayoutParams.WRAP_CONTENT, TableRow.LayoutParams.WRAP_CONTENT);
|
||||
tlp.gravity = Gravity.CENTER_HORIZONTAL | Gravity.BOTTOM;
|
||||
tlp.rightMargin = 5;
|
||||
delete.setLayoutParams(tlp);
|
||||
delete.setText("X");
|
||||
delete.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
layout.removeView(newTagRow);
|
||||
layout.invalidate();
|
||||
n.removeTag(tag.getText().toString());
|
||||
}
|
||||
});
|
||||
newTagRow.addView(tag);
|
||||
newTagRow.addView(value);
|
||||
newTagRow.addView(delete);
|
||||
layout.addView(newTagRow);
|
||||
layout.invalidate();
|
||||
}
|
||||
|
||||
private Builder createPOIDialog(final int dialogID, Bundle args) {
|
||||
|
@ -405,64 +404,64 @@ public class EditingPOIDialogProvider implements DialogProvider {
|
|||
});
|
||||
linkToOsmDoc.setMovementMethod(LinkMovementMethod.getInstance());
|
||||
|
||||
final Amenity a = (Amenity) args.getSerializable(KEY_AMENITY);
|
||||
final Node n = (Node) args.getSerializable(KEY_AMENITY_NODE);
|
||||
final Amenity amenity = (Amenity) args.getSerializable(KEY_AMENITY);
|
||||
final Node node = (Node) args.getSerializable(KEY_AMENITY_NODE);
|
||||
dlg.setNegativeButton(R.string.shared_string_cancel, null);
|
||||
dlg.setPositiveButton(
|
||||
isLocalEdit ? R.string.shared_string_save :
|
||||
R.string.default_buttons_commit, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
Resources resources = view.getResources();
|
||||
final String msg = n.getId() == -1 ? resources.getString(R.string.poi_action_add) : resources
|
||||
.getString(R.string.poi_action_change);
|
||||
OsmPoint.Action action = n.getId() == -1 ? OsmPoint.Action.CREATE : OsmPoint.Action.MODIFY;
|
||||
String subType = typeText.getText().toString().trim().toLowerCase();
|
||||
if (allTranslatedSubTypes.get(subType) != null) {
|
||||
PoiType pt = allTranslatedSubTypes.get(subType);
|
||||
n.putTag(pt.getOsmTag(), pt.getOsmValue());
|
||||
if (pt.getOsmTag2() != null) {
|
||||
n.putTag(pt.getOsmTag2(), pt.getOsmValue2());
|
||||
}
|
||||
} else {
|
||||
n.putTag(a.getType().getDefaultTag(), subType);
|
||||
}
|
||||
String name = nameText.getText().toString();
|
||||
if(name.length() > 0) {
|
||||
n.putTag(OSMTagKey.NAME.getValue(), name);
|
||||
}
|
||||
if (openingHours.getText().toString().length() == 0) {
|
||||
n.removeTag(OSMTagKey.OPENING_HOURS.getValue());
|
||||
} else {
|
||||
n.putTag(OSMTagKey.OPENING_HOURS.getValue(), openingHours.getText().toString());
|
||||
}
|
||||
String website = websiteText.getText().toString();
|
||||
if (website.length() > 0 ){
|
||||
n.putTag(OSMTagKey.WEBSITE.getValue(),website);
|
||||
} else {
|
||||
n.removeTag(OSMTagKey.WEBSITE.getValue());
|
||||
}
|
||||
String phone = phoneText.getText().toString();
|
||||
if (phone.length() > 0 ){
|
||||
n.putTag(OSMTagKey.PHONE.getValue(),phone);
|
||||
} else {
|
||||
n.removeTag(OSMTagKey.PHONE.getValue());
|
||||
}
|
||||
String str = streetNameText.getText().toString();
|
||||
if (str .length() > 0 ){
|
||||
n.putTag(OSMTagKey.ADDR_STREET.getValue(),str);
|
||||
} else {
|
||||
n.removeTag(OSMTagKey.ADDR_STREET.getValue());
|
||||
}
|
||||
String hno = hnoText.getText().toString();
|
||||
if (hno .length() > 0 ){
|
||||
n.putTag(OSMTagKey.ADDR_HOUSE_NUMBER.getValue(),hno);
|
||||
} else {
|
||||
n.removeTag(OSMTagKey.ADDR_HOUSE_NUMBER.getValue());
|
||||
}
|
||||
commitNode(action, n, openstreetmapUtil.getEntityInfo(), commentText.getText().toString(), closeChange.isSelected(),
|
||||
new Runnable() {
|
||||
@Override
|
||||
R.string.default_buttons_commit, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
Resources resources = view.getResources();
|
||||
final String msg = node.getId() == -1 ? resources.getString(R.string.poi_action_add) : resources
|
||||
.getString(R.string.poi_action_change);
|
||||
OsmPoint.Action action = node.getId() == -1 ? OsmPoint.Action.CREATE : OsmPoint.Action.MODIFY;
|
||||
String subType = typeText.getText().toString().trim().toLowerCase();
|
||||
if (allTranslatedSubTypes.get(subType) != null) {
|
||||
PoiType pt = allTranslatedSubTypes.get(subType);
|
||||
node.putTag(pt.getOsmTag(), pt.getOsmValue());
|
||||
if (pt.getOsmTag2() != null) {
|
||||
node.putTag(pt.getOsmTag2(), pt.getOsmValue2());
|
||||
}
|
||||
} else {
|
||||
node.putTag(amenity.getType().getDefaultTag(), subType);
|
||||
}
|
||||
String name = nameText.getText().toString();
|
||||
if(name.length() > 0) {
|
||||
node.putTag(OSMTagKey.NAME.getValue(), name);
|
||||
}
|
||||
if (openingHours.getText().toString().length() == 0) {
|
||||
node.removeTag(OSMTagKey.OPENING_HOURS.getValue());
|
||||
} else {
|
||||
node.putTag(OSMTagKey.OPENING_HOURS.getValue(), openingHours.getText().toString());
|
||||
}
|
||||
String website = websiteText.getText().toString();
|
||||
if (website.length() > 0 ){
|
||||
node.putTag(OSMTagKey.WEBSITE.getValue(), website);
|
||||
} else {
|
||||
node.removeTag(OSMTagKey.WEBSITE.getValue());
|
||||
}
|
||||
String phone = phoneText.getText().toString();
|
||||
if (phone.length() > 0 ){
|
||||
node.putTag(OSMTagKey.PHONE.getValue(), phone);
|
||||
} else {
|
||||
node.removeTag(OSMTagKey.PHONE.getValue());
|
||||
}
|
||||
String str = streetNameText.getText().toString();
|
||||
if (str .length() > 0 ){
|
||||
node.putTag(OSMTagKey.ADDR_STREET.getValue(), str);
|
||||
} else {
|
||||
node.removeTag(OSMTagKey.ADDR_STREET.getValue());
|
||||
}
|
||||
String hno = hnoText.getText().toString();
|
||||
if (hno .length() > 0 ){
|
||||
node.putTag(OSMTagKey.ADDR_HOUSE_NUMBER.getValue(), hno);
|
||||
} else {
|
||||
node.removeTag(OSMTagKey.ADDR_HOUSE_NUMBER.getValue());
|
||||
}
|
||||
commitNode(action, node, openstreetmapUtil.getEntityInfo(), commentText.getText().toString(), closeChange.isSelected(),
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (isLocalEdit) {
|
||||
AccessibleToast.makeText(
|
||||
|
@ -481,12 +480,12 @@ public class EditingPOIDialogProvider implements DialogProvider {
|
|||
}
|
||||
activity.removeDialog(dialogID);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
preparePOIDialog(view, args);
|
||||
attachListeners(view, a, n);
|
||||
updateOsmTagValue(a);
|
||||
attachListeners(view, amenity, node);
|
||||
updateOsmTagValue(amenity);
|
||||
return dlg;
|
||||
}
|
||||
|
||||
|
@ -684,8 +683,8 @@ public class EditingPOIDialogProvider implements DialogProvider {
|
|||
|
||||
|
||||
public void commitNode(final OsmPoint.Action action, final Node n, final EntityInfo info, final String comment,
|
||||
final boolean closeChangeSet,
|
||||
final Runnable successAction) {
|
||||
final boolean closeChangeSet,
|
||||
final Runnable successAction) {
|
||||
if (info == null && OsmPoint.Action.CREATE != action) {
|
||||
AccessibleToast.makeText(activity, activity.getResources().getString(R.string.poi_error_info_not_loaded), Toast.LENGTH_LONG).show();
|
||||
return;
|
||||
|
@ -717,60 +716,60 @@ public class EditingPOIDialogProvider implements DialogProvider {
|
|||
public Dialog onCreateDialog(int id) {
|
||||
Bundle args = dialogBundle;
|
||||
switch (id) {
|
||||
case DIALOG_DELETE_POI:
|
||||
return createDeleteDialog(args);
|
||||
case DIALOG_SUB_CATEGORIES: {
|
||||
Builder builder = new AlertDialog.Builder(activity);
|
||||
final Amenity a = (Amenity) args.getSerializable(KEY_AMENITY);
|
||||
final Map<String, PoiType> allTranslatedNames = poiTypes.getAllTranslatedNames(a.getType(), true);
|
||||
final String[] subCats = allTranslatedNames.keySet().toArray(new String[0]);
|
||||
builder.setItems(subCats, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
PoiType poiType = allTranslatedNames.get(subCats[which]);
|
||||
typeText.setText(subCats[which]);
|
||||
activity.removeDialog(DIALOG_SUB_CATEGORIES);
|
||||
}
|
||||
});
|
||||
builder.setOnCancelListener(new DialogInterface.OnCancelListener() {
|
||||
@Override
|
||||
public void onCancel(DialogInterface dialog) {
|
||||
activity.removeDialog(DIALOG_SUB_CATEGORIES);
|
||||
}
|
||||
});
|
||||
return builder.create();
|
||||
}
|
||||
case DIALOG_POI_TYPES: {
|
||||
final Amenity a = (Amenity) args.getSerializable(KEY_AMENITY);
|
||||
Builder builder = new AlertDialog.Builder(activity);
|
||||
final List<PoiCategory> categories = poiTypes.getCategories(false);
|
||||
String[] vals = new String[categories.size()];
|
||||
for (int i = 0; i < vals.length; i++) {
|
||||
vals[i] = categories.get(i).getTranslation();
|
||||
}
|
||||
builder.setItems(vals, new Dialog.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
PoiCategory aType = categories.get(which);
|
||||
if (aType != a.getType()) {
|
||||
a.setType(aType);
|
||||
a.setSubType(""); //$NON-NLS-1$
|
||||
updateType(a);
|
||||
case DIALOG_DELETE_POI:
|
||||
return createDeleteDialog(args);
|
||||
case DIALOG_SUB_CATEGORIES: {
|
||||
Builder builder = new AlertDialog.Builder(activity);
|
||||
final Amenity a = (Amenity) args.getSerializable(KEY_AMENITY);
|
||||
final Map<String, PoiType> allTranslatedNames = poiTypes.getAllTranslatedNames(a.getType(), true);
|
||||
final String[] subCats = allTranslatedNames.keySet().toArray(new String[0]);
|
||||
builder.setItems(subCats, new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
PoiType poiType = allTranslatedNames.get(subCats[which]);
|
||||
typeText.setText(subCats[which]);
|
||||
activity.removeDialog(DIALOG_SUB_CATEGORIES);
|
||||
}
|
||||
activity.removeDialog(DIALOG_POI_TYPES);
|
||||
});
|
||||
builder.setOnCancelListener(new DialogInterface.OnCancelListener() {
|
||||
@Override
|
||||
public void onCancel(DialogInterface dialog) {
|
||||
activity.removeDialog(DIALOG_SUB_CATEGORIES);
|
||||
}
|
||||
});
|
||||
return builder.create();
|
||||
}
|
||||
case DIALOG_POI_TYPES: {
|
||||
final Amenity a = (Amenity) args.getSerializable(KEY_AMENITY);
|
||||
Builder builder = new AlertDialog.Builder(activity);
|
||||
final List<PoiCategory> categories = poiTypes.getCategories(false);
|
||||
String[] vals = new String[categories.size()];
|
||||
for (int i = 0; i < vals.length; i++) {
|
||||
vals[i] = categories.get(i).getTranslation();
|
||||
}
|
||||
});
|
||||
builder.setOnCancelListener(new DialogInterface.OnCancelListener() {
|
||||
@Override
|
||||
public void onCancel(DialogInterface dialog) {
|
||||
activity.removeDialog(DIALOG_POI_TYPES);
|
||||
}
|
||||
});
|
||||
return builder.create();
|
||||
}
|
||||
case DIALOG_OPENING_HOURS: {
|
||||
return createOpenHoursDlg();
|
||||
}
|
||||
builder.setItems(vals, new Dialog.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
PoiCategory aType = categories.get(which);
|
||||
if (aType != a.getType()) {
|
||||
a.setType(aType);
|
||||
a.setSubType(""); //$NON-NLS-1$
|
||||
updateType(a);
|
||||
}
|
||||
activity.removeDialog(DIALOG_POI_TYPES);
|
||||
}
|
||||
});
|
||||
builder.setOnCancelListener(new DialogInterface.OnCancelListener() {
|
||||
@Override
|
||||
public void onCancel(DialogInterface dialog) {
|
||||
activity.removeDialog(DIALOG_POI_TYPES);
|
||||
}
|
||||
});
|
||||
return builder.create();
|
||||
}
|
||||
case DIALOG_OPENING_HOURS: {
|
||||
return createOpenHoursDlg();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -787,4 +786,3 @@ public class EditingPOIDialogProvider implements DialogProvider {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue