Remove lookup address when map init, disable edit personal point from context menu

This commit is contained in:
Dima-1 2020-01-08 17:26:20 +02:00
parent c823231d7e
commit 4543e45bad
4 changed files with 10 additions and 16 deletions

View file

@ -55,6 +55,7 @@ public class FavouritePoint implements Serializable, LocationPoint {
this.description = favouritePoint.description;
this.visible = favouritePoint.visible;
this.originObjectName = favouritePoint.originObjectName;
this.address = favouritePoint.address;
initPersonalType();
}
@ -92,7 +93,7 @@ public class FavouritePoint implements Serializable, LocationPoint {
return !Algorithms.isEmpty(address);
}
public boolean isPersonalPoint() {
public boolean isSpecialPoint() {
return specialPointType != null;
}
@ -122,7 +123,7 @@ public class FavouritePoint implements Serializable, LocationPoint {
}
public int getOverlayIconId() {
if(specialPointType != null) {
if (isSpecialPoint()) {
return specialPointType.getIconId();
}
return 0;
@ -158,7 +159,7 @@ public class FavouritePoint implements Serializable, LocationPoint {
}
public String getDisplayName(@NonNull Context ctx) {
if (specialPointType != null) {
if (isSpecialPoint()) {
return specialPointType.getHumanString(ctx);
}
return name;
@ -262,15 +263,6 @@ public class FavouritePoint implements Serializable, LocationPoint {
return typeName;
}
public static SpecialPointType valueOfTypeName(@NonNull String typeName) {
for (SpecialPointType pt : values()) {
if (pt.typeName.equals(typeName)) {
return pt;
}
}
return null;
}
public int getIconId() {
return iconId;
}

View file

@ -422,12 +422,10 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
}
if (event == InitEvents.MAPS_INITIALIZED) {
// TODO investigate if this false cause any issues!
// !!! TODO HW it shouldn't be called every time start!!!
mapView.refreshMap(false);
if (dashboardOnMap != null) {
dashboardOnMap.updateLocation(true, true, false);
}
app.getFavorites().lookupAddressAllSpecialPoints();
app.getTargetPointsHelper().lookupAddessAll();
app.getMapMarkersHelper().lookupAddressAll();
}

View file

@ -19,7 +19,6 @@ import android.support.v4.content.res.ResourcesCompat;
import net.osmand.GPXUtilities;
import net.osmand.data.FavouritePoint;
import net.osmand.plus.FavouritesDbHelper;
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
@ -150,7 +149,7 @@ public class FavoriteImageDrawable extends Drawable {
private static FavoriteImageDrawable getOrCreate(Context a, int color, boolean withShadow, boolean synced, FavouritePoint point) {
String pointName = "";
if (point != null && point.isPersonalPoint()) {
if (point != null && point.isSpecialPoint()) {
pointName = point.getName();
}
color = color | 0xff000000;

View file

@ -144,6 +144,11 @@ public class FavouritePointMenuController extends MenuController {
return R.string.shared_string_edit;
}
@Override
public boolean isFavButtonEnabled() {
return !fav.isSpecialPoint();
}
@NonNull
@Override
public String getTypeStr() {