Merge pull request #8344 from osmandapp/Fix_create_new_favorite

Fix create new favorite
This commit is contained in:
max-klaus 2020-01-28 16:56:07 +03:00 committed by GitHub
commit ad8b7e369e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3,7 +3,6 @@ package net.osmand.data;
import java.io.Serializable; import java.io.Serializable;
import android.content.Context; import android.content.Context;
import android.content.res.Resources;
import android.support.annotation.DrawableRes; import android.support.annotation.DrawableRes;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.annotation.StringRes; import android.support.annotation.StringRes;
@ -19,7 +18,6 @@ public class FavouritePoint implements Serializable, LocationPoint {
private static final String HIDDEN = "hidden"; private static final String HIDDEN = "hidden";
private static final String ADDRESS_EXTENSION = "address"; private static final String ADDRESS_EXTENSION = "address";
private static final String DEFAULT_ICON_NAME = "special_star";
protected String name = ""; protected String name = "";
protected String description; protected String description;
@ -139,6 +137,8 @@ public class FavouritePoint implements Serializable, LocationPoint {
public int getOverlayIconId() { public int getOverlayIconId() {
if (isSpecialPoint()) { if (isSpecialPoint()) {
return specialPointType.getIconId(); return specialPointType.getIconId();
} else if (iconId == 0) {
return R.drawable.mx_special_star;
} }
return iconId; return iconId;
} }
@ -202,7 +202,6 @@ public class FavouritePoint implements Serializable, LocationPoint {
return "Favourite " + getName(); //$NON-NLS-1$ return "Favourite " + getName(); //$NON-NLS-1$
} }
@Override @Override
public boolean equals(Object o) { public boolean equals(Object o) {
if (this == o) return true; if (this == o) return true;
@ -253,7 +252,6 @@ public class FavouritePoint implements Serializable, LocationPoint {
return result; return result;
} }
public enum SpecialPointType { public enum SpecialPointType {
HOME("home", R.string.home_button, R.drawable.mx_special_house), HOME("home", R.string.home_button, R.drawable.mx_special_house),
WORK("work", R.string.work_button, R.drawable.mx_special_building), WORK("work", R.string.work_button, R.drawable.mx_special_building),
@ -286,7 +284,6 @@ public class FavouritePoint implements Serializable, LocationPoint {
} }
} }
public static FavouritePoint fromWpt(@NonNull WptPt pt, @NonNull Context ctx) { public static FavouritePoint fromWpt(@NonNull WptPt pt, @NonNull Context ctx) {
String name = pt.name; String name = pt.name;
String categoryName = pt.category != null ? pt.category : ""; String categoryName = pt.category != null ? pt.category : "";