commit
5d0578b57e
3 changed files with 47 additions and 31 deletions
|
@ -1,6 +1,7 @@
|
|||
package net.osmand.plus.osmedit;
|
||||
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
|
||||
|
@ -21,7 +22,7 @@ public class EditPOIMenuController extends MenuController {
|
|||
|
||||
private OsmPoint osmPoint;
|
||||
private OsmEditingPlugin plugin;
|
||||
private String category;
|
||||
private String categoryDescr;
|
||||
private String actionStr;
|
||||
|
||||
public EditPOIMenuController(@NonNull MapActivity mapActivity, @NonNull PointDescription pointDescription, @NonNull OsmPoint osmPoint) {
|
||||
|
@ -80,7 +81,7 @@ public class EditPOIMenuController extends MenuController {
|
|||
rightTitleButtonController.caption = mapActivity.getString(R.string.shared_string_delete);
|
||||
rightTitleButtonController.updateStateListDrawableIcon(R.drawable.ic_action_delete_dark, true);
|
||||
|
||||
category = getCategory();
|
||||
categoryDescr = getCategoryDescr();
|
||||
|
||||
if (osmPoint.getGroup() == OsmPoint.Group.POI) {
|
||||
if (osmPoint.getAction() == Action.DELETE) {
|
||||
|
@ -108,7 +109,7 @@ public class EditPOIMenuController extends MenuController {
|
|||
@NonNull
|
||||
@Override
|
||||
public String getTypeStr() {
|
||||
return category;
|
||||
return categoryDescr;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -129,7 +130,7 @@ public class EditPOIMenuController extends MenuController {
|
|||
|
||||
@Override
|
||||
public boolean needTypeStr() {
|
||||
return !Algorithms.isEmpty(category);
|
||||
return !Algorithms.isEmpty(categoryDescr);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -186,6 +187,16 @@ public class EditPOIMenuController extends MenuController {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Drawable getRightIcon() {
|
||||
int iconResId = getRightIconId();
|
||||
if (iconResId != 0) {
|
||||
return getIcon(iconResId, getAdditionalInfoColorId());
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAdditionalInfoIconRes() {
|
||||
if (osmPoint.getAction() == Action.DELETE) {
|
||||
|
@ -202,7 +213,7 @@ public class EditPOIMenuController extends MenuController {
|
|||
return false;
|
||||
}
|
||||
|
||||
private String getCategory() {
|
||||
return OsmEditingPlugin.getCategory(osmPoint, getMapActivity());
|
||||
private String getCategoryDescr() {
|
||||
return OsmEditingPlugin.getDescription(osmPoint, getMapActivity(), false);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -498,6 +498,35 @@ public class OsmEditingPlugin extends OsmandPlugin {
|
|||
return (osmPoint.getGroup() == OsmPoint.Group.POI ? "POI" : "Bug") + " id: " + osmPoint.getId() + " ";
|
||||
}
|
||||
|
||||
public static String getDescription(OsmPoint osmPoint, Context context, boolean needPrefix) {
|
||||
String action = "";
|
||||
if (osmPoint.getAction() == OsmPoint.Action.CREATE) {
|
||||
action = context.getString(R.string.shared_string_added);
|
||||
} else if (osmPoint.getAction() == OsmPoint.Action.MODIFY) {
|
||||
action = context.getString(R.string.shared_string_edited);
|
||||
} else if (osmPoint.getAction() == OsmPoint.Action.DELETE) {
|
||||
action = context.getString(R.string.shared_string_deleted);
|
||||
} else if (osmPoint.getAction() == OsmPoint.Action.REOPEN) {
|
||||
action = context.getString(R.string.shared_string_edited);
|
||||
}
|
||||
|
||||
String category = getCategory(osmPoint, context);
|
||||
|
||||
String description = "";
|
||||
if (!Algorithms.isEmpty(action)) {
|
||||
description += action + " • ";
|
||||
}
|
||||
if (!Algorithms.isEmpty(category)) {
|
||||
description += category;
|
||||
}
|
||||
if (needPrefix) {
|
||||
String prefix = getPrefix(osmPoint);
|
||||
description += " • " + prefix;
|
||||
}
|
||||
|
||||
return description;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DashFragmentData getCardFragment() {
|
||||
return DashOsmEditsFragment.FRAGMENT_DATA;
|
||||
|
|
|
@ -305,31 +305,7 @@ public class OsmEditsAdapter extends ArrayAdapter<Object> {
|
|||
}
|
||||
|
||||
private String getDescription(OsmPoint point) {
|
||||
String action = "";
|
||||
if (point.getAction() == OsmPoint.Action.CREATE) {
|
||||
action = getContext().getString(R.string.shared_string_added);
|
||||
} else if (point.getAction() == OsmPoint.Action.MODIFY) {
|
||||
action = getContext().getString(R.string.shared_string_edited);
|
||||
} else if (point.getAction() == OsmPoint.Action.DELETE) {
|
||||
action = getContext().getString(R.string.shared_string_deleted);
|
||||
} else if (point.getAction() == OsmPoint.Action.REOPEN) {
|
||||
action = getContext().getString(R.string.shared_string_edited);
|
||||
}
|
||||
|
||||
String category = getCategory(point);
|
||||
|
||||
String prefix = OsmEditingPlugin.getPrefix(point);
|
||||
|
||||
String description = "";
|
||||
if (!Algorithms.isEmpty(action)) {
|
||||
description += action + " • ";
|
||||
}
|
||||
if (!Algorithms.isEmpty(category)) {
|
||||
description += category + " • ";
|
||||
}
|
||||
description += prefix;
|
||||
|
||||
return description;
|
||||
return OsmEditingPlugin.getDescription(point, getContext(), true);
|
||||
}
|
||||
|
||||
private class HeaderViewHolder {
|
||||
|
|
Loading…
Reference in a new issue