Change edit poi controller and refactor
This commit is contained in:
parent
c35632d21f
commit
18e2eaf54f
11 changed files with 178 additions and 138 deletions
|
@ -111,7 +111,7 @@
|
|||
android:layout_marginRight="@dimen/context_menu_padding_margin_small"
|
||||
android:layout_marginEnd="@dimen/context_menu_padding_margin_small"
|
||||
tools:text="Closed till 10:00"
|
||||
android:id="@+id/opening_hours_text_view"
|
||||
android:id="@+id/additional_info_text_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ package net.osmand.plus.mapcontextmenu;
|
|||
import android.app.Dialog;
|
||||
import android.app.ProgressDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.support.v4.app.Fragment;
|
||||
|
@ -1135,13 +1136,37 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
|
|||
return menuController != null && menuController.displayDistanceDirection();
|
||||
}
|
||||
|
||||
public boolean displayAdditionalTypeStrInHours() {
|
||||
return menuController != null && menuController.displayAdditionalTypeStrInHours();
|
||||
public String getSubtypeStr() {
|
||||
if (menuController != null) {
|
||||
return menuController.getSubtypeStr();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public int getTimeStrColor() {
|
||||
public Drawable getSubtypeIcon() {
|
||||
if (menuController != null) {
|
||||
return menuController.getTimeStrColor();
|
||||
return menuController.getSubtypeIcon();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public int getAdditionalInfoColor() {
|
||||
if (menuController != null) {
|
||||
return menuController.getAdditionalInfoColor();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public String getAdditionalInfo() {
|
||||
if (menuController != null) {
|
||||
return menuController.getAdditionalInfoStr();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public int getAdditionalInfoIconRes() {
|
||||
if (menuController != null) {
|
||||
return menuController.getAdditionalInfoIconRes();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -1126,61 +1126,43 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
|
|||
}
|
||||
line2Str.append(streetStr);
|
||||
}
|
||||
if (!TextUtils.isEmpty(line2Str)) {
|
||||
line2.setText(line2Str.toString());
|
||||
line2.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
line2.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
TextView line3 = (TextView) view.findViewById(R.id.context_menu_line3);
|
||||
String additionalTypeStr = menu.getAdditionalTypeStr();
|
||||
boolean displayAdditionalTypeStrInHours = menu.displayAdditionalTypeStrInHours();
|
||||
boolean emptyAdditionalTypeStr = TextUtils.isEmpty(additionalTypeStr);
|
||||
if (emptyAdditionalTypeStr || displayAdditionalTypeStrInHours) {
|
||||
String subtypeStr = menu.getSubtypeStr();
|
||||
if (TextUtils.isEmpty(subtypeStr)) {
|
||||
line3.setVisibility(View.GONE);
|
||||
} else {
|
||||
line3.setVisibility(View.VISIBLE);
|
||||
line3.setText(additionalTypeStr);
|
||||
Drawable icon = menu.getAdditionalLineTypeIcon();
|
||||
line3.setText(subtypeStr);
|
||||
Drawable icon = menu.getSubtypeIcon();
|
||||
line3.setCompoundDrawablesWithIntrinsicBounds(icon, null, null, null);
|
||||
line3.setCompoundDrawablePadding(dpToPx(5f));
|
||||
}
|
||||
|
||||
TextView openingHoursTextView = (TextView) view.findViewById(R.id.opening_hours_text_view);
|
||||
OpeningHoursInfo openingHoursInfo = menu.getOpeningHoursInfo();
|
||||
boolean containsOpeningHours = openingHoursInfo != null && openingHoursInfo.containsInfo();
|
||||
if (containsOpeningHours || (displayAdditionalTypeStrInHours && !emptyAdditionalTypeStr)) {
|
||||
int colorId;
|
||||
if (containsOpeningHours) {
|
||||
colorId = openingHoursInfo.isOpened() ? R.color.ctx_menu_amenity_opened_text_color : R.color.ctx_menu_amenity_closed_text_color;
|
||||
} else {
|
||||
colorId = menu.getTimeStrColor();
|
||||
}
|
||||
String timeInfo = "";
|
||||
if (containsOpeningHours) {
|
||||
if (openingHoursInfo.isOpened24_7()) {
|
||||
timeInfo = getString(R.string.shared_string_is_open_24_7);
|
||||
} else if (!Algorithms.isEmpty(openingHoursInfo.getNearToOpeningTime())) {
|
||||
timeInfo = getString(R.string.will_be_opened_at) + " " + openingHoursInfo.getNearToOpeningTime();
|
||||
} else if (!Algorithms.isEmpty(openingHoursInfo.getOpeningTime())) {
|
||||
timeInfo = getString(R.string.opened_from) + " " + openingHoursInfo.getOpeningTime();
|
||||
} else if (!Algorithms.isEmpty(openingHoursInfo.getNearToClosingTime())) {
|
||||
timeInfo = getString(R.string.will_be_closed_at) + " " + openingHoursInfo.getNearToClosingTime();
|
||||
} else if (!Algorithms.isEmpty(openingHoursInfo.getClosingTime())) {
|
||||
timeInfo = getString(R.string.opened_till) + " " + openingHoursInfo.getClosingTime();
|
||||
} else if (!Algorithms.isEmpty(openingHoursInfo.getOpeningDay())) {
|
||||
timeInfo = getString(R.string.will_be_opened_on) + " " + openingHoursInfo.getOpeningDay() + ".";
|
||||
}
|
||||
} else {
|
||||
timeInfo = additionalTypeStr;
|
||||
}
|
||||
TextView additionalInfoTextView = (TextView) view.findViewById(R.id.additional_info_text_view);
|
||||
String additionalInfoStr = menu.getAdditionalInfo();
|
||||
if (!TextUtils.isEmpty(additionalInfoStr)) {
|
||||
int colorId = menu.getAdditionalInfoColor();
|
||||
int additionalInfoIconRes = menu.getAdditionalInfoIconRes();
|
||||
if (colorId != 0) {
|
||||
openingHoursTextView.setTextColor(ContextCompat.getColor(getContext(), colorId));
|
||||
Drawable drawable = getIcon(R.drawable.ic_action_opening_hour_16, colorId);
|
||||
openingHoursTextView.setCompoundDrawablesWithIntrinsicBounds(drawable, null, null, null);
|
||||
openingHoursTextView.setCompoundDrawablePadding(dpToPx(8));
|
||||
additionalInfoTextView.setTextColor(ContextCompat.getColor(getContext(), colorId));
|
||||
if (additionalInfoIconRes != 0) {
|
||||
Drawable additionalIcon = getIcon(additionalInfoIconRes, colorId);
|
||||
additionalInfoTextView.setCompoundDrawablesWithIntrinsicBounds(additionalIcon, null, null, null);
|
||||
additionalInfoTextView.setCompoundDrawablePadding(dpToPx(8));
|
||||
}
|
||||
openingHoursTextView.setText(timeInfo);
|
||||
openingHoursTextView.setVisibility(View.VISIBLE);
|
||||
}
|
||||
additionalInfoTextView.setText(additionalInfoStr);
|
||||
additionalInfoTextView.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
openingHoursTextView.setVisibility(View.GONE);
|
||||
additionalInfoTextView.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
updateCompassVisibility();
|
||||
|
|
|
@ -386,10 +386,6 @@ public abstract class MenuController extends BaseMenuController {
|
|||
return false;
|
||||
}
|
||||
|
||||
public boolean displayAdditionalTypeStrInHours() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public int getLeftIconId() {
|
||||
return 0;
|
||||
}
|
||||
|
@ -402,7 +398,7 @@ public abstract class MenuController extends BaseMenuController {
|
|||
return null;
|
||||
}
|
||||
|
||||
public Drawable getAdditionalLineTypeIcon() {
|
||||
public Drawable getSubtypeIcon() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -432,16 +428,20 @@ public abstract class MenuController extends BaseMenuController {
|
|||
return "";
|
||||
}
|
||||
|
||||
public String getAdditionalTypeStr() {
|
||||
public String getSubtypeStr() {
|
||||
return "";
|
||||
}
|
||||
|
||||
public int getTimeStrColor() {
|
||||
public int getAdditionalInfoColor() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public OpeningHoursInfo getOpeningHoursInfo() {
|
||||
return null;
|
||||
public String getAdditionalInfoStr() {
|
||||
return "";
|
||||
}
|
||||
|
||||
public int getAdditionalInfoIconRes() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public String getCommonTypeStr() {
|
||||
|
|
|
@ -15,12 +15,9 @@ public abstract class MenuTitleController {
|
|||
protected Drawable leftIcon;
|
||||
protected String nameStr = "";
|
||||
protected String typeStr = "";
|
||||
protected String additionalTypeStr = "";
|
||||
protected String commonTypeStr = "";
|
||||
protected Drawable secondLineTypeIcon;
|
||||
protected Drawable additionalLineTypeIcon;
|
||||
protected String streetStr = "";
|
||||
protected OpeningHoursInfo openingHoursInfo;
|
||||
|
||||
private AddressLookupRequest addressLookupRequest;
|
||||
|
||||
|
@ -80,10 +77,6 @@ public abstract class MenuTitleController {
|
|||
return secondLineTypeIcon;
|
||||
}
|
||||
|
||||
public Drawable getAdditionalLineTypeIcon() {
|
||||
return additionalLineTypeIcon;
|
||||
}
|
||||
|
||||
public String getTypeStr() {
|
||||
MenuController menuController = getMenuController();
|
||||
if (menuController != null && menuController.needTypeStr()) {
|
||||
|
@ -93,15 +86,6 @@ public abstract class MenuTitleController {
|
|||
}
|
||||
}
|
||||
|
||||
public String getAdditionalTypeStr() {
|
||||
MenuController menuController = getMenuController();
|
||||
if (menuController != null) {
|
||||
return additionalTypeStr;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
public String getStreetStr() {
|
||||
if (needStreetName()) {
|
||||
if (searchingAddress()) {
|
||||
|
@ -114,10 +98,6 @@ public abstract class MenuTitleController {
|
|||
}
|
||||
}
|
||||
|
||||
public OpeningHoursInfo getOpeningHoursInfo() {
|
||||
return openingHoursInfo;
|
||||
}
|
||||
|
||||
protected void initTitle() {
|
||||
searchAddressStr = PointDescription.getSearchAddressStr(getMapActivity());
|
||||
addressNotFoundStr = PointDescription.getAddressNotFoundStr(getMapActivity());
|
||||
|
@ -131,8 +111,6 @@ public abstract class MenuTitleController {
|
|||
if (needStreetName()) {
|
||||
acquireStreetName();
|
||||
}
|
||||
|
||||
acquireOpeningHoursInfo();
|
||||
}
|
||||
|
||||
protected boolean needStreetName() {
|
||||
|
@ -150,13 +128,11 @@ public abstract class MenuTitleController {
|
|||
leftIconId = 0;
|
||||
leftIcon = null;
|
||||
secondLineTypeIcon = null;
|
||||
additionalLineTypeIcon = null;
|
||||
|
||||
if (menuController != null) {
|
||||
leftIconId = menuController.getLeftIconId();
|
||||
leftIcon = menuController.getLeftIcon();
|
||||
secondLineTypeIcon = menuController.getSecondLineTypeIcon();
|
||||
additionalLineTypeIcon = menuController.getAdditionalLineTypeIcon();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -170,7 +146,6 @@ public abstract class MenuTitleController {
|
|||
if (menuController != null) {
|
||||
nameStr = menuController.getNameStr();
|
||||
typeStr = menuController.getTypeStr();
|
||||
additionalTypeStr = menuController.getAdditionalTypeStr();
|
||||
commonTypeStr = menuController.getCommonTypeStr();
|
||||
}
|
||||
|
||||
|
@ -211,13 +186,6 @@ public abstract class MenuTitleController {
|
|||
getMapActivity().getMyApplication().getGeocodingLookupService().lookupAddress(addressLookupRequest);
|
||||
}
|
||||
|
||||
protected void acquireOpeningHoursInfo() {
|
||||
MenuController menuController = getMenuController();
|
||||
if (menuController != null) {
|
||||
openingHoursInfo = menuController.getOpeningHoursInfo();
|
||||
}
|
||||
}
|
||||
|
||||
protected void onSearchAddressDone() {
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
package net.osmand.plus.mapcontextmenu;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.util.Algorithms;
|
||||
|
||||
public class OpeningHoursInfo {
|
||||
|
@ -68,12 +71,20 @@ public class OpeningHoursInfo {
|
|||
this.openingDay = openingDay;
|
||||
}
|
||||
|
||||
public boolean containsInfo() {
|
||||
return opened24_7
|
||||
|| !Algorithms.isEmpty(openingTime)
|
||||
|| !Algorithms.isEmpty(nearToOpeningTime)
|
||||
|| !Algorithms.isEmpty(closingTime)
|
||||
|| !Algorithms.isEmpty(nearToClosingTime)
|
||||
|| !Algorithms.isEmpty(openingDay);
|
||||
public String getInfo(Context context) {
|
||||
if (isOpened24_7()) {
|
||||
return context.getString(R.string.shared_string_is_open_24_7);
|
||||
} else if (!Algorithms.isEmpty(getNearToOpeningTime())) {
|
||||
return context.getString(R.string.will_be_opened_at) + " " + getNearToOpeningTime();
|
||||
} else if (!Algorithms.isEmpty(getOpeningTime())) {
|
||||
return context.getString(R.string.opened_from) + " " + getOpeningTime();
|
||||
} else if (!Algorithms.isEmpty(getNearToClosingTime())) {
|
||||
return context.getString(R.string.will_be_closed_at) + " " + getNearToClosingTime();
|
||||
} else if (!Algorithms.isEmpty(getClosingTime())) {
|
||||
return context.getString(R.string.opened_till) + " " + getClosingTime();
|
||||
} else if (!Algorithms.isEmpty(getOpeningDay())) {
|
||||
return context.getString(R.string.will_be_opened_on) + " " + getOpeningDay() + ".";
|
||||
}
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@ public class AmenityMenuController extends MenuController {
|
|||
|
||||
private Amenity amenity;
|
||||
private List<TransportStopRoute> routes = new ArrayList<>();
|
||||
private OpeningHoursInfo openingHoursInfo;
|
||||
|
||||
private MapMarker marker;
|
||||
|
||||
|
@ -76,6 +77,8 @@ public class AmenityMenuController extends MenuController {
|
|||
leftTitleButtonController.leftIcon = getIcon(R.drawable.ic_action_note_dark, isLight() ? R.color.ctx_menu_controller_button_text_color_light_n : R.color.ctx_menu_controller_button_text_color_dark_n);
|
||||
}
|
||||
}
|
||||
|
||||
openingHoursInfo = processOpeningHours(amenity);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -145,8 +148,27 @@ public class AmenityMenuController extends MenuController {
|
|||
}
|
||||
|
||||
@Override
|
||||
public OpeningHoursInfo getOpeningHoursInfo() {
|
||||
return processOpeningHours(amenity);
|
||||
public int getAdditionalInfoColor() {
|
||||
if (openingHoursInfo != null) {
|
||||
return openingHoursInfo.isOpened() ? R.color.ctx_menu_amenity_opened_text_color : R.color.ctx_menu_amenity_closed_text_color;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAdditionalInfoStr() {
|
||||
if (openingHoursInfo != null) {
|
||||
return openingHoursInfo.getInfo(getMapActivity());
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAdditionalInfoIconRes() {
|
||||
if (openingHoursInfo != null) {
|
||||
return R.drawable.ic_action_opening_hour_16;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static String getTypeStr(Amenity amenity) {
|
||||
|
|
|
@ -24,6 +24,7 @@ public class FavouritePointMenuController extends MenuController {
|
|||
|
||||
private FavouritePoint fav;
|
||||
private MapMarker mapMarker;
|
||||
private OpeningHoursInfo openingHoursInfo;
|
||||
|
||||
public FavouritePointMenuController(MapActivity mapActivity, PointDescription pointDescription, final FavouritePoint fav) {
|
||||
super(new FavouritePointMenuBuilder(mapActivity, fav), pointDescription, mapActivity);
|
||||
|
@ -45,6 +46,11 @@ public class FavouritePointMenuController extends MenuController {
|
|||
TransportStopController transportStopController = new TransportStopController(getMapActivity(), pointDescription, stop);
|
||||
transportStopController.processTransportStop(builder);
|
||||
}
|
||||
|
||||
Object originObject = getBuilder().getOriginObject();
|
||||
if (originObject instanceof Amenity) {
|
||||
openingHoursInfo = AmenityMenuController.processOpeningHours((Amenity) originObject);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -136,11 +142,26 @@ public class FavouritePointMenuController extends MenuController {
|
|||
}
|
||||
|
||||
@Override
|
||||
public OpeningHoursInfo getOpeningHoursInfo() {
|
||||
Object originObject = getBuilder().getOriginObject();
|
||||
if (originObject instanceof Amenity) {
|
||||
return AmenityMenuController.processOpeningHours((Amenity) originObject);
|
||||
public int getAdditionalInfoColor() {
|
||||
if (openingHoursInfo != null) {
|
||||
return openingHoursInfo.isOpened() ? R.color.ctx_menu_amenity_opened_text_color : R.color.ctx_menu_amenity_closed_text_color;
|
||||
}
|
||||
return null;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAdditionalInfoStr() {
|
||||
if (openingHoursInfo != null) {
|
||||
return openingHoursInfo.getInfo(getMapActivity());
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAdditionalInfoIconRes() {
|
||||
if (openingHoursInfo != null) {
|
||||
return R.drawable.ic_action_opening_hour_16;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,8 +82,8 @@ public class WptPtMenuController extends MenuController {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Drawable getAdditionalLineTypeIcon() {
|
||||
if (Algorithms.isEmpty(getAdditionalTypeStr())) {
|
||||
public Drawable getSubtypeIcon() {
|
||||
if (Algorithms.isEmpty(getSubtypeStr())) {
|
||||
return null;
|
||||
} else {
|
||||
return getIcon(R.drawable.ic_action_group_name_16);
|
||||
|
@ -111,7 +111,7 @@ public class WptPtMenuController extends MenuController {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getAdditionalTypeStr() {
|
||||
public String getSubtypeStr() {
|
||||
return wpt.category != null ? wpt.category : "";
|
||||
}
|
||||
|
||||
|
|
|
@ -13,6 +13,7 @@ import net.osmand.plus.mapcontextmenu.MenuController;
|
|||
import net.osmand.plus.osmedit.OsmPoint.Action;
|
||||
import net.osmand.plus.osmedit.dialogs.SendPoiDialogFragment;
|
||||
import net.osmand.plus.render.RenderingIcons;
|
||||
import net.osmand.util.Algorithms;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -20,7 +21,8 @@ public class EditPOIMenuController extends MenuController {
|
|||
|
||||
private OsmPoint osmPoint;
|
||||
private OsmEditingPlugin plugin;
|
||||
private String pointTypeStr;
|
||||
private String category;
|
||||
private String actionStr;
|
||||
|
||||
public EditPOIMenuController(final MapActivity mapActivity, PointDescription pointDescription, OsmPoint osmPoint) {
|
||||
super(new EditPOIMenuBuilder(mapActivity, osmPoint), pointDescription, mapActivity);
|
||||
|
@ -73,33 +75,34 @@ public class EditPOIMenuController extends MenuController {
|
|||
rightTitleButtonController.caption = getMapActivity().getString(R.string.shared_string_delete);
|
||||
rightTitleButtonController.leftIconId = R.drawable.ic_action_delete_dark;
|
||||
|
||||
category = getCategory();
|
||||
|
||||
if (osmPoint.getGroup() == OsmPoint.Group.POI) {
|
||||
if(osmPoint.getAction() == Action.DELETE) {
|
||||
pointTypeStr = getMapActivity().getString(R.string.osm_edit_deleted_poi);
|
||||
actionStr = getMapActivity().getString(R.string.osm_edit_deleted_poi);
|
||||
} else if(osmPoint.getAction() == Action.MODIFY) {
|
||||
pointTypeStr = getMapActivity().getString(R.string.osm_edit_modified_poi);
|
||||
actionStr = getMapActivity().getString(R.string.osm_edit_modified_poi);
|
||||
} else/* if(osmPoint.getAction() == Action.CREATE) */{
|
||||
pointTypeStr = getMapActivity().getString(R.string.osm_edit_created_poi);
|
||||
actionStr = getMapActivity().getString(R.string.osm_edit_created_poi);
|
||||
}
|
||||
|
||||
} else if (osmPoint.getGroup() == OsmPoint.Group.BUG) {
|
||||
if(osmPoint.getAction() == Action.DELETE) {
|
||||
pointTypeStr = getMapActivity().getString(R.string.osm_edit_removed_note);
|
||||
actionStr = getMapActivity().getString(R.string.osm_edit_removed_note);
|
||||
} else if(osmPoint.getAction() == Action.MODIFY) {
|
||||
pointTypeStr = getMapActivity().getString(R.string.osm_edit_commented_note);
|
||||
actionStr = getMapActivity().getString(R.string.osm_edit_commented_note);
|
||||
} else if(osmPoint.getAction() == Action.REOPEN) {
|
||||
pointTypeStr = getMapActivity().getString(R.string.osm_edit_reopened_note);
|
||||
actionStr = getMapActivity().getString(R.string.osm_edit_reopened_note);
|
||||
} else/* if(osmPoint.getAction() == Action.CREATE) */{
|
||||
pointTypeStr = getMapActivity().getString(R.string.osm_edit_created_note);
|
||||
actionStr = getMapActivity().getString(R.string.osm_edit_created_note);
|
||||
}
|
||||
} else {
|
||||
pointTypeStr = "";
|
||||
actionStr = "";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean displayAdditionalTypeStrInHours() {
|
||||
return true;
|
||||
public String getTypeStr() {
|
||||
return category;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -120,29 +123,27 @@ public class EditPOIMenuController extends MenuController {
|
|||
|
||||
@Override
|
||||
public boolean needTypeStr() {
|
||||
return false;
|
||||
return !Algorithms.isEmpty(category);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAdditionalTypeStr() {
|
||||
return pointTypeStr;
|
||||
public String getAdditionalInfoStr() {
|
||||
return actionStr;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTimeStrColor() {
|
||||
if (osmPoint.getAction() == OsmPoint.Action.CREATE) {
|
||||
return R.color.color_osm_edit_create;
|
||||
} else if (osmPoint.getAction() == OsmPoint.Action.MODIFY) {
|
||||
return R.color.color_osm_edit_modify;
|
||||
} else if (osmPoint.getAction() == OsmPoint.Action.DELETE) {
|
||||
public int getAdditionalInfoColor() {
|
||||
if (osmPoint.getAction() == Action.DELETE) {
|
||||
return R.color.color_osm_edit_delete;
|
||||
} else {
|
||||
} else if (osmPoint.getAction() == Action.MODIFY || osmPoint.getAction() == Action.REOPEN) {
|
||||
return R.color.color_osm_edit_modify;
|
||||
} else {
|
||||
return R.color.color_osm_edit_create;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Drawable getAdditionalLineTypeIcon() {
|
||||
public int getAdditionalInfoIconRes() {
|
||||
if (osmPoint.getGroup() == OsmPoint.Group.POI) {
|
||||
OpenstreetmapPoint osmP = (OpenstreetmapPoint) osmPoint;
|
||||
int iconResId = 0;
|
||||
|
@ -165,11 +166,11 @@ public class EditPOIMenuController extends MenuController {
|
|||
if (iconResId == 0) {
|
||||
iconResId = R.drawable.ic_type_info;
|
||||
}
|
||||
return getIcon(iconResId);
|
||||
return iconResId;
|
||||
} else if (osmPoint.getGroup() == OsmPoint.Group.BUG) {
|
||||
return getIcon(R.drawable.ic_type_bug);
|
||||
return R.drawable.ic_type_bug;
|
||||
} else {
|
||||
return null;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -177,4 +178,14 @@ public class EditPOIMenuController extends MenuController {
|
|||
public boolean needStreetName() {
|
||||
return false;
|
||||
}
|
||||
|
||||
private String getCategory() {
|
||||
String category = "";
|
||||
if (osmPoint.getGroup() == OsmPoint.Group.POI) {
|
||||
category = ((OpenstreetmapPoint) osmPoint).getEntity().getTag(EditPoiData.POI_TYPE_TAG);
|
||||
} else if (osmPoint.getGroup() == OsmPoint.Group.BUG) {
|
||||
category = getMapActivity().getString(R.string.osn_bug_name);
|
||||
}
|
||||
return category;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,17 +64,17 @@ public class ParkingPositionMenuController extends MenuController {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getAdditionalTypeStr() {
|
||||
public int getAdditionalInfoIconRes() {
|
||||
return R.drawable.ic_action_opening_hour_16;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAdditionalInfoStr() {
|
||||
return parkingLeftDescription;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean displayAdditionalTypeStrInHours() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTimeStrColor() {
|
||||
public int getAdditionalInfoColor() {
|
||||
return plugin.getParkingType() ? R.color.ctx_menu_amenity_closed_text_color : isLight() ? R.color.icon_color : R.color.dash_search_icon_dark;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue