commit
c44441c7db
26 changed files with 675 additions and 316 deletions
|
@ -11,6 +11,9 @@
|
||||||
Thx - Hardy
|
Thx - Hardy
|
||||||
|
|
||||||
-->
|
-->
|
||||||
|
<string name="distance_and_address">%1$s • %2$s</string>
|
||||||
|
<string name="street_city">%1$s, %2$s</string>
|
||||||
|
<string name="personal_category_name">Personal</string>
|
||||||
<string name="add_new_profile_q">Add new profile \'%1$s\'?</string>
|
<string name="add_new_profile_q">Add new profile \'%1$s\'?</string>
|
||||||
<string name="save_heading">Include heading</string>
|
<string name="save_heading">Include heading</string>
|
||||||
<string name="save_heading_descr">Save heading to each trackpoint while recording.</string>
|
<string name="save_heading_descr">Save heading to each trackpoint while recording.</string>
|
||||||
|
|
|
@ -3,12 +3,18 @@ package net.osmand.data;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
|
|
||||||
|
import net.osmand.GPXUtilities.WptPt;
|
||||||
|
|
||||||
public class FavouritePoint implements Serializable, LocationPoint {
|
public class FavouritePoint implements Serializable, LocationPoint {
|
||||||
private static final long serialVersionUID = 729654300829771466L;
|
private static final long serialVersionUID = 729654300829771466L;
|
||||||
private String name = "";
|
|
||||||
private String description;
|
protected static final String HIDDEN = "hidden";
|
||||||
private String category = "";
|
|
||||||
|
protected String name = "";
|
||||||
|
protected String description;
|
||||||
|
protected String category = "";
|
||||||
private String originObjectName = "";
|
private String originObjectName = "";
|
||||||
private double latitude;
|
private double latitude;
|
||||||
private double longitude;
|
private double longitude;
|
||||||
|
@ -44,7 +50,11 @@ public class FavouritePoint implements Serializable, LocationPoint {
|
||||||
}
|
}
|
||||||
|
|
||||||
public PointDescription getPointDescription() {
|
public PointDescription getPointDescription() {
|
||||||
return new PointDescription(PointDescription.POINT_TYPE_FAVORITE, name);
|
return new PointDescription(PointDescription.POINT_TYPE_FAVORITE, getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isPersonal() {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -171,4 +181,49 @@ public class FavouritePoint implements Serializable, LocationPoint {
|
||||||
result = prime * result + ((originObjectName == null) ? 0 : originObjectName.hashCode());
|
result = prime * result + ((originObjectName == null) ? 0 : originObjectName.hashCode());
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static FavouritePoint fromWpt(@NonNull Context ctx, @NonNull WptPt pt) {
|
||||||
|
String name = pt.name;
|
||||||
|
String categoryName = pt.category != null ? pt.category : "";
|
||||||
|
if (name == null) {
|
||||||
|
name = "";
|
||||||
|
}
|
||||||
|
FavouritePoint fp;
|
||||||
|
if (pt.getExtensionsToRead().containsKey(PersonalFavouritePoint.PERSONAL)) {
|
||||||
|
try {
|
||||||
|
fp = new PersonalFavouritePoint(ctx, name, pt.lat, pt.lon);
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
fp = new FavouritePoint(pt.lat, pt.lon, name, categoryName);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fp = new FavouritePoint(pt.lat, pt.lon, name, categoryName);
|
||||||
|
}
|
||||||
|
fp.setDescription(pt.desc);
|
||||||
|
if (pt.comment != null) {
|
||||||
|
fp.setOriginObjectName(pt.comment);
|
||||||
|
}
|
||||||
|
fp.setColor(pt.getColor(0));
|
||||||
|
fp.setVisible(!pt.getExtensionsToRead().containsKey(HIDDEN));
|
||||||
|
return fp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public WptPt toWpt() {
|
||||||
|
WptPt pt = new WptPt();
|
||||||
|
pt.lat = getLatitude();
|
||||||
|
pt.lon = getLongitude();
|
||||||
|
if (!isVisible()) {
|
||||||
|
pt.getExtensionsToWrite().put(HIDDEN, "true");
|
||||||
|
}
|
||||||
|
if (getColor() != 0) {
|
||||||
|
pt.setColor(getColor());
|
||||||
|
}
|
||||||
|
pt.name = getName();
|
||||||
|
pt.desc = getDescription();
|
||||||
|
if (getCategory().length() > 0)
|
||||||
|
pt.category = getCategory();
|
||||||
|
if (getOriginObjectName().length() > 0) {
|
||||||
|
pt.comment = getOriginObjectName();
|
||||||
|
}
|
||||||
|
return pt;
|
||||||
|
}
|
||||||
}
|
}
|
115
OsmAnd/src/net/osmand/data/PersonalFavouritePoint.java
Normal file
115
OsmAnd/src/net/osmand/data/PersonalFavouritePoint.java
Normal file
|
@ -0,0 +1,115 @@
|
||||||
|
package net.osmand.data;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.support.annotation.DrawableRes;
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
|
import android.support.annotation.StringRes;
|
||||||
|
|
||||||
|
import net.osmand.GPXUtilities.WptPt;
|
||||||
|
import net.osmand.plus.R;
|
||||||
|
|
||||||
|
public class PersonalFavouritePoint extends FavouritePoint {
|
||||||
|
|
||||||
|
private Context ctx;
|
||||||
|
|
||||||
|
private PointType type;
|
||||||
|
static final String PERSONAL = "personal";
|
||||||
|
|
||||||
|
public enum PointType {
|
||||||
|
HOME("home", R.string.home_button, 1, R.drawable.ic_action_home_dark),
|
||||||
|
WORK("work", R.string.work_button, 2, R.drawable.ic_action_work),
|
||||||
|
PARKING("parking", R.string.map_widget_parking, 3, R.drawable.ic_action_parking_dark);
|
||||||
|
|
||||||
|
private String typeName;
|
||||||
|
@StringRes
|
||||||
|
private int resId;
|
||||||
|
private int order;
|
||||||
|
@DrawableRes
|
||||||
|
private int iconId;
|
||||||
|
|
||||||
|
PointType(@NonNull String typeName, @StringRes int resId, int order, @DrawableRes int iconId) {
|
||||||
|
this.typeName = typeName;
|
||||||
|
this.resId = resId;
|
||||||
|
this.order = order;
|
||||||
|
this.iconId = iconId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return typeName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getOrder() {
|
||||||
|
return order;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static PointType valueOfTypeName(@NonNull String typeName) {
|
||||||
|
for (PointType pt : values()) {
|
||||||
|
if (pt.typeName.equals(typeName)) {
|
||||||
|
return pt;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw new IllegalArgumentException("Illegal PointType typeName");
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getIconId() {
|
||||||
|
return iconId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHumanString(@NonNull Context ctx) {
|
||||||
|
return ctx.getString(resId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public PersonalFavouritePoint(@NonNull Context ctx, @NonNull PointType type, double latitude, double longitude) {
|
||||||
|
super(latitude, longitude, type.typeName, PERSONAL);
|
||||||
|
this.ctx = ctx;
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
PersonalFavouritePoint(@NonNull Context ctx, @NonNull String typeName, double latitude, double longitude) throws IllegalArgumentException {
|
||||||
|
this(ctx, PointType.valueOfTypeName(typeName), latitude, longitude);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PointDescription getPointDescription() {
|
||||||
|
return new PointDescription(PointDescription.POINT_TYPE_LOCATION, getDescription());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isPersonal() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PointType getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return type.getHumanString(ctx);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setName(String name) {
|
||||||
|
throw new IllegalArgumentException("Personal name is readonly");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getCategory() {
|
||||||
|
return ctx.getString(R.string.personal_category_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setCategory(String category) {
|
||||||
|
throw new IllegalArgumentException("Personal category is readonly");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public WptPt toWpt() {
|
||||||
|
WptPt pt = super.toWpt();
|
||||||
|
pt.getExtensionsToWrite().put(PERSONAL, "true");
|
||||||
|
pt.name = type.typeName;
|
||||||
|
pt.desc = getDescription();
|
||||||
|
return pt;
|
||||||
|
}
|
||||||
|
}
|
|
@ -196,6 +196,10 @@ public class AppInitializer implements IProgress {
|
||||||
app.getSettings().migratePreferences();
|
app.getSettings().migratePreferences();
|
||||||
startPrefs.edit().putInt(VERSION_INSTALLED_NUMBER, VERSION_3_5).commit();
|
startPrefs.edit().putInt(VERSION_INSTALLED_NUMBER, VERSION_3_5).commit();
|
||||||
}
|
}
|
||||||
|
if (prevAppVersion < VERSION_3_5 || Version.getAppVersion(app).equals("3.5.3")) {
|
||||||
|
app.getSettings().migrateHomeWorkParkingToFavorites();
|
||||||
|
startPrefs.edit().putInt(VERSION_INSTALLED_NUMBER, VERSION_3_5).commit();
|
||||||
|
}
|
||||||
startPrefs.edit().putString(VERSION_INSTALLED, Version.getFullVersion(app)).commit();
|
startPrefs.edit().putString(VERSION_INSTALLED, Version.getFullVersion(app)).commit();
|
||||||
appVersionChanged = true;
|
appVersionChanged = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,14 +3,17 @@ package net.osmand.plus;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
|
import android.support.annotation.StringRes;
|
||||||
import android.support.v7.app.AlertDialog;
|
import android.support.v7.app.AlertDialog;
|
||||||
|
|
||||||
import net.osmand.GPXUtilities;
|
import net.osmand.GPXUtilities;
|
||||||
|
import net.osmand.GPXUtilities.GPXFile;
|
||||||
|
import net.osmand.GPXUtilities.WptPt;
|
||||||
import net.osmand.PlatformUtil;
|
import net.osmand.PlatformUtil;
|
||||||
import net.osmand.data.FavouritePoint;
|
import net.osmand.data.FavouritePoint;
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
import net.osmand.GPXUtilities.GPXFile;
|
import net.osmand.data.PersonalFavouritePoint;
|
||||||
import net.osmand.GPXUtilities.WptPt;
|
import net.osmand.plus.GeocodingLookupService.AddressLookupRequest;
|
||||||
import net.osmand.plus.MapMarkersHelper.MapMarkersGroup;
|
import net.osmand.plus.MapMarkersHelper.MapMarkersGroup;
|
||||||
import net.osmand.plus.api.SQLiteAPI.SQLiteConnection;
|
import net.osmand.plus.api.SQLiteAPI.SQLiteConnection;
|
||||||
import net.osmand.plus.api.SQLiteAPI.SQLiteCursor;
|
import net.osmand.plus.api.SQLiteAPI.SQLiteCursor;
|
||||||
|
@ -30,11 +33,17 @@ import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
|
import static net.osmand.data.PersonalFavouritePoint.PointType.HOME;
|
||||||
|
import static net.osmand.data.PersonalFavouritePoint.PointType.PARKING;
|
||||||
|
import static net.osmand.data.PersonalFavouritePoint.PointType.WORK;
|
||||||
|
|
||||||
public class FavouritesDbHelper {
|
public class FavouritesDbHelper {
|
||||||
|
|
||||||
public interface FavoritesListener {
|
public interface FavoritesListener {
|
||||||
void onFavoritesLoaded();
|
void onFavoritesLoaded();
|
||||||
|
void onFavoriteAddressResolved(@NonNull FavouritePoint favouritePoint);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final org.apache.commons.logging.Log log = PlatformUtil.getLog(FavouritesDbHelper.class);
|
private static final org.apache.commons.logging.Log log = PlatformUtil.getLog(FavouritesDbHelper.class);
|
||||||
|
@ -44,16 +53,18 @@ public class FavouritesDbHelper {
|
||||||
public static final int BACKUP_CNT = 20; //$NON-NLS-1$
|
public static final int BACKUP_CNT = 20; //$NON-NLS-1$
|
||||||
public static final String FILE_TO_BACKUP = "favourites_bak.gpx"; //$NON-NLS-1$
|
public static final String FILE_TO_BACKUP = "favourites_bak.gpx"; //$NON-NLS-1$
|
||||||
|
|
||||||
private List<FavouritePoint> cachedFavoritePoints = new ArrayList<FavouritePoint>();
|
private List<FavouritePoint> cachedFavoritePoints = new ArrayList<>();
|
||||||
private List<FavoriteGroup> favoriteGroups = new ArrayList<FavouritesDbHelper.FavoriteGroup>();
|
private List<FavouritePoint> cachedPersonalFavoritePoints = new ArrayList<>();
|
||||||
private Map<String, FavoriteGroup> flatGroups = new LinkedHashMap<String, FavouritesDbHelper.FavoriteGroup>();
|
private List<FavoriteGroup> favoriteGroups = new ArrayList<>();
|
||||||
|
private Map<String, FavoriteGroup> flatGroups = new LinkedHashMap<>();
|
||||||
private final OsmandApplication context;
|
private final OsmandApplication context;
|
||||||
protected static final String HIDDEN = "hidden";
|
|
||||||
private static final String DELIMETER = "__";
|
private static final String DELIMETER = "__";
|
||||||
|
|
||||||
private Set<FavoritesListener> listeners = new HashSet<>();
|
private Set<FavoritesListener> listeners = new HashSet<>();
|
||||||
private boolean favoritesLoaded;
|
private boolean favoritesLoaded;
|
||||||
|
|
||||||
|
private Map<FavouritePoint, AddressLookupRequest> addressRequestMap = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
public FavouritesDbHelper(OsmandApplication context) {
|
public FavouritesDbHelper(OsmandApplication context) {
|
||||||
this.context = context;
|
this.context = context;
|
||||||
}
|
}
|
||||||
|
@ -62,6 +73,7 @@ public class FavouritesDbHelper {
|
||||||
public String name;
|
public String name;
|
||||||
public boolean visible = true;
|
public boolean visible = true;
|
||||||
public int color;
|
public int color;
|
||||||
|
public boolean personal = false;
|
||||||
public List<FavouritePoint> points = new ArrayList<FavouritePoint>();
|
public List<FavouritePoint> points = new ArrayList<FavouritePoint>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,6 +116,31 @@ public class FavouritesDbHelper {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public FavouritePoint getWorkPoint() {
|
||||||
|
return getPersonalPoint(WORK);
|
||||||
|
}
|
||||||
|
|
||||||
|
public FavouritePoint getHomePoint() {
|
||||||
|
return getPersonalPoint(HOME);
|
||||||
|
}
|
||||||
|
|
||||||
|
public FavouritePoint getParkingPoint() {
|
||||||
|
return getPersonalPoint(PARKING);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void deleteParkingPoint() {
|
||||||
|
deleteFavourite(getParkingPoint());
|
||||||
|
}
|
||||||
|
|
||||||
|
private FavouritePoint getPersonalPoint(PersonalFavouritePoint.PointType pointType) {
|
||||||
|
for (FavouritePoint fp : cachedPersonalFavoritePoints) {
|
||||||
|
if (((PersonalFavouritePoint) fp).getType() == pointType) {
|
||||||
|
return fp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isFavoritesLoaded() {
|
public boolean isFavoritesLoaded() {
|
||||||
return favoritesLoaded;
|
return favoritesLoaded;
|
||||||
}
|
}
|
||||||
|
@ -192,6 +229,9 @@ public class FavouritesDbHelper {
|
||||||
runSyncWithMarkers(group);
|
runSyncWithMarkers(group);
|
||||||
}
|
}
|
||||||
cachedFavoritePoints.remove(p);
|
cachedFavoritePoints.remove(p);
|
||||||
|
if (p.isPersonal()) {
|
||||||
|
cachedPersonalFavoritePoints.remove(p);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (saveImmediately) {
|
if (saveImmediately) {
|
||||||
saveCurrentPointsIntoFile();
|
saveCurrentPointsIntoFile();
|
||||||
|
@ -199,6 +239,45 @@ public class FavouritesDbHelper {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setHomePoint(@NonNull LatLon latLon, @Nullable String description) {
|
||||||
|
FavouritePoint homePoint = getHomePoint();
|
||||||
|
if (homePoint != null) {
|
||||||
|
editFavourite(homePoint, latLon.getLatitude(), latLon.getLongitude(), description);
|
||||||
|
} else {
|
||||||
|
homePoint = new PersonalFavouritePoint(context, HOME, latLon.getLatitude(), latLon.getLongitude());
|
||||||
|
homePoint.setDescription(description);
|
||||||
|
addFavourite(homePoint);
|
||||||
|
}
|
||||||
|
if (description == null) {
|
||||||
|
lookupAddress(homePoint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setWorkPoint(@NonNull LatLon latLon, @Nullable String description) {
|
||||||
|
FavouritePoint workPoint = getWorkPoint();
|
||||||
|
if (workPoint != null) {
|
||||||
|
editFavourite(workPoint, latLon.getLatitude(), latLon.getLongitude(), description);
|
||||||
|
} else {
|
||||||
|
workPoint = new PersonalFavouritePoint(context, WORK, latLon.getLatitude(), latLon.getLongitude());
|
||||||
|
workPoint.setDescription(description);
|
||||||
|
addFavourite(workPoint);
|
||||||
|
}
|
||||||
|
if (description == null) {
|
||||||
|
lookupAddress(workPoint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setParkingPoint(@NonNull LatLon latLon) {
|
||||||
|
FavouritePoint parkingPoint = getParkingPoint();
|
||||||
|
if (parkingPoint != null) {
|
||||||
|
editFavourite(parkingPoint, latLon.getLatitude(), latLon.getLongitude(), null);
|
||||||
|
} else {
|
||||||
|
parkingPoint = new PersonalFavouritePoint(context, PARKING, latLon.getLatitude(), latLon.getLongitude());
|
||||||
|
addFavourite(parkingPoint);
|
||||||
|
}
|
||||||
|
lookupAddress(parkingPoint);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean addFavourite(FavouritePoint p) {
|
public boolean addFavourite(FavouritePoint p) {
|
||||||
return addFavourite(p, true);
|
return addFavourite(p, true);
|
||||||
}
|
}
|
||||||
|
@ -216,6 +295,9 @@ public class FavouritesDbHelper {
|
||||||
group.points.add(p);
|
group.points.add(p);
|
||||||
cachedFavoritePoints.add(p);
|
cachedFavoritePoints.add(p);
|
||||||
}
|
}
|
||||||
|
if (p.isPersonal()) {
|
||||||
|
cachedPersonalFavoritePoints.add(p);
|
||||||
|
}
|
||||||
if (saveImmediately) {
|
if (saveImmediately) {
|
||||||
sortAll();
|
sortAll();
|
||||||
saveCurrentPointsIntoFile();
|
saveCurrentPointsIntoFile();
|
||||||
|
@ -225,6 +307,59 @@ public class FavouritesDbHelper {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void lookupAddressAllPersonalPoints() {
|
||||||
|
if (!context.isApplicationInitializing()) {
|
||||||
|
FavouritePoint workPoint = getWorkPoint();
|
||||||
|
if (workPoint != null) {
|
||||||
|
lookupAddress(workPoint);
|
||||||
|
}
|
||||||
|
FavouritePoint homePoint = getHomePoint();
|
||||||
|
if (homePoint != null) {
|
||||||
|
lookupAddress(homePoint);
|
||||||
|
}
|
||||||
|
FavouritePoint parkingPoint = getParkingPoint();
|
||||||
|
if (parkingPoint != null) {
|
||||||
|
lookupAddress(parkingPoint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void lookupAddress(@NonNull final FavouritePoint p) {
|
||||||
|
AddressLookupRequest request = addressRequestMap.get(p);
|
||||||
|
double latitude = p.getLatitude();
|
||||||
|
double longitude = p.getLongitude();
|
||||||
|
if (request == null || !request.getLatLon().equals(new LatLon(latitude, longitude))) {
|
||||||
|
cancelAddressRequest(p);
|
||||||
|
request = new AddressLookupRequest(new LatLon(latitude, longitude),
|
||||||
|
new GeocodingLookupService.OnAddressLookupResult() {
|
||||||
|
@Override
|
||||||
|
public void geocodingDone(String address) {
|
||||||
|
addressRequestMap.remove(p);
|
||||||
|
editFavouriteDescription(p, address);
|
||||||
|
context.runInUIThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
for (FavoritesListener listener : listeners) {
|
||||||
|
listener.onFavoriteAddressResolved(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
}, null);
|
||||||
|
addressRequestMap.put(p, request);
|
||||||
|
context.getGeocodingLookupService().lookupAddress(request);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void cancelAddressRequest(@NonNull FavouritePoint p) {
|
||||||
|
AddressLookupRequest request = addressRequestMap.get(p);
|
||||||
|
if (request != null) {
|
||||||
|
context.getGeocodingLookupService().cancel(request);
|
||||||
|
addressRequestMap.remove(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static AlertDialog.Builder checkDuplicates(FavouritePoint p, FavouritesDbHelper fdb, Context uiContext) {
|
public static AlertDialog.Builder checkDuplicates(FavouritePoint p, FavouritesDbHelper fdb, Context uiContext) {
|
||||||
boolean emoticons = false;
|
boolean emoticons = false;
|
||||||
String index = "";
|
String index = "";
|
||||||
|
@ -319,7 +454,15 @@ public class FavouritesDbHelper {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean editFavouriteDescription(FavouritePoint p, String description) {
|
||||||
|
p.setDescription(description);
|
||||||
|
saveCurrentPointsIntoFile();
|
||||||
|
runSyncWithMarkers(getOrCreateGroup(p, 0));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean editFavourite(FavouritePoint p, double lat, double lon) {
|
public boolean editFavourite(FavouritePoint p, double lat, double lon) {
|
||||||
|
cancelAddressRequest(p);
|
||||||
p.setLatitude(lat);
|
p.setLatitude(lat);
|
||||||
p.setLongitude(lon);
|
p.setLongitude(lon);
|
||||||
saveCurrentPointsIntoFile();
|
saveCurrentPointsIntoFile();
|
||||||
|
@ -327,6 +470,16 @@ public class FavouritesDbHelper {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean editFavourite(FavouritePoint p, double lat, double lon, String description) {
|
||||||
|
cancelAddressRequest(p);
|
||||||
|
p.setLatitude(lat);
|
||||||
|
p.setLongitude(lon);
|
||||||
|
p.setDescription(description);
|
||||||
|
saveCurrentPointsIntoFile();
|
||||||
|
runSyncWithMarkers(getOrCreateGroup(p, 0));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public void saveCurrentPointsIntoFile() {
|
public void saveCurrentPointsIntoFile() {
|
||||||
try {
|
try {
|
||||||
Map<String, FavouritePoint> deletedInMemory = new LinkedHashMap<String, FavouritePoint>();
|
Map<String, FavouritePoint> deletedInMemory = new LinkedHashMap<String, FavouritePoint>();
|
||||||
|
@ -437,23 +590,7 @@ public class FavouritesDbHelper {
|
||||||
private GPXFile asGpxFile(List<FavouritePoint> favoritePoints) {
|
private GPXFile asGpxFile(List<FavouritePoint> favoritePoints) {
|
||||||
GPXFile gpx = new GPXFile(Version.getFullVersion(context));
|
GPXFile gpx = new GPXFile(Version.getFullVersion(context));
|
||||||
for (FavouritePoint p : favoritePoints) {
|
for (FavouritePoint p : favoritePoints) {
|
||||||
WptPt pt = new WptPt();
|
context.getSelectedGpxHelper().addPoint(p.toWpt(), gpx);
|
||||||
pt.lat = p.getLatitude();
|
|
||||||
pt.lon = p.getLongitude();
|
|
||||||
if (!p.isVisible()) {
|
|
||||||
pt.getExtensionsToWrite().put(HIDDEN, "true");
|
|
||||||
}
|
|
||||||
if (p.getColor() != 0) {
|
|
||||||
pt.setColor(p.getColor());
|
|
||||||
}
|
|
||||||
pt.name = p.getName();
|
|
||||||
pt.desc = p.getDescription();
|
|
||||||
if (p.getCategory().length() > 0)
|
|
||||||
pt.category = p.getCategory();
|
|
||||||
if (p.getOriginObjectName().length() > 0) {
|
|
||||||
pt.comment = p.getOriginObjectName();
|
|
||||||
}
|
|
||||||
context.getSelectedGpxHelper().addPoint(pt, gpx);
|
|
||||||
}
|
}
|
||||||
return gpx;
|
return gpx;
|
||||||
}
|
}
|
||||||
|
@ -490,6 +627,26 @@ public class FavouritesDbHelper {
|
||||||
return fp;
|
return fp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<FavouritePoint> getNonPersonalVisibleFavouritePoints() {
|
||||||
|
List<FavouritePoint> fp = new ArrayList<>();
|
||||||
|
for (FavouritePoint p : getNonPersonalFavouritePoints()) {
|
||||||
|
if (p.isVisible()) {
|
||||||
|
fp.add(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return fp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<FavouritePoint> getNonPersonalFavouritePoints() {
|
||||||
|
List<FavouritePoint> fp = new ArrayList<>();
|
||||||
|
for (FavouritePoint p : cachedFavoritePoints) {
|
||||||
|
if (!p.isPersonal()) {
|
||||||
|
fp.add(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return fp;
|
||||||
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public FavouritePoint getVisibleFavByLatLon(@NonNull LatLon latLon) {
|
public FavouritePoint getVisibleFavByLatLon(@NonNull LatLon latLon) {
|
||||||
for (FavouritePoint fav : cachedFavoritePoints) {
|
for (FavouritePoint fav : cachedFavoritePoints) {
|
||||||
|
@ -545,11 +702,16 @@ public class FavouritesDbHelper {
|
||||||
|
|
||||||
|
|
||||||
public void recalculateCachedFavPoints() {
|
public void recalculateCachedFavPoints() {
|
||||||
ArrayList<FavouritePoint> temp = new ArrayList<FavouritePoint>();
|
List<FavouritePoint> allPoints = new ArrayList<>();
|
||||||
|
List<FavouritePoint> personalPoints = new ArrayList<>();
|
||||||
for (FavoriteGroup f : favoriteGroups) {
|
for (FavoriteGroup f : favoriteGroups) {
|
||||||
temp.addAll(f.points);
|
if (f.personal) {
|
||||||
|
personalPoints.addAll(f.points);
|
||||||
|
}
|
||||||
|
allPoints.addAll(f.points);
|
||||||
}
|
}
|
||||||
cachedFavoritePoints = temp;
|
cachedFavoritePoints = allPoints;
|
||||||
|
cachedPersonalFavoritePoints = personalPoints;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void sortAll() {
|
public void sortAll() {
|
||||||
|
@ -559,7 +721,7 @@ public class FavouritesDbHelper {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compare(FavoriteGroup lhs, FavoriteGroup rhs) {
|
public int compare(FavoriteGroup lhs, FavoriteGroup rhs) {
|
||||||
return collator.compare(lhs.name, rhs.name);
|
return lhs.personal ? -1 : rhs.personal ? 1 : collator.compare(lhs.name, rhs.name);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Comparator<FavouritePoint> favoritesComparator = getComparator();
|
Comparator<FavouritePoint> favoritesComparator = getComparator();
|
||||||
|
@ -569,15 +731,27 @@ public class FavouritesDbHelper {
|
||||||
if (cachedFavoritePoints != null) {
|
if (cachedFavoritePoints != null) {
|
||||||
Collections.sort(cachedFavoritePoints, favoritesComparator);
|
Collections.sort(cachedFavoritePoints, favoritesComparator);
|
||||||
}
|
}
|
||||||
|
if (cachedPersonalFavoritePoints != null) {
|
||||||
|
Collections.sort(cachedPersonalFavoritePoints, favoritesComparator);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Comparator<FavouritePoint> getComparator() {
|
public static Comparator<FavouritePoint> getComparator() {
|
||||||
final Collator collator = Collator.getInstance();
|
final Collator collator = Collator.getInstance();
|
||||||
collator.setStrength(Collator.SECONDARY);
|
collator.setStrength(Collator.SECONDARY);
|
||||||
Comparator<FavouritePoint> favoritesComparator = new Comparator<FavouritePoint>() {
|
return new Comparator<FavouritePoint>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compare(FavouritePoint o1, FavouritePoint o2) {
|
public int compare(FavouritePoint o1, FavouritePoint o2) {
|
||||||
|
if (o1.isPersonal() && o2.isPersonal()) {
|
||||||
|
int x = ((PersonalFavouritePoint) o1).getType().getOrder();
|
||||||
|
int y = ((PersonalFavouritePoint) o2).getType().getOrder();
|
||||||
|
return Algorithms.compare(x, y);
|
||||||
|
} else if (o1.isPersonal()) {
|
||||||
|
return -1;
|
||||||
|
} else if (o2.isPersonal()) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
String s1 = o1.getName();
|
String s1 = o1.getName();
|
||||||
String s2 = o2.getName();
|
String s2 = o2.getName();
|
||||||
int i1 = Algorithms.extractIntegerNumber(s1);
|
int i1 = Algorithms.extractIntegerNumber(s1);
|
||||||
|
@ -602,10 +776,8 @@ public class FavouritesDbHelper {
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
return favoritesComparator;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private boolean loadGPXFile(File file, Map<String, FavouritePoint> points) {
|
private boolean loadGPXFile(File file, Map<String, FavouritePoint> points) {
|
||||||
if (!file.exists()) {
|
if (!file.exists()) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -615,20 +787,10 @@ public class FavouritesDbHelper {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for (WptPt p : res.getPoints()) {
|
for (WptPt p : res.getPoints()) {
|
||||||
int c;
|
FavouritePoint fp = FavouritePoint.fromWpt(context, p);
|
||||||
String name = p.name;
|
if (fp != null) {
|
||||||
String categoryName = p.category != null ? p.category : "";
|
points.put(getKey(fp), fp);
|
||||||
if (name == null) {
|
|
||||||
name = "";
|
|
||||||
}
|
}
|
||||||
FavouritePoint fp = new FavouritePoint(p.lat, p.lon, name, categoryName);
|
|
||||||
fp.setDescription(p.desc);
|
|
||||||
if (p.comment != null) {
|
|
||||||
fp.setOriginObjectName(p.comment);
|
|
||||||
}
|
|
||||||
fp.setColor(p.getColor(0));
|
|
||||||
fp.setVisible(!p.getExtensionsToRead().containsKey(HIDDEN));
|
|
||||||
points.put(getKey(fp), fp);
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -690,6 +852,7 @@ public class FavouritesDbHelper {
|
||||||
group.name = p.getCategory();
|
group.name = p.getCategory();
|
||||||
group.visible = p.isVisible();
|
group.visible = p.isVisible();
|
||||||
group.color = p.getColor();
|
group.color = p.getColor();
|
||||||
|
group.personal = p.isPersonal();
|
||||||
flatGroups.put(group.name, group);
|
flatGroups.put(group.name, group);
|
||||||
favoriteGroups.add(group);
|
favoriteGroups.add(group);
|
||||||
if (group.color == 0) {
|
if (group.color == 0) {
|
||||||
|
|
|
@ -259,6 +259,29 @@ public class OsmandSettings {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void migrateHomeWorkParkingToFavorites() {
|
||||||
|
FavouritesDbHelper favorites = ctx.getFavorites();
|
||||||
|
|
||||||
|
LatLon homePoint = null;
|
||||||
|
float lat = settingsAPI.getFloat(globalPreferences, "home_point_lat", 0);
|
||||||
|
float lon = settingsAPI.getFloat(globalPreferences, "home_point_lon", 0);
|
||||||
|
if (lat != 0 || lon != 0) {
|
||||||
|
homePoint = new LatLon(lat, lon);
|
||||||
|
}
|
||||||
|
LatLon workPoint = null;
|
||||||
|
lat = settingsAPI.getFloat(globalPreferences, "work_point_lat", 0);
|
||||||
|
lon = settingsAPI.getFloat(globalPreferences, "work_point_lon", 0);
|
||||||
|
if (lat != 0 || lon != 0) {
|
||||||
|
workPoint = new LatLon(lat, lon);
|
||||||
|
}
|
||||||
|
if (homePoint != null) {
|
||||||
|
favorites.setHomePoint(homePoint, null);
|
||||||
|
}
|
||||||
|
if (workPoint != null) {
|
||||||
|
favorites.setWorkPoint(workPoint, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public Object getProfilePreferences(ApplicationMode mode) {
|
public Object getProfilePreferences(ApplicationMode mode) {
|
||||||
return settingsAPI.getPreferenceObject(getSharedPreferencesName(mode));
|
return settingsAPI.getPreferenceObject(getSharedPreferencesName(mode));
|
||||||
}
|
}
|
||||||
|
@ -2393,13 +2416,6 @@ public class OsmandSettings {
|
||||||
public final static String MY_LOC_POINT_LON = "my_loc_point_lon";
|
public final static String MY_LOC_POINT_LON = "my_loc_point_lon";
|
||||||
public final static String MY_LOC_POINT_DESCRIPTION = "my_loc_point_description";
|
public final static String MY_LOC_POINT_DESCRIPTION = "my_loc_point_description";
|
||||||
|
|
||||||
public final static String HOME_POINT_LAT = "home_point_lat";
|
|
||||||
public final static String HOME_POINT_LON = "home_point_lon";
|
|
||||||
public final static String HOME_POINT_DESCRIPTION = "home_point_description";
|
|
||||||
public final static String WORK_POINT_LAT = "work_point_lat";
|
|
||||||
public final static String WORK_POINT_LON = "work_point_lon";
|
|
||||||
public final static String WORK_POINT_DESCRIPTION = "work_point_description";
|
|
||||||
|
|
||||||
private static final String IMPASSABLE_ROAD_POINTS = "impassable_road_points";
|
private static final String IMPASSABLE_ROAD_POINTS = "impassable_road_points";
|
||||||
private static final String IMPASSABLE_ROADS_DESCRIPTIONS = "impassable_roads_descriptions";
|
private static final String IMPASSABLE_ROADS_DESCRIPTIONS = "impassable_roads_descriptions";
|
||||||
private ImpassableRoadsStorage mImpassableRoadsStorage = new ImpassableRoadsStorage();
|
private ImpassableRoadsStorage mImpassableRoadsStorage = new ImpassableRoadsStorage();
|
||||||
|
@ -2514,44 +2530,6 @@ public class OsmandSettings {
|
||||||
settingsAPI.getString(globalPreferences, POINT_NAVIGATE_DESCRIPTION_BACKUP, ""), getPointToNavigate());
|
settingsAPI.getString(globalPreferences, POINT_NAVIGATE_DESCRIPTION_BACKUP, ""), getPointToNavigate());
|
||||||
}
|
}
|
||||||
|
|
||||||
public LatLon getHomePoint() {
|
|
||||||
float lat = settingsAPI.getFloat(globalPreferences, HOME_POINT_LAT, 0);
|
|
||||||
float lon = settingsAPI.getFloat(globalPreferences, HOME_POINT_LON, 0);
|
|
||||||
if (lat == 0 && lon == 0) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return new LatLon(lat, lon);
|
|
||||||
}
|
|
||||||
|
|
||||||
public PointDescription getHomePointDescription() {
|
|
||||||
return PointDescription.deserializeFromString(
|
|
||||||
settingsAPI.getString(globalPreferences, HOME_POINT_DESCRIPTION, ""), getHomePoint());
|
|
||||||
}
|
|
||||||
|
|
||||||
public LatLon getWorkPoint() {
|
|
||||||
float lat = settingsAPI.getFloat(globalPreferences, WORK_POINT_LAT, 0);
|
|
||||||
float lon = settingsAPI.getFloat(globalPreferences, WORK_POINT_LON, 0);
|
|
||||||
if (lat == 0 && lon == 0) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return new LatLon(lat, lon);
|
|
||||||
}
|
|
||||||
|
|
||||||
public PointDescription getWorkPointDescription() {
|
|
||||||
return PointDescription.deserializeFromString(
|
|
||||||
settingsAPI.getString(globalPreferences, WORK_POINT_DESCRIPTION, ""), getWorkPoint());
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHomePoint(double latitude, double longitude, PointDescription p) {
|
|
||||||
settingsAPI.edit(globalPreferences).putFloat(HOME_POINT_LAT, (float) latitude).putFloat(HOME_POINT_LON, (float) longitude).commit();
|
|
||||||
settingsAPI.edit(globalPreferences).putString(HOME_POINT_DESCRIPTION, PointDescription.serializeToString(p)).commit();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setWorkPoint(double latitude, double longitude, PointDescription p) {
|
|
||||||
settingsAPI.edit(globalPreferences).putFloat(WORK_POINT_LAT, (float) latitude).putFloat(WORK_POINT_LON, (float) longitude).commit();
|
|
||||||
settingsAPI.edit(globalPreferences).putString(WORK_POINT_DESCRIPTION, PointDescription.serializeToString(p)).commit();
|
|
||||||
}
|
|
||||||
|
|
||||||
public LatLon getMyLocationToStart() {
|
public LatLon getMyLocationToStart() {
|
||||||
float lat = settingsAPI.getFloat(globalPreferences, MY_LOC_POINT_LAT, 0);
|
float lat = settingsAPI.getFloat(globalPreferences, MY_LOC_POINT_LAT, 0);
|
||||||
float lon = settingsAPI.getFloat(globalPreferences, MY_LOC_POINT_LON, 0);
|
float lon = settingsAPI.getFloat(globalPreferences, MY_LOC_POINT_LON, 0);
|
||||||
|
|
|
@ -31,15 +31,12 @@ public class TargetPointsHelper {
|
||||||
private List<StateChangedListener<Void>> listeners = new ArrayList<>();
|
private List<StateChangedListener<Void>> listeners = new ArrayList<>();
|
||||||
private List<TargetPointChangedListener> pointListeners = new ArrayList<>();
|
private List<TargetPointChangedListener> pointListeners = new ArrayList<>();
|
||||||
private OsmandApplication ctx;
|
private OsmandApplication ctx;
|
||||||
private TargetPoint homePoint = null;
|
|
||||||
private TargetPoint workPoint = null;
|
|
||||||
|
|
||||||
private AddressLookupRequest startPointRequest;
|
private AddressLookupRequest startPointRequest;
|
||||||
private AddressLookupRequest targetPointRequest;
|
private AddressLookupRequest targetPointRequest;
|
||||||
private AddressLookupRequest homePointRequest;
|
|
||||||
private AddressLookupRequest workPointRequest;
|
|
||||||
private AddressLookupRequest myLocationPointRequest;
|
private AddressLookupRequest myLocationPointRequest;
|
||||||
|
|
||||||
|
|
||||||
public interface TargetPointChangedListener {
|
public interface TargetPointChangedListener {
|
||||||
void onTargetPointChanged(TargetPoint targetPoint);
|
void onTargetPointChanged(TargetPoint targetPoint);
|
||||||
}
|
}
|
||||||
|
@ -158,8 +155,6 @@ public class TargetPointsHelper {
|
||||||
for (TargetPoint targetPoint : intermediatePoints) {
|
for (TargetPoint targetPoint : intermediatePoints) {
|
||||||
lookupAddressForIntermediatePoint(targetPoint);
|
lookupAddressForIntermediatePoint(targetPoint);
|
||||||
}
|
}
|
||||||
lookupAddressForHomePoint();
|
|
||||||
lookupAddressForWorkPoint();
|
|
||||||
lookupAddressForMyLocationPoint();
|
lookupAddressForMyLocationPoint();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,25 +172,11 @@ public class TargetPointsHelper {
|
||||||
PointDescription.deserializeFromString(desc.get(i), ips.get(i)), i);
|
PointDescription.deserializeFromString(desc.get(i), ips.get(i)), i);
|
||||||
intermediatePoints.add(targetPoint);
|
intermediatePoints.add(targetPoint);
|
||||||
}
|
}
|
||||||
homePoint = settings.getHomePoint() != null ?
|
|
||||||
TargetPoint.create(settings.getHomePoint(), settings.getHomePointDescription()) : null;
|
|
||||||
workPoint = settings.getWorkPoint() != null ?
|
|
||||||
TargetPoint.create(settings.getWorkPoint(), settings.getWorkPointDescription()) : null;
|
|
||||||
|
|
||||||
if (!ctx.isApplicationInitializing()) {
|
if (!ctx.isApplicationInitializing()) {
|
||||||
lookupAddessAll();
|
lookupAddessAll();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void readHomeWorkFromSettings() {
|
|
||||||
homePoint = TargetPoint.create(settings.getHomePoint(), settings.getHomePointDescription());
|
|
||||||
workPoint = TargetPoint.create(settings.getWorkPoint(), settings.getWorkPointDescription());
|
|
||||||
if (!ctx.isApplicationInitializing()) {
|
|
||||||
lookupAddressForHomePoint();
|
|
||||||
lookupAddressForWorkPoint();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void readMyLocationPointFromSettings() {
|
private void readMyLocationPointFromSettings() {
|
||||||
myLocationToStart = TargetPoint.create(settings.getMyLocationToStart(), settings.getMyLocationToStartDescription());
|
myLocationToStart = TargetPoint.create(settings.getMyLocationToStart(), settings.getMyLocationToStartDescription());
|
||||||
if (!ctx.isApplicationInitializing()) {
|
if (!ctx.isApplicationInitializing()) {
|
||||||
|
@ -267,52 +248,10 @@ public class TargetPointsHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void lookupAddressForHomePoint() {
|
|
||||||
if (homePoint != null && homePoint.isSearchingAddress(ctx)
|
|
||||||
&& (homePointRequest == null || !homePointRequest.getLatLon().equals(homePoint.point))) {
|
|
||||||
cancelHomePointAddressRequest();
|
|
||||||
homePointRequest = new AddressLookupRequest(homePoint.point, new GeocodingLookupService.OnAddressLookupResult() {
|
|
||||||
@Override
|
|
||||||
public void geocodingDone(String address) {
|
|
||||||
homePointRequest = null;
|
|
||||||
if (homePoint != null) {
|
|
||||||
homePoint.pointDescription.setName(address);
|
|
||||||
settings.setHomePoint(homePoint.point.getLatitude(), homePoint.point.getLongitude(),
|
|
||||||
homePoint.pointDescription);
|
|
||||||
updateRouteAndRefresh(false);
|
|
||||||
updateTargetPoint(homePoint);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, null);
|
|
||||||
ctx.getGeocodingLookupService().lookupAddress(homePointRequest);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void lookupAddressForWorkPoint() {
|
|
||||||
if (workPoint != null && workPoint.isSearchingAddress(ctx)
|
|
||||||
&& (workPointRequest == null || !workPointRequest.getLatLon().equals(workPoint.point))) {
|
|
||||||
cancelWorkPointAddressRequest();
|
|
||||||
workPointRequest = new AddressLookupRequest(workPoint.point, new GeocodingLookupService.OnAddressLookupResult() {
|
|
||||||
@Override
|
|
||||||
public void geocodingDone(String address) {
|
|
||||||
workPointRequest = null;
|
|
||||||
if (workPoint != null) {
|
|
||||||
workPoint.pointDescription.setName(address);
|
|
||||||
settings.setWorkPoint(workPoint.point.getLatitude(), workPoint.point.getLongitude(),
|
|
||||||
workPoint.pointDescription);
|
|
||||||
updateRouteAndRefresh(false);
|
|
||||||
updateTargetPoint(workPoint);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, null);
|
|
||||||
ctx.getGeocodingLookupService().lookupAddress(workPointRequest);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void lookupAddressForMyLocationPoint() {
|
private void lookupAddressForMyLocationPoint() {
|
||||||
if (myLocationToStart != null && myLocationToStart.isSearchingAddress(ctx)
|
if (myLocationToStart != null && myLocationToStart.isSearchingAddress(ctx)
|
||||||
&& (myLocationPointRequest == null || !myLocationPointRequest.getLatLon().equals(myLocationToStart.point))) {
|
&& (myLocationPointRequest == null || !myLocationPointRequest.getLatLon().equals(myLocationToStart.point))) {
|
||||||
cancelWorkPointAddressRequest();
|
cancelMyLocationPointAddressRequest();
|
||||||
myLocationPointRequest = new AddressLookupRequest(myLocationToStart.point, new GeocodingLookupService.OnAddressLookupResult() {
|
myLocationPointRequest = new AddressLookupRequest(myLocationToStart.point, new GeocodingLookupService.OnAddressLookupResult() {
|
||||||
@Override
|
@Override
|
||||||
public void geocodingDone(String address) {
|
public void geocodingDone(String address) {
|
||||||
|
@ -350,46 +289,6 @@ public class TargetPointsHelper {
|
||||||
return myLocationToStart;
|
return myLocationToStart;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PointDescription getStartPointDescription(){
|
|
||||||
return settings.getStartPointDescription();
|
|
||||||
}
|
|
||||||
|
|
||||||
public TargetPoint getHomePoint() {
|
|
||||||
return homePoint;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TargetPoint getWorkPoint() {
|
|
||||||
return workPoint;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setHomePoint(LatLon latLon, PointDescription name) {
|
|
||||||
final PointDescription pointDescription;
|
|
||||||
if (name == null) {
|
|
||||||
pointDescription = new PointDescription(PointDescription.POINT_TYPE_LOCATION, "");
|
|
||||||
} else {
|
|
||||||
pointDescription = name;
|
|
||||||
}
|
|
||||||
if (pointDescription.isLocation() && Algorithms.isEmpty(pointDescription.getName())) {
|
|
||||||
pointDescription.setName(PointDescription.getSearchAddressStr(ctx));
|
|
||||||
}
|
|
||||||
settings.setHomePoint(latLon.getLatitude(), latLon.getLongitude(), pointDescription);
|
|
||||||
readHomeWorkFromSettings();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setWorkPoint(LatLon latLon, PointDescription name) {
|
|
||||||
final PointDescription pointDescription;
|
|
||||||
if (name == null) {
|
|
||||||
pointDescription = new PointDescription(PointDescription.POINT_TYPE_LOCATION, "");
|
|
||||||
} else {
|
|
||||||
pointDescription = name;
|
|
||||||
}
|
|
||||||
if (pointDescription.isLocation() && Algorithms.isEmpty(pointDescription.getName())) {
|
|
||||||
pointDescription.setName(PointDescription.getSearchAddressStr(ctx));
|
|
||||||
}
|
|
||||||
settings.setWorkPoint(latLon.getLatitude(), latLon.getLongitude(), pointDescription);
|
|
||||||
readHomeWorkFromSettings();
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<TargetPoint> getIntermediatePoints() {
|
public List<TargetPoint> getIntermediatePoints() {
|
||||||
return intermediatePoints;
|
return intermediatePoints;
|
||||||
}
|
}
|
||||||
|
@ -764,6 +663,13 @@ public class TargetPointsHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void cancelMyLocationPointAddressRequest() {
|
||||||
|
if (startPointRequest != null) {
|
||||||
|
ctx.getGeocodingLookupService().cancel(startPointRequest);
|
||||||
|
startPointRequest = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void cancelTargetPointAddressRequest() {
|
private void cancelTargetPointAddressRequest() {
|
||||||
if (targetPointRequest != null) {
|
if (targetPointRequest != null) {
|
||||||
ctx.getGeocodingLookupService().cancel(targetPointRequest);
|
ctx.getGeocodingLookupService().cancel(targetPointRequest);
|
||||||
|
@ -771,20 +677,6 @@ public class TargetPointsHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cancelHomePointAddressRequest() {
|
|
||||||
if (homePointRequest != null) {
|
|
||||||
ctx.getGeocodingLookupService().cancel(homePointRequest);
|
|
||||||
homePointRequest = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void cancelWorkPointAddressRequest() {
|
|
||||||
if (workPointRequest != null) {
|
|
||||||
ctx.getGeocodingLookupService().cancel(workPointRequest);
|
|
||||||
workPointRequest = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void cancelAllIntermediatePointsAddressRequests() {
|
private void cancelAllIntermediatePointsAddressRequests() {
|
||||||
List<LatLon> intermediatePointsLatLon = getIntermediatePointsLatLon();
|
List<LatLon> intermediatePointsLatLon = getIntermediatePointsLatLon();
|
||||||
for (LatLon latLon : intermediatePointsLatLon) {
|
for (LatLon latLon : intermediatePointsLatLon) {
|
||||||
|
|
|
@ -37,6 +37,7 @@ import android.widget.Toast;
|
||||||
import net.osmand.AndroidUtils;
|
import net.osmand.AndroidUtils;
|
||||||
import net.osmand.data.FavouritePoint;
|
import net.osmand.data.FavouritePoint;
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
|
import net.osmand.data.PersonalFavouritePoint;
|
||||||
import net.osmand.data.PointDescription;
|
import net.osmand.data.PointDescription;
|
||||||
import net.osmand.plus.FavouritesDbHelper;
|
import net.osmand.plus.FavouritesDbHelper;
|
||||||
import net.osmand.plus.FavouritesDbHelper.FavoriteGroup;
|
import net.osmand.plus.FavouritesDbHelper.FavoriteGroup;
|
||||||
|
@ -115,6 +116,10 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment implemen
|
||||||
public void onFavoritesLoaded() {
|
public void onFavoritesLoaded() {
|
||||||
favouritesAdapter.synchronizeGroups();
|
favouritesAdapter.synchronizeGroups();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFavoriteAddressResolved(@NonNull FavouritePoint favouritePoint) {
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
setAdapter(favouritesAdapter);
|
setAdapter(favouritesAdapter);
|
||||||
|
@ -738,7 +743,7 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment implemen
|
||||||
Filter myFilter;
|
Filter myFilter;
|
||||||
private Set<?> filter;
|
private Set<?> filter;
|
||||||
|
|
||||||
public void synchronizeGroups() {
|
void synchronizeGroups() {
|
||||||
favoriteGroups.clear();
|
favoriteGroups.clear();
|
||||||
groups.clear();
|
groups.clear();
|
||||||
List<FavoriteGroup> disablesGroups = new ArrayList<>();
|
List<FavoriteGroup> disablesGroups = new ArrayList<>();
|
||||||
|
@ -829,9 +834,11 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment implemen
|
||||||
int disabledColor = light ? R.color.text_color_secondary_light : R.color.text_color_secondary_dark;
|
int disabledColor = light ? R.color.text_color_secondary_light : R.color.text_color_secondary_dark;
|
||||||
row.findViewById(R.id.group_divider).setVisibility(groupPosition == 0 ? View.GONE : View.VISIBLE);
|
row.findViewById(R.id.group_divider).setVisibility(groupPosition == 0 ? View.GONE : View.VISIBLE);
|
||||||
int color = model.color == 0 || model.color == Color.BLACK ? getResources().getColor(R.color.color_favorite) : model.color;
|
int color = model.color == 0 || model.color == Color.BLACK ? getResources().getColor(R.color.color_favorite) : model.color;
|
||||||
setCategoryIcon(app, app.getUIUtilities().getPaintedIcon(
|
if (!model.personal) {
|
||||||
R.drawable.ic_action_fav_dark, visible ? (color | 0xff000000) : getResources().getColor(disabledColor)),
|
setCategoryIcon(app, app.getUIUtilities().getPaintedIcon(
|
||||||
groupPosition, isExpanded, row, light);
|
R.drawable.ic_action_fav_dark, visible ? (color | 0xff000000) : getResources().getColor(disabledColor)),
|
||||||
|
groupPosition, isExpanded, row, light);
|
||||||
|
}
|
||||||
adjustIndicator(app, groupPosition, isExpanded, row, light);
|
adjustIndicator(app, groupPosition, isExpanded, row, light);
|
||||||
TextView label = (TextView) row.findViewById(R.id.category_name);
|
TextView label = (TextView) row.findViewById(R.id.category_name);
|
||||||
label.setTextColor(getResources().getColor(visible ? enabledColor : disabledColor));
|
label.setTextColor(getResources().getColor(visible ? enabledColor : disabledColor));
|
||||||
|
@ -879,16 +886,18 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment implemen
|
||||||
}
|
}
|
||||||
final View ch = row.findViewById(R.id.options);
|
final View ch = row.findViewById(R.id.options);
|
||||||
if (!selectionMode) {
|
if (!selectionMode) {
|
||||||
((ImageView) ch).setImageDrawable(getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_overflow_menu_white));
|
if (!model.personal) {
|
||||||
ch.setVisibility(View.VISIBLE);
|
((ImageView) ch).setImageDrawable(getMyApplication().getUIUtilities().getThemedIcon(R.drawable.ic_overflow_menu_white));
|
||||||
ch.setContentDescription(getString(R.string.shared_string_settings));
|
ch.setVisibility(View.VISIBLE);
|
||||||
ch.setOnClickListener(new View.OnClickListener() {
|
ch.setContentDescription(getString(R.string.shared_string_settings));
|
||||||
@Override
|
ch.setOnClickListener(new View.OnClickListener() {
|
||||||
public void onClick(View v) {
|
@Override
|
||||||
EditFavoriteGroupDialogFragment.showInstance(getChildFragmentManager(), model.name);
|
public void onClick(View v) {
|
||||||
}
|
EditFavoriteGroupDialogFragment.showInstance(getChildFragmentManager(), model.name);
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
ch.setVisibility(View.GONE);
|
ch.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
@ -933,8 +942,6 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment implemen
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
icon.setImageDrawable(FavoriteImageDrawable.getOrCreate(getActivity(),
|
|
||||||
visible ? model.getColor() : getResources().getColor(disabledIconColor), false));
|
|
||||||
LatLon lastKnownMapLocation = getMyApplication().getSettings().getLastKnownMapLocation();
|
LatLon lastKnownMapLocation = getMyApplication().getSettings().getLastKnownMapLocation();
|
||||||
int dist = (int) (MapUtils.getDistance(model.getLatitude(), model.getLongitude(),
|
int dist = (int) (MapUtils.getDistance(model.getLatitude(), model.getLongitude(),
|
||||||
lastKnownMapLocation.getLatitude(), lastKnownMapLocation.getLongitude()));
|
lastKnownMapLocation.getLatitude(), lastKnownMapLocation.getLongitude()));
|
||||||
|
@ -943,6 +950,17 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment implemen
|
||||||
name.setTypeface(Typeface.DEFAULT, visible ? Typeface.NORMAL : Typeface.ITALIC);
|
name.setTypeface(Typeface.DEFAULT, visible ? Typeface.NORMAL : Typeface.ITALIC);
|
||||||
name.setTextColor(getResources().getColor(visible ? enabledColor : disabledColor));
|
name.setTextColor(getResources().getColor(visible ? enabledColor : disabledColor));
|
||||||
distanceText.setText(distance);
|
distanceText.setText(distance);
|
||||||
|
if (model instanceof PersonalFavouritePoint) {
|
||||||
|
String distanceWithAddress = String.format(getString(R.string.distance_and_address), distance.trim(), model.getDescription() != null ? model.getDescription() : "");
|
||||||
|
distanceText.setText(distanceWithAddress);
|
||||||
|
icon.setImageDrawable(FavoriteImageDrawable.getOrCreate(getActivity(),
|
||||||
|
visible ? model.getColor() : getResources().getColor(disabledIconColor), false,
|
||||||
|
((PersonalFavouritePoint) model).getType()));
|
||||||
|
name.setText((model.getName()));
|
||||||
|
} else {
|
||||||
|
icon.setImageDrawable(FavoriteImageDrawable.getOrCreate(getActivity(),
|
||||||
|
visible ? model.getColor() : getResources().getColor(disabledIconColor), false));
|
||||||
|
}
|
||||||
if (visible) {
|
if (visible) {
|
||||||
distanceText.setTextColor(getResources().getColor(R.color.color_distance));
|
distanceText.setTextColor(getResources().getColor(R.color.color_distance));
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -425,6 +425,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
||||||
if (dashboardOnMap != null) {
|
if (dashboardOnMap != null) {
|
||||||
dashboardOnMap.updateLocation(true, true, false);
|
dashboardOnMap.updateLocation(true, true, false);
|
||||||
}
|
}
|
||||||
|
app.getFavorites().lookupAddressAllPersonalPoints();
|
||||||
app.getTargetPointsHelper().lookupAddessAll();
|
app.getTargetPointsHelper().lookupAddessAll();
|
||||||
app.getMapMarkersHelper().lookupAddressAll();
|
app.getMapMarkersHelper().lookupAddressAll();
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,14 +9,18 @@ import android.graphics.Color;
|
||||||
import android.graphics.ColorFilter;
|
import android.graphics.ColorFilter;
|
||||||
import android.graphics.Paint;
|
import android.graphics.Paint;
|
||||||
import android.graphics.Paint.Style;
|
import android.graphics.Paint.Style;
|
||||||
|
import android.graphics.PixelFormat;
|
||||||
import android.graphics.PorterDuff;
|
import android.graphics.PorterDuff;
|
||||||
import android.graphics.PorterDuffColorFilter;
|
import android.graphics.PorterDuffColorFilter;
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
|
import android.support.v4.content.ContextCompat;
|
||||||
import android.support.v4.content.res.ResourcesCompat;
|
import android.support.v4.content.res.ResourcesCompat;
|
||||||
|
|
||||||
|
import net.osmand.data.PersonalFavouritePoint.PointType;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
import net.osmand.plus.UiUtilities;
|
||||||
|
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
|
|
||||||
|
@ -38,11 +42,16 @@ public class FavoriteImageDrawable extends Drawable {
|
||||||
private Paint paintInnerCircle = new Paint();
|
private Paint paintInnerCircle = new Paint();
|
||||||
private ColorFilter colorFilter;
|
private ColorFilter colorFilter;
|
||||||
private ColorFilter grayFilter;
|
private ColorFilter grayFilter;
|
||||||
|
private Drawable personalPointBitmap;
|
||||||
|
|
||||||
public FavoriteImageDrawable(Context ctx, int color, boolean withShadow, boolean synced) {
|
public FavoriteImageDrawable(Context ctx, int color, boolean withShadow, boolean synced, PointType pointType) {
|
||||||
this.withShadow = withShadow;
|
this.withShadow = withShadow;
|
||||||
this.synced = synced;
|
this.synced = synced;
|
||||||
Resources res = ctx.getResources();
|
Resources res = ctx.getResources();
|
||||||
|
if (pointType != null) {
|
||||||
|
personalPointBitmap = UiUtilities.tintDrawable(ResourcesCompat.getDrawable(res, pointType.getIconId(), null),
|
||||||
|
ContextCompat.getColor(ctx, R.color.icon_color_default_light));
|
||||||
|
}
|
||||||
int col = color == 0 || color == Color.BLACK ? res.getColor(R.color.color_favorite) : color;
|
int col = color == 0 || color == Color.BLACK ? res.getColor(R.color.color_favorite) : color;
|
||||||
favIcon = BitmapFactory.decodeResource(res, R.drawable.map_favorite);
|
favIcon = BitmapFactory.decodeResource(res, R.drawable.map_favorite);
|
||||||
favBackground = BitmapFactory.decodeResource(res, R.drawable.map_white_favorite_shield);
|
favBackground = BitmapFactory.decodeResource(res, R.drawable.map_white_favorite_shield);
|
||||||
|
@ -71,6 +80,9 @@ public class FavoriteImageDrawable extends Drawable {
|
||||||
//bs.inset((int) (4 * density), (int) (4 * density));
|
//bs.inset((int) (4 * density), (int) (4 * density));
|
||||||
bs.inset(bs.width() / 4, bs.height() / 4);
|
bs.inset(bs.width() / 4, bs.height() / 4);
|
||||||
listDrawable.setBounds(bs);
|
listDrawable.setBounds(bs);
|
||||||
|
if (personalPointBitmap != null) {
|
||||||
|
personalPointBitmap.setBounds(bounds);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -96,6 +108,8 @@ public class FavoriteImageDrawable extends Drawable {
|
||||||
} else if (withShadow) {
|
} else if (withShadow) {
|
||||||
canvas.drawBitmap(favBackground, bs.exactCenterX() - favBackground.getWidth() / 2f, bs.exactCenterY() - favBackground.getHeight() / 2f, paintBackground);
|
canvas.drawBitmap(favBackground, bs.exactCenterX() - favBackground.getWidth() / 2f, bs.exactCenterY() - favBackground.getHeight() / 2f, paintBackground);
|
||||||
canvas.drawBitmap(favIcon, bs.exactCenterX() - favIcon.getWidth() / 2f, bs.exactCenterY() - favIcon.getHeight() / 2f, paintIcon);
|
canvas.drawBitmap(favIcon, bs.exactCenterX() - favIcon.getWidth() / 2f, bs.exactCenterY() - favIcon.getHeight() / 2f, paintIcon);
|
||||||
|
} else if (personalPointBitmap != null) {
|
||||||
|
personalPointBitmap.draw(canvas);
|
||||||
} else {
|
} else {
|
||||||
int min = Math.min(bs.width(), bs.height());
|
int min = Math.min(bs.width(), bs.height());
|
||||||
int r = (min * 4 / 10);
|
int r = (min * 4 / 10);
|
||||||
|
@ -132,23 +146,30 @@ public class FavoriteImageDrawable extends Drawable {
|
||||||
|
|
||||||
private static TreeMap<Integer, FavoriteImageDrawable> cache = new TreeMap<>();
|
private static TreeMap<Integer, FavoriteImageDrawable> cache = new TreeMap<>();
|
||||||
|
|
||||||
private static FavoriteImageDrawable getOrCreate(Context a, int color, boolean withShadow, boolean synced) {
|
public static FavoriteImageDrawable getOrCreate(Context a, int color, boolean withShadow, boolean synced, PointType pointType) {
|
||||||
|
int pointTypeId = 0;
|
||||||
|
if (pointType != null)
|
||||||
|
pointTypeId = pointType.ordinal();
|
||||||
color = color | 0xff000000;
|
color = color | 0xff000000;
|
||||||
int hash = (color << 2) + (withShadow ? 1 : 0) + (synced ? 3 : 0);
|
int hash = (color << 4) + ((withShadow ? 1 : 0) << 2) + ((synced ? 3 : 0) << 2) + pointTypeId;
|
||||||
FavoriteImageDrawable drawable = cache.get(hash);
|
FavoriteImageDrawable drawable = cache.get(hash);
|
||||||
if (drawable == null) {
|
if (drawable == null) {
|
||||||
drawable = new FavoriteImageDrawable(a, color, withShadow, synced);
|
drawable = new FavoriteImageDrawable(a, color, withShadow, synced, pointType);
|
||||||
drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
|
drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
|
||||||
cache.put(hash, drawable);
|
cache.put(hash, drawable);
|
||||||
}
|
}
|
||||||
return drawable;
|
return drawable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static FavoriteImageDrawable getOrCreate(Context a, int color, boolean withShadow, PointType pointType) {
|
||||||
|
return getOrCreate(a, color, withShadow, false, pointType);
|
||||||
|
}
|
||||||
|
|
||||||
public static FavoriteImageDrawable getOrCreate(Context a, int color, boolean withShadow) {
|
public static FavoriteImageDrawable getOrCreate(Context a, int color, boolean withShadow) {
|
||||||
return getOrCreate(a, color, withShadow, false);
|
return getOrCreate(a, color, withShadow, false, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static FavoriteImageDrawable getOrCreateSyncedIcon(Context a, int color) {
|
public static FavoriteImageDrawable getOrCreateSyncedIcon(Context a, int color) {
|
||||||
return getOrCreate(a, color, false, true);
|
return getOrCreate(a, color, false, true, null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package net.osmand.plus.dashboard;
|
||||||
|
|
||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
@ -74,6 +75,10 @@ public class DashFavoritesFragment extends DashLocationFragment {
|
||||||
public void onFavoritesLoaded() {
|
public void onFavoritesLoaded() {
|
||||||
setupFavorites();
|
setupFavorites();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFavoriteAddressResolved(@NonNull FavouritePoint favouritePoint) {
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -871,6 +871,14 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
|
||||||
return R.string.shared_string_add;
|
return R.string.shared_string_add;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean isFavButtonEnabled() {
|
||||||
|
MenuController menuController = getMenuController();
|
||||||
|
if (menuController != null) {
|
||||||
|
return menuController.isFavButtonEnabled();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public int getWaypointActionIconId() {
|
public int getWaypointActionIconId() {
|
||||||
return waypointActionIconId;
|
return waypointActionIconId;
|
||||||
}
|
}
|
||||||
|
|
|
@ -561,12 +561,16 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
|
||||||
R.color.ctx_menu_buttons_icon_color));
|
R.color.ctx_menu_buttons_icon_color));
|
||||||
((TextView) view.findViewById(R.id.context_menu_fav_text_view)).setText(menu.getFavActionStringId());
|
((TextView) view.findViewById(R.id.context_menu_fav_text_view)).setText(menu.getFavActionStringId());
|
||||||
View favView = view.findViewById(R.id.context_menu_fav_view);
|
View favView = view.findViewById(R.id.context_menu_fav_view);
|
||||||
favView.setOnClickListener(new View.OnClickListener() {
|
if (menu.isFavButtonEnabled()) {
|
||||||
@Override
|
favView.setOnClickListener(new View.OnClickListener() {
|
||||||
public void onClick(View v) {
|
@Override
|
||||||
menu.buttonFavoritePressed();
|
public void onClick(View v) {
|
||||||
}
|
menu.buttonFavoritePressed();
|
||||||
});
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
deactivate(favView);
|
||||||
|
}
|
||||||
|
|
||||||
final ImageView imageWaypoint = (ImageView) view.findViewById(R.id.context_menu_route_image_view);
|
final ImageView imageWaypoint = (ImageView) view.findViewById(R.id.context_menu_route_image_view);
|
||||||
imageWaypoint.setImageDrawable(getIcon(menu.getWaypointActionIconId(),
|
imageWaypoint.setImageDrawable(getIcon(menu.getWaypointActionIconId(),
|
||||||
|
|
|
@ -504,6 +504,10 @@ public abstract class MenuController extends BaseMenuController implements Colla
|
||||||
return R.string.shared_string_add;
|
return R.string.shared_string_add;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isFavButtonEnabled() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public int getWaypointActionIconId() {
|
public int getWaypointActionIconId() {
|
||||||
return R.drawable.map_action_flag_dark;
|
return R.drawable.map_action_flag_dark;
|
||||||
}
|
}
|
||||||
|
|
|
@ -143,6 +143,11 @@ public class FavouritePointMenuController extends MenuController {
|
||||||
return R.string.shared_string_edit;
|
return R.string.shared_string_edit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isFavButtonEnabled() {
|
||||||
|
return !fav.isPersonal();
|
||||||
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public String getTypeStr() {
|
public String getTypeStr() {
|
||||||
|
|
|
@ -17,7 +17,6 @@ import android.widget.LinearLayout;
|
||||||
import net.osmand.AndroidUtils;
|
import net.osmand.AndroidUtils;
|
||||||
import net.osmand.plus.FavouritesDbHelper;
|
import net.osmand.plus.FavouritesDbHelper;
|
||||||
import net.osmand.GPXUtilities.GPXFile;
|
import net.osmand.GPXUtilities.GPXFile;
|
||||||
import net.osmand.GPXUtilities.WptPt;
|
|
||||||
import net.osmand.plus.UiUtilities;
|
import net.osmand.plus.UiUtilities;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
@ -86,7 +85,9 @@ public class SelectCategoryDialogFragment extends DialogFragment {
|
||||||
} else {
|
} else {
|
||||||
List<FavouritesDbHelper.FavoriteGroup> gs = helper.getFavoriteGroups();
|
List<FavouritesDbHelper.FavoriteGroup> gs = helper.getFavoriteGroups();
|
||||||
for (final FavouritesDbHelper.FavoriteGroup category : gs) {
|
for (final FavouritesDbHelper.FavoriteGroup category : gs) {
|
||||||
addCategory(activity, ll, category.name, category.color);
|
if (!category.personal) {
|
||||||
|
addCategory(activity, ll, category.name, category.color);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
View itemView = activity.getLayoutInflater().inflate(R.layout.favorite_category_dialog_item, null);
|
View itemView = activity.getLayoutInflater().inflate(R.layout.favorite_category_dialog_item, null);
|
||||||
|
|
|
@ -3,6 +3,7 @@ package net.osmand.plus.mapcontextmenu.other;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.support.v7.widget.LinearLayoutManager;
|
import android.support.v7.widget.LinearLayoutManager;
|
||||||
import android.support.v7.widget.RecyclerView;
|
import android.support.v7.widget.RecyclerView;
|
||||||
|
@ -73,6 +74,10 @@ public class FavouritesBottomSheetMenuFragment extends MenuBottomSheetDialogFrag
|
||||||
loadFavorites();
|
loadFavorites();
|
||||||
adapter.notifyDataSetChanged();
|
adapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFavoriteAddressResolved(@NonNull FavouritePoint favouritePoint) {
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
recyclerView = new RecyclerView(getContext());
|
recyclerView = new RecyclerView(getContext());
|
||||||
|
@ -125,9 +130,9 @@ public class FavouritesBottomSheetMenuFragment extends MenuBottomSheetDialogFrag
|
||||||
|
|
||||||
private void loadFavorites() {
|
private void loadFavorites() {
|
||||||
favouritePoints.clear();
|
favouritePoints.clear();
|
||||||
favouritePoints.addAll(getMyApplication().getFavorites().getVisibleFavouritePoints());
|
favouritePoints.addAll(getMyApplication().getFavorites().getNonPersonalVisibleFavouritePoints());
|
||||||
if (favouritePoints.isEmpty()) {
|
if (favouritePoints.isEmpty()) {
|
||||||
favouritePoints.addAll(getMyApplication().getFavorites().getFavouritePoints());
|
favouritePoints.addAll(getMyApplication().getFavorites().getNonPersonalFavouritePoints());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,6 +147,7 @@ public class FavouritesBottomSheetMenuFragment extends MenuBottomSheetDialogFrag
|
||||||
|
|
||||||
private void selectFavorite(FavouritePoint point) {
|
private void selectFavorite(FavouritePoint point) {
|
||||||
TargetPointsHelper targetPointsHelper = getMyApplication().getTargetPointsHelper();
|
TargetPointsHelper targetPointsHelper = getMyApplication().getTargetPointsHelper();
|
||||||
|
FavouritesDbHelper favorites = getMyApplication().getFavorites();
|
||||||
LatLon ll = new LatLon(point.getLatitude(), point.getLongitude());
|
LatLon ll = new LatLon(point.getLatitude(), point.getLongitude());
|
||||||
switch (pointType) {
|
switch (pointType) {
|
||||||
case START:
|
case START:
|
||||||
|
@ -154,10 +160,10 @@ public class FavouritesBottomSheetMenuFragment extends MenuBottomSheetDialogFrag
|
||||||
targetPointsHelper.navigateToPoint(ll, true, targetPointsHelper.getIntermediatePoints().size(), point.getPointDescription());
|
targetPointsHelper.navigateToPoint(ll, true, targetPointsHelper.getIntermediatePoints().size(), point.getPointDescription());
|
||||||
break;
|
break;
|
||||||
case HOME:
|
case HOME:
|
||||||
targetPointsHelper.setHomePoint(ll, point.getPointDescription());
|
favorites.setHomePoint(ll, null);
|
||||||
break;
|
break;
|
||||||
case WORK:
|
case WORK:
|
||||||
targetPointsHelper.setWorkPoint(ll, point.getPointDescription());
|
favorites.setWorkPoint(ll, null);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
MapRouteInfoMenu routeMenu = getMapRouteInfoMenu();
|
MapRouteInfoMenu routeMenu = getMapRouteInfoMenu();
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
package net.osmand.plus.mapmarkers;
|
package net.osmand.plus.mapmarkers;
|
||||||
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.support.annotation.NonNull;
|
||||||
|
|
||||||
|
import net.osmand.data.FavouritePoint;
|
||||||
import net.osmand.plus.FavouritesDbHelper;
|
import net.osmand.plus.FavouritesDbHelper;
|
||||||
import net.osmand.plus.FavouritesDbHelper.FavoriteGroup;
|
import net.osmand.plus.FavouritesDbHelper.FavoriteGroup;
|
||||||
import net.osmand.plus.FavouritesDbHelper.FavoritesListener;
|
import net.osmand.plus.FavouritesDbHelper.FavoritesListener;
|
||||||
|
@ -38,6 +40,10 @@ public class AddFavouritesGroupBottomSheetDialogFragment extends AddGroupBottomS
|
||||||
adapter.notifyDataSetChanged();
|
adapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFavoriteAddressResolved(@NonNull FavouritePoint favouritePoint) {
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return new FavouritesGroupsAdapter(getContext(), favouritesDbHelper.getFavoriteGroups());
|
return new FavouritesGroupsAdapter(getContext(), favouritesDbHelper.getFavoriteGroups());
|
||||||
|
|
|
@ -119,6 +119,12 @@ public class ParkingPositionPlugin extends OsmandPlugin {
|
||||||
return parkingStartTime.get();
|
return parkingStartTime.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void disable(OsmandApplication app) {
|
||||||
|
super.disable(app);
|
||||||
|
app.getFavorites().deleteParkingPoint();
|
||||||
|
}
|
||||||
|
|
||||||
public boolean clearParkingPosition() {
|
public boolean clearParkingPosition() {
|
||||||
parkingLat.resetToDefault();
|
parkingLat.resetToDefault();
|
||||||
parkingLon.resetToDefault();
|
parkingLon.resetToDefault();
|
||||||
|
@ -292,6 +298,7 @@ public class ParkingPositionPlugin extends OsmandPlugin {
|
||||||
showDeleteEventWarning(activity);
|
showDeleteEventWarning(activity);
|
||||||
cancelParking();
|
cancelParking();
|
||||||
if (activity instanceof MapActivity) {
|
if (activity instanceof MapActivity) {
|
||||||
|
app.getFavorites().deleteParkingPoint();
|
||||||
((MapActivity) activity).getContextMenu().close();
|
((MapActivity) activity).getContextMenu().close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,6 +72,7 @@ public class ParkingTypeBottomSheetDialogFragment extends MenuBottomSheetDialogF
|
||||||
plugin.showContextMenuIfNeeded(mapActivity, true);
|
plugin.showContextMenuIfNeeded(mapActivity, true);
|
||||||
mapActivity.refreshMap();
|
mapActivity.refreshMap();
|
||||||
}
|
}
|
||||||
|
mapActivity.getMyApplication().getFavorites().setParkingPoint(plugin.getParkingPosition());
|
||||||
}
|
}
|
||||||
dismiss();
|
dismiss();
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ import android.app.Activity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface;
|
||||||
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.v4.app.ActivityCompat;
|
import android.support.v4.app.ActivityCompat;
|
||||||
|
@ -25,6 +26,7 @@ import net.osmand.AndroidUtils;
|
||||||
import net.osmand.Location;
|
import net.osmand.Location;
|
||||||
import net.osmand.data.FavouritePoint;
|
import net.osmand.data.FavouritePoint;
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
|
import net.osmand.data.PersonalFavouritePoint;
|
||||||
import net.osmand.data.PointDescription;
|
import net.osmand.data.PointDescription;
|
||||||
import net.osmand.plus.FavouritesDbHelper;
|
import net.osmand.plus.FavouritesDbHelper;
|
||||||
import net.osmand.plus.MapMarkersHelper;
|
import net.osmand.plus.MapMarkersHelper;
|
||||||
|
@ -35,6 +37,7 @@ import net.osmand.plus.R;
|
||||||
import net.osmand.plus.TargetPointsHelper;
|
import net.osmand.plus.TargetPointsHelper;
|
||||||
import net.osmand.plus.TargetPointsHelper.TargetPoint;
|
import net.osmand.plus.TargetPointsHelper.TargetPoint;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
|
import net.osmand.plus.base.FavoriteImageDrawable;
|
||||||
import net.osmand.plus.base.MenuBottomSheetDialogFragment;
|
import net.osmand.plus.base.MenuBottomSheetDialogFragment;
|
||||||
import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem;
|
import net.osmand.plus.base.bottomsheetmenu.BaseBottomSheetItem;
|
||||||
import net.osmand.plus.base.bottomsheetmenu.HorizontalRecyclerBottomSheetItem;
|
import net.osmand.plus.base.bottomsheetmenu.HorizontalRecyclerBottomSheetItem;
|
||||||
|
@ -248,12 +251,12 @@ public class AddPointBottomSheetDialog extends MenuBottomSheetDialogFragment {
|
||||||
targetPointsHelper.navigateToPoint(ll, true, targetPointsHelper.getIntermediatePoints().size());
|
targetPointsHelper.navigateToPoint(ll, true, targetPointsHelper.getIntermediatePoints().size());
|
||||||
break;
|
break;
|
||||||
case HOME:
|
case HOME:
|
||||||
app.showShortToastMessage(R.string.add_intermediate_point);
|
app.showShortToastMessage(R.string.add_home);
|
||||||
targetPointsHelper.setHomePoint(ll, null);
|
app.getFavorites().setHomePoint(ll, null);
|
||||||
break;
|
break;
|
||||||
case WORK:
|
case WORK:
|
||||||
app.showShortToastMessage(R.string.add_intermediate_point);
|
app.showShortToastMessage(R.string.add_work);
|
||||||
targetPointsHelper.setWorkPoint(ll, null);
|
app.getFavorites().setWorkPoint(ll, null);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else if (pointType == PointType.START) {
|
} else if (pointType == PointType.START) {
|
||||||
|
@ -358,17 +361,12 @@ public class AddPointBottomSheetDialog extends MenuBottomSheetDialogFragment {
|
||||||
|
|
||||||
private void loadFavoritesItems(List<Object> items, FavouritesDbHelper helper) {
|
private void loadFavoritesItems(List<Object> items, FavouritesDbHelper helper) {
|
||||||
items.clear();
|
items.clear();
|
||||||
addMainScrollItems(items);
|
addMainScrollItems(items, helper);
|
||||||
items.addAll(helper.getVisibleFavouritePoints());
|
items.addAll(helper.getVisibleFavouritePoints());
|
||||||
if (items.isEmpty()) {
|
|
||||||
items.addAll(helper.getFavouritePoints());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addMainScrollItems(List<Object> items) {
|
private void addMainScrollItems(List<Object> items, FavouritesDbHelper favorites) {
|
||||||
items.add(FAVORITES);
|
items.add(FAVORITES);
|
||||||
items.add(PointType.HOME);
|
|
||||||
items.add(PointType.WORK);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createFavoritesScrollItem() {
|
private void createFavoritesScrollItem() {
|
||||||
|
@ -381,16 +379,26 @@ public class AddPointBottomSheetDialog extends MenuBottomSheetDialogFragment {
|
||||||
if (helper.isFavoritesLoaded()) {
|
if (helper.isFavoritesLoaded()) {
|
||||||
loadFavoritesItems(items, helper);
|
loadFavoritesItems(items, helper);
|
||||||
} else {
|
} else {
|
||||||
addMainScrollItems(items);
|
addMainScrollItems(items, helper);
|
||||||
helper.addListener(new FavouritesDbHelper.FavoritesListener() {
|
helper.addListener(new FavouritesDbHelper.FavoritesListener() {
|
||||||
@Override
|
|
||||||
public void onFavoritesLoaded() {
|
private void reloadFavoritesItems() {
|
||||||
MapActivity mapActivity = (MapActivity) getActivity();
|
MapActivity mapActivity = (MapActivity) getActivity();
|
||||||
if (mapActivity != null) {
|
if (mapActivity != null) {
|
||||||
loadFavoritesItems(adapter.getItems(), helper);
|
loadFavoritesItems(adapter.getItems(), helper);
|
||||||
adapter.notifyDataSetChanged();
|
adapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFavoritesLoaded() {
|
||||||
|
reloadFavoritesItems();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFavoriteAddressResolved(@NonNull FavouritePoint favouritePoint) {
|
||||||
|
reloadFavoritesItems();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
BaseBottomSheetItem scrollItem = new HorizontalRecyclerBottomSheetItem.Builder()
|
BaseBottomSheetItem scrollItem = new HorizontalRecyclerBottomSheetItem.Builder()
|
||||||
|
@ -424,7 +432,7 @@ public class AddPointBottomSheetDialog extends MenuBottomSheetDialogFragment {
|
||||||
dismiss();
|
dismiss();
|
||||||
} else {
|
} else {
|
||||||
TargetPointsHelper helper = mapActivity.getMyApplication().getTargetPointsHelper();
|
TargetPointsHelper helper = mapActivity.getMyApplication().getTargetPointsHelper();
|
||||||
Pair<LatLon, PointDescription> pair = getLocationAndDescrFromItem(item, helper);
|
Pair<LatLon, PointDescription> pair = getLocationAndDescrFromItem(item);
|
||||||
LatLon ll = pair.first;
|
LatLon ll = pair.first;
|
||||||
PointDescription name = pair.second;
|
PointDescription name = pair.second;
|
||||||
if (ll == null) {
|
if (ll == null) {
|
||||||
|
@ -434,6 +442,7 @@ public class AddPointBottomSheetDialog extends MenuBottomSheetDialogFragment {
|
||||||
dismiss();
|
dismiss();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
FavouritesDbHelper favorites = requiredMyApplication().getFavorites();
|
||||||
switch (pointType) {
|
switch (pointType) {
|
||||||
case START:
|
case START:
|
||||||
helper.setStartPoint(ll, true, name);
|
helper.setStartPoint(ll, true, name);
|
||||||
|
@ -444,6 +453,15 @@ public class AddPointBottomSheetDialog extends MenuBottomSheetDialogFragment {
|
||||||
case INTERMEDIATE:
|
case INTERMEDIATE:
|
||||||
helper.navigateToPoint(ll, true, helper.getIntermediatePoints().size(), name);
|
helper.navigateToPoint(ll, true, helper.getIntermediatePoints().size(), name);
|
||||||
break;
|
break;
|
||||||
|
case HOME:
|
||||||
|
favorites.setHomePoint(ll, null);
|
||||||
|
break;
|
||||||
|
case WORK:
|
||||||
|
favorites.setWorkPoint(ll, null);
|
||||||
|
break;
|
||||||
|
case PARKING:
|
||||||
|
favorites.setParkingPoint(ll);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
dismiss();
|
dismiss();
|
||||||
}
|
}
|
||||||
|
@ -452,7 +470,7 @@ public class AddPointBottomSheetDialog extends MenuBottomSheetDialogFragment {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private Pair<LatLon, PointDescription> getLocationAndDescrFromItem(Object item, TargetPointsHelper helper) {
|
private Pair<LatLon, PointDescription> getLocationAndDescrFromItem(Object item) {
|
||||||
PointDescription name = null;
|
PointDescription name = null;
|
||||||
LatLon ll = null;
|
LatLon ll = null;
|
||||||
if (item instanceof FavouritePoint) {
|
if (item instanceof FavouritePoint) {
|
||||||
|
@ -460,15 +478,21 @@ public class AddPointBottomSheetDialog extends MenuBottomSheetDialogFragment {
|
||||||
ll = new LatLon(point.getLatitude(), point.getLongitude());
|
ll = new LatLon(point.getLatitude(), point.getLongitude());
|
||||||
name = point.getPointDescription();
|
name = point.getPointDescription();
|
||||||
} else if (item instanceof PointType) {
|
} else if (item instanceof PointType) {
|
||||||
TargetPoint point = null;
|
MapActivity mapActivity = (MapActivity) getActivity();
|
||||||
if (item == PointType.HOME) {
|
if (mapActivity != null) {
|
||||||
point = helper.getHomePoint();
|
FavouritesDbHelper favorites = mapActivity.getMyApplication().getFavorites();
|
||||||
} else if (item == PointType.WORK) {
|
FavouritePoint point = null;
|
||||||
point = helper.getWorkPoint();
|
if (item == PointType.HOME) {
|
||||||
}
|
point = favorites.getHomePoint();
|
||||||
if (point != null) {
|
} else if (item == PointType.WORK) {
|
||||||
ll = new LatLon(point.getLatitude(), point.getLongitude());
|
point = favorites.getWorkPoint();
|
||||||
name = point.getOriginalPointDescription();
|
} else if (item == PointType.PARKING) {
|
||||||
|
point = favorites.getParkingPoint();
|
||||||
|
}
|
||||||
|
if (point != null) {
|
||||||
|
ll = new LatLon(point.getLatitude(), point.getLongitude());
|
||||||
|
name = point.getPointDescription();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new Pair<>(ll, name);
|
return new Pair<>(ll, name);
|
||||||
|
@ -583,8 +607,11 @@ public class AddPointBottomSheetDialog extends MenuBottomSheetDialogFragment {
|
||||||
|
|
||||||
private class FavoritesItemsAdapter extends ScrollItemsAdapter {
|
private class FavoritesItemsAdapter extends ScrollItemsAdapter {
|
||||||
|
|
||||||
|
private FavouritesDbHelper favorites;
|
||||||
|
|
||||||
FavoritesItemsAdapter(OsmandApplication app, List<Object> items) {
|
FavoritesItemsAdapter(OsmandApplication app, List<Object> items) {
|
||||||
super(app, items);
|
super(app, items);
|
||||||
|
favorites = app.getFavorites();
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
|
@ -618,21 +645,15 @@ public class AddPointBottomSheetDialog extends MenuBottomSheetDialogFragment {
|
||||||
favoriteViewHolder.icon.setImageDrawable(getContentIcon(R.drawable.ic_action_fav_dark));
|
favoriteViewHolder.icon.setImageDrawable(getContentIcon(R.drawable.ic_action_fav_dark));
|
||||||
favoriteViewHolder.description.setVisibility(View.GONE);
|
favoriteViewHolder.description.setVisibility(View.GONE);
|
||||||
} else {
|
} else {
|
||||||
if (item instanceof PointType) {
|
if (item instanceof PersonalFavouritePoint) {
|
||||||
final TargetPointsHelper helper = app.getTargetPointsHelper();
|
PersonalFavouritePoint point = (PersonalFavouritePoint) item;
|
||||||
TargetPoint point = null;
|
boolean light = app.getSettings().isLightContent();
|
||||||
if (item == PointType.HOME) {
|
int iconColor = light ? R.color.icon_color_default_light : R.color.icon_color_default_dark;
|
||||||
point = helper.getHomePoint();
|
favoriteViewHolder.icon.setImageDrawable(app.getUIUtilities().getIcon(point.getType().getIconId(), iconColor));
|
||||||
favoriteViewHolder.title.setText(getString(R.string.home_button));
|
favoriteViewHolder.title.setText(point.getName());
|
||||||
favoriteViewHolder.icon.setImageDrawable(getContentIcon(R.drawable.ic_action_home_dark));
|
favoriteViewHolder.description.setText(point.getDescription());
|
||||||
} else if (item == PointType.WORK) {
|
|
||||||
point = helper.getWorkPoint();
|
|
||||||
favoriteViewHolder.title.setText(getString(R.string.work_button));
|
|
||||||
favoriteViewHolder.icon.setImageDrawable(getContentIcon(R.drawable.ic_action_work));
|
|
||||||
}
|
|
||||||
favoriteViewHolder.description.setText(point != null ? point.getPointDescription(app).getSimpleName(app, false) : getString(R.string.shared_string_add));
|
|
||||||
} else if (item instanceof FavouritePoint) {
|
} else if (item instanceof FavouritePoint) {
|
||||||
FavouritePoint point = (FavouritePoint) getItem(position);
|
FavouritePoint point = (FavouritePoint) item;
|
||||||
favoriteViewHolder.title.setText(point.getName());
|
favoriteViewHolder.title.setText(point.getName());
|
||||||
if (point.getCategory().equals("")) {
|
if (point.getCategory().equals("")) {
|
||||||
favoriteViewHolder.description.setText(R.string.shared_string_favorites);
|
favoriteViewHolder.description.setText(R.string.shared_string_favorites);
|
||||||
|
|
|
@ -19,6 +19,7 @@ import android.support.transition.Transition;
|
||||||
import android.support.transition.TransitionListenerAdapter;
|
import android.support.transition.TransitionListenerAdapter;
|
||||||
import android.support.transition.TransitionManager;
|
import android.support.transition.TransitionManager;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.support.v4.app.FragmentManager;
|
||||||
import android.support.v4.content.ContextCompat;
|
import android.support.v4.content.ContextCompat;
|
||||||
import android.support.v7.widget.AppCompatImageView;
|
import android.support.v7.widget.AppCompatImageView;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
@ -39,10 +40,13 @@ import net.osmand.PlatformUtil;
|
||||||
import net.osmand.StateChangedListener;
|
import net.osmand.StateChangedListener;
|
||||||
import net.osmand.ValueHolder;
|
import net.osmand.ValueHolder;
|
||||||
import net.osmand.binary.RouteDataObject;
|
import net.osmand.binary.RouteDataObject;
|
||||||
|
import net.osmand.data.FavouritePoint;
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
import net.osmand.data.PointDescription;
|
import net.osmand.data.PointDescription;
|
||||||
import net.osmand.data.RotatedTileBox;
|
import net.osmand.data.RotatedTileBox;
|
||||||
import net.osmand.plus.ApplicationMode;
|
import net.osmand.plus.ApplicationMode;
|
||||||
|
import net.osmand.plus.FavouritesDbHelper;
|
||||||
|
import net.osmand.plus.FavouritesDbHelper.FavoritesListener;
|
||||||
import net.osmand.plus.GeocodingLookupService;
|
import net.osmand.plus.GeocodingLookupService;
|
||||||
import net.osmand.plus.GeocodingLookupService.AddressLookupRequest;
|
import net.osmand.plus.GeocodingLookupService.AddressLookupRequest;
|
||||||
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
|
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
|
||||||
|
@ -115,7 +119,7 @@ import java.util.Set;
|
||||||
import java.util.Stack;
|
import java.util.Stack;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
|
|
||||||
public class MapRouteInfoMenu implements IRouteInformationListener, CardListener {
|
public class MapRouteInfoMenu implements IRouteInformationListener, CardListener, FavoritesListener {
|
||||||
|
|
||||||
private static final Log LOG = PlatformUtil.getLog(MapRouteInfoMenu.class);
|
private static final Log LOG = PlatformUtil.getLog(MapRouteInfoMenu.class);
|
||||||
|
|
||||||
|
@ -183,7 +187,8 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
||||||
TARGET,
|
TARGET,
|
||||||
INTERMEDIATE,
|
INTERMEDIATE,
|
||||||
HOME,
|
HOME,
|
||||||
WORK
|
WORK,
|
||||||
|
PARKING
|
||||||
}
|
}
|
||||||
|
|
||||||
public MapRouteInfoMenu() {
|
public MapRouteInfoMenu() {
|
||||||
|
@ -209,7 +214,6 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
||||||
app = mapActivity.getMyApplication();
|
app = mapActivity.getMyApplication();
|
||||||
portraitMode = AndroidUiHelper.isOrientationPortrait(mapActivity);
|
portraitMode = AndroidUiHelper.isOrientationPortrait(mapActivity);
|
||||||
animationsHandler = new Handler();
|
animationsHandler = new Handler();
|
||||||
mapActivity.getMyApplication().getRoutingHelper().addListener(this);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -261,6 +265,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
||||||
LatLon latlon = tileBox.getLatLonFromPixel(point.x, point.y);
|
LatLon latlon = tileBox.getLatLonFromPixel(point.x, point.y);
|
||||||
selectFromMapTouch = false;
|
selectFromMapTouch = false;
|
||||||
TargetPointsHelper targets = app.getTargetPointsHelper();
|
TargetPointsHelper targets = app.getTargetPointsHelper();
|
||||||
|
FavouritesDbHelper favorites = app.getFavorites();
|
||||||
switch (selectFromMapPointType) {
|
switch (selectFromMapPointType) {
|
||||||
case START:
|
case START:
|
||||||
targets.setStartPoint(latlon, true, null);
|
targets.setStartPoint(latlon, true, null);
|
||||||
|
@ -272,10 +277,10 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
||||||
targets.navigateToPoint(latlon, true, targets.getIntermediatePoints().size());
|
targets.navigateToPoint(latlon, true, targets.getIntermediatePoints().size());
|
||||||
break;
|
break;
|
||||||
case HOME:
|
case HOME:
|
||||||
targets.setHomePoint(latlon, null);
|
favorites.setHomePoint(latlon, null);
|
||||||
break;
|
break;
|
||||||
case WORK:
|
case WORK:
|
||||||
targets.setWorkPoint(latlon, null);
|
favorites.setWorkPoint(latlon, null);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (selectFromMapWaypoints) {
|
if (selectFromMapWaypoints) {
|
||||||
|
@ -1782,10 +1787,11 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
||||||
hide();
|
hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void selectAddress(String name, LatLon l, PointType pointType) {
|
public void selectAddress(@Nullable String name, @NonNull LatLon l, PointType pointType) {
|
||||||
MapActivity mapActivity = getMapActivity();
|
MapActivity mapActivity = getMapActivity();
|
||||||
if (mapActivity != null) {
|
if (mapActivity != null) {
|
||||||
PointDescription pd = new PointDescription(PointDescription.POINT_TYPE_ADDRESS, name);
|
PointDescription pd = new PointDescription(PointDescription.POINT_TYPE_ADDRESS, name);
|
||||||
|
FavouritesDbHelper favorites = mapActivity.getMyApplication().getFavorites();
|
||||||
TargetPointsHelper targets = mapActivity.getMyApplication().getTargetPointsHelper();
|
TargetPointsHelper targets = mapActivity.getMyApplication().getTargetPointsHelper();
|
||||||
switch (pointType) {
|
switch (pointType) {
|
||||||
case START:
|
case START:
|
||||||
|
@ -1798,10 +1804,10 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
||||||
targets.navigateToPoint(l, true, targets.getIntermediatePoints().size(), pd);
|
targets.navigateToPoint(l, true, targets.getIntermediatePoints().size(), pd);
|
||||||
break;
|
break;
|
||||||
case HOME:
|
case HOME:
|
||||||
targets.setHomePoint(l, pd);
|
favorites.setHomePoint(l, name);
|
||||||
break;
|
break;
|
||||||
case WORK:
|
case WORK:
|
||||||
targets.setWorkPoint(l, pd);
|
favorites.setWorkPoint(l, name);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
updateMenu();
|
updateMenu();
|
||||||
|
@ -1845,6 +1851,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
||||||
if (mapActivity != null) {
|
if (mapActivity != null) {
|
||||||
if (m != null) {
|
if (m != null) {
|
||||||
LatLon point = new LatLon(m.getLatitude(), m.getLongitude());
|
LatLon point = new LatLon(m.getLatitude(), m.getLongitude());
|
||||||
|
FavouritesDbHelper favorites = mapActivity.getMyApplication().getFavorites();
|
||||||
TargetPointsHelper targets = mapActivity.getMyApplication().getTargetPointsHelper();
|
TargetPointsHelper targets = mapActivity.getMyApplication().getTargetPointsHelper();
|
||||||
switch (pointType) {
|
switch (pointType) {
|
||||||
case START:
|
case START:
|
||||||
|
@ -1857,10 +1864,10 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
||||||
targets.navigateToPoint(point, true, targets.getIntermediatePoints().size(), m.getPointDescription(mapActivity));
|
targets.navigateToPoint(point, true, targets.getIntermediatePoints().size(), m.getPointDescription(mapActivity));
|
||||||
break;
|
break;
|
||||||
case HOME:
|
case HOME:
|
||||||
targets.setHomePoint(point, m.getPointDescription(mapActivity));
|
favorites.setHomePoint(point, null);
|
||||||
break;
|
break;
|
||||||
case WORK:
|
case WORK:
|
||||||
targets.setWorkPoint(point, m.getPointDescription(mapActivity));
|
favorites.setWorkPoint(point, null);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
updateMenu();
|
updateMenu();
|
||||||
|
@ -2098,6 +2105,25 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
||||||
public void routeWasFinished() {
|
public void routeWasFinished() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onResume(Fragment fragment) {
|
||||||
|
OsmandApplication app = getApp();
|
||||||
|
if (app != null) {
|
||||||
|
app.getRoutingHelper().addListener(this);
|
||||||
|
app.getFavorites().addListener(this);
|
||||||
|
}
|
||||||
|
addTargetPointListener();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onPause(Fragment fragment) {
|
||||||
|
OsmandApplication app = getApp();
|
||||||
|
if (app != null) {
|
||||||
|
app.getRoutingHelper().removeListener(this);
|
||||||
|
app.getFavorites().removeListener(this);
|
||||||
|
}
|
||||||
|
removeTargetPointListener();
|
||||||
|
menuCards = new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
public void onDismiss(Fragment fragment, int currentMenuState, Bundle arguments, boolean backPressed) {
|
public void onDismiss(Fragment fragment, int currentMenuState, Bundle arguments, boolean backPressed) {
|
||||||
MapActivity mapActivity = getMapActivity();
|
MapActivity mapActivity = getMapActivity();
|
||||||
if (mapActivity != null) {
|
if (mapActivity != null) {
|
||||||
|
@ -2122,7 +2148,6 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
||||||
if (onDismissListener != null) {
|
if (onDismissListener != null) {
|
||||||
onDismissListener.onDismiss(null);
|
onDismissListener.onDismiss(null);
|
||||||
}
|
}
|
||||||
removeTargetPointListener();
|
|
||||||
} else if (fragment instanceof ChooseRouteFragment) {
|
} else if (fragment instanceof ChooseRouteFragment) {
|
||||||
routeSelected = true;
|
routeSelected = true;
|
||||||
MapRouteMenuStateHolder holder = new MapRouteMenuStateHolder(MapRouteMenuType.ROUTE_DETAILS, currentMenuState, fragment.getArguments());
|
MapRouteMenuStateHolder holder = new MapRouteMenuStateHolder(MapRouteMenuType.ROUTE_DETAILS, currentMenuState, fragment.getArguments());
|
||||||
|
@ -2201,12 +2226,6 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
||||||
if (fragmentRef != null) {
|
if (fragmentRef != null) {
|
||||||
fragmentRef.get().dismiss();
|
fragmentRef.get().dismiss();
|
||||||
}
|
}
|
||||||
OsmandApplication app = getApp();
|
|
||||||
if (app != null) {
|
|
||||||
app.getRoutingHelper().removeListener(this);
|
|
||||||
}
|
|
||||||
removeTargetPointListener();
|
|
||||||
menuCards = new ArrayList<>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean needShowMenu() {
|
public boolean needShowMenu() {
|
||||||
|
@ -2223,6 +2242,15 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
||||||
return menuBackStack.empty() ? 0 : menuBackStack.peek().getButtonImage();
|
return menuBackStack.empty() ? 0 : menuBackStack.peek().getButtonImage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFavoritesLoaded() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFavoriteAddressResolved(@NonNull FavouritePoint favouritePoint) {
|
||||||
|
updateMenu();
|
||||||
|
}
|
||||||
|
|
||||||
public enum MapRouteMenuType {
|
public enum MapRouteMenuType {
|
||||||
ROUTE_INFO,
|
ROUTE_INFO,
|
||||||
ROUTE_DETAILS
|
ROUTE_DETAILS
|
||||||
|
|
|
@ -159,13 +159,16 @@ public class MapRouteInfoMenuFragment extends ContextMenuFragment {
|
||||||
updateRouteCalculationProgress(0);
|
updateRouteCalculationProgress(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
menu.addTargetPointListener();
|
menu.onResume(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onPause() {
|
public void onPause() {
|
||||||
super.onPause();
|
super.onPause();
|
||||||
|
if (menu != null) {
|
||||||
|
menu.onPause(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -3,9 +3,11 @@ package net.osmand.plus.routepreparationmenu.cards;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import net.osmand.data.FavouritePoint;
|
||||||
|
import net.osmand.data.LatLon;
|
||||||
|
import net.osmand.plus.FavouritesDbHelper;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.TargetPointsHelper;
|
import net.osmand.plus.TargetPointsHelper;
|
||||||
import net.osmand.plus.TargetPointsHelper.TargetPoint;
|
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.routepreparationmenu.AddPointBottomSheetDialog;
|
import net.osmand.plus.routepreparationmenu.AddPointBottomSheetDialog;
|
||||||
import net.osmand.plus.routepreparationmenu.MapRouteInfoMenu.PointType;
|
import net.osmand.plus.routepreparationmenu.MapRouteInfoMenu.PointType;
|
||||||
|
@ -24,15 +26,14 @@ public class HomeWorkCard extends BaseCard {
|
||||||
@Override
|
@Override
|
||||||
protected void updateContent() {
|
protected void updateContent() {
|
||||||
final TargetPointsHelper targetPointsHelper = mapActivity.getMyApplication().getTargetPointsHelper();
|
final TargetPointsHelper targetPointsHelper = mapActivity.getMyApplication().getTargetPointsHelper();
|
||||||
final TargetPoint homePoint = targetPointsHelper.getHomePoint();
|
final FavouritesDbHelper favorites = getMyApplication().getFavorites();
|
||||||
final TargetPoint workPoint = targetPointsHelper.getWorkPoint();
|
final FavouritePoint homePoint = favorites.getHomePoint();
|
||||||
|
final FavouritePoint workPoint = favorites.getWorkPoint();
|
||||||
|
|
||||||
TextView homeDescr = (TextView) view.findViewById(R.id.home_button_descr);
|
TextView homeDescr = view.findViewById(R.id.home_button_descr);
|
||||||
final TextView workDescr = (TextView) view.findViewById(R.id.work_button_descr);
|
final TextView workDescr = view.findViewById(R.id.work_button_descr);
|
||||||
homeDescr.setText(homePoint != null ? homePoint.getPointDescription(mapActivity).getSimpleName(mapActivity, false) :
|
homeDescr.setText(homePoint != null ? homePoint.getDescription() : mapActivity.getString(R.string.shared_string_add));
|
||||||
mapActivity.getString(R.string.shared_string_add));
|
workDescr.setText(workPoint != null ? workPoint.getDescription() : mapActivity.getString(R.string.shared_string_add));
|
||||||
workDescr.setText(workPoint != null ? workPoint.getPointDescription(mapActivity).getSimpleName(mapActivity, false) :
|
|
||||||
mapActivity.getString(R.string.shared_string_add));
|
|
||||||
|
|
||||||
View homeButton = view.findViewById(R.id.home_button);
|
View homeButton = view.findViewById(R.id.home_button);
|
||||||
homeButton.setOnClickListener(new View.OnClickListener() {
|
homeButton.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@ -41,7 +42,8 @@ public class HomeWorkCard extends BaseCard {
|
||||||
if (homePoint == null) {
|
if (homePoint == null) {
|
||||||
AddPointBottomSheetDialog.showInstance(mapActivity, PointType.HOME);
|
AddPointBottomSheetDialog.showInstance(mapActivity, PointType.HOME);
|
||||||
} else {
|
} else {
|
||||||
targetPointsHelper.navigateToPoint(homePoint.point, true, -1, homePoint.getOriginalPointDescription());
|
targetPointsHelper.navigateToPoint(new LatLon(homePoint.getLatitude(), homePoint.getLongitude()),
|
||||||
|
true, -1, homePoint.getPointDescription());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -60,7 +62,8 @@ public class HomeWorkCard extends BaseCard {
|
||||||
if (workPoint == null) {
|
if (workPoint == null) {
|
||||||
AddPointBottomSheetDialog.showInstance(mapActivity, PointType.WORK);
|
AddPointBottomSheetDialog.showInstance(mapActivity, PointType.WORK);
|
||||||
} else {
|
} else {
|
||||||
targetPointsHelper.navigateToPoint(workPoint.point, true, -1, workPoint.getOriginalPointDescription());
|
targetPointsHelper.navigateToPoint(new LatLon(workPoint.getLatitude(), workPoint.getLongitude()),
|
||||||
|
true, -1, workPoint.getPointDescription());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -270,9 +270,16 @@ public abstract class QuickSearchListFragment extends OsmAndListFragment {
|
||||||
OsmandApplication app = mapActivity.getMyApplication();
|
OsmandApplication app = mapActivity.getMyApplication();
|
||||||
QuickSearchType searchType = dialogFragment.getSearchType();
|
QuickSearchType searchType = dialogFragment.getSearchType();
|
||||||
if (searchType.isTargetPoint()) {
|
if (searchType.isTargetPoint()) {
|
||||||
mapActivity.getMapLayers().getMapControlsLayer().selectAddress(
|
String name = null;
|
||||||
pointDescription != null ? pointDescription.getName() : null,
|
if (pointDescription != null) {
|
||||||
latitude, longitude, searchType);
|
String typeName = pointDescription.getTypeName();
|
||||||
|
if (!Algorithms.isEmpty(typeName)) {
|
||||||
|
name = mapActivity.getString(R.string.street_city, pointDescription.getName(), typeName);
|
||||||
|
} else {
|
||||||
|
name = pointDescription.getName();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mapActivity.getMapLayers().getMapControlsLayer().selectAddress(name, latitude, longitude, searchType);
|
||||||
|
|
||||||
dialogFragment.dismiss();
|
dialogFragment.dismiss();
|
||||||
mapActivity.getMapLayers().getMapControlsLayer().showRouteInfoMenu();
|
mapActivity.getMapLayers().getMapControlsLayer().showRouteInfoMenu();
|
||||||
|
|
|
@ -1286,7 +1286,7 @@ public class MapControlsLayer extends OsmandMapLayer {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (pointType != null) {
|
if (pointType != null) {
|
||||||
mapRouteInfoMenu.selectAddress(name != null ? name : "", new LatLon(latitude, longitude), pointType);
|
mapRouteInfoMenu.selectAddress(name, new LatLon(latitude, longitude), pointType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue