Update recents
This commit is contained in:
parent
179d2f6d4d
commit
508bdb7ecb
56 changed files with 950 additions and 497 deletions
|
@ -29,6 +29,7 @@
|
|||
<string name="photo">Photo</string>
|
||||
<string name="share_note">Share note</string>
|
||||
<string name="rename_recording">Rename recording</string>
|
||||
<string name="location_on_map">Location:\n Lat %1$s\n Lon %2$s</string>
|
||||
<string name="watch">Watch</string>
|
||||
<string name="notes">Notes</string>
|
||||
<string name="online_map">Online map</string>
|
||||
|
@ -1790,7 +1791,6 @@ Afghanistan, Albania, Algeria, Andorra, Angola, Anguilla, Antigua and Barbuda, A
|
|||
<string name="error_reading_gpx">Error reading GPX data</string>
|
||||
<string name="vector_data">Offline vector maps</string>
|
||||
<string name="transport_context_menu">Search transport at stop</string>
|
||||
<string name="point_on_map">Location:\n Lat %1$.5f\n Lon %2$.5f</string>
|
||||
<string name="osb_bug_name">Bug</string>
|
||||
<string name="poi_context_menu_modify">Modify POI</string>
|
||||
<string name="poi_context_menu_delete">Delete POI</string>
|
||||
|
|
|
@ -6,6 +6,7 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.data.QuadPoint;
|
||||
import net.osmand.data.RotatedTileBox;
|
||||
import net.osmand.plus.R;
|
||||
|
@ -155,8 +156,8 @@ public class MapExplorer implements OnGestureListener, IContextMenuProvider {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getObjectName(Object o) {
|
||||
return mapView.getContext().getString(R.string.i_am_here);
|
||||
public PointDescription getObjectName(Object o) {
|
||||
return new PointDescription(PointDescription.POINT_TYPE_MARKER, mapView.getContext().getString(R.string.i_am_here));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -28,6 +28,15 @@ public class FavouritePoint implements Serializable, LocationPoint {
|
|||
return color;
|
||||
}
|
||||
|
||||
public PointDescription getPointDescription() {
|
||||
return new PointDescription(PointDescription.POINT_TYPE_FAVORITE, name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PointDescription getPointDescription(Context ctx) {
|
||||
return getPointDescription();
|
||||
}
|
||||
|
||||
public void setColor(int color) {
|
||||
this.color = color;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ package net.osmand.data;
|
|||
|
||||
import android.content.Context;
|
||||
|
||||
|
||||
/**
|
||||
*/
|
||||
public interface LocationPoint {
|
||||
|
@ -10,11 +11,11 @@ public interface LocationPoint {
|
|||
|
||||
public double getLongitude();
|
||||
|
||||
public String getName(Context ctx);
|
||||
|
||||
public int getColor();
|
||||
|
||||
public boolean isVisible();
|
||||
|
||||
public PointDescription getPointDescription(Context ctx);
|
||||
|
||||
// public String getSpeakableName();
|
||||
|
||||
|
|
285
OsmAnd/src/net/osmand/data/PointDescription.java
Normal file
285
OsmAnd/src/net/osmand/data/PointDescription.java
Normal file
|
@ -0,0 +1,285 @@
|
|||
package net.osmand.data;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.DecimalFormatSymbols;
|
||||
import java.util.Locale;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import com.jwetherell.openmap.common.LatLonPoint;
|
||||
import com.jwetherell.openmap.common.UTMPoint;
|
||||
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.util.Algorithms;
|
||||
import android.content.Context;
|
||||
import android.support.annotation.NonNull;
|
||||
|
||||
public class PointDescription {
|
||||
private String type = "";
|
||||
private String name = "";
|
||||
private String typeName;
|
||||
|
||||
public static final String POINT_TYPE_FAVORITE = "favorite";
|
||||
public static final String POINT_TYPE_WPT = "wpt";
|
||||
public static final String POINT_TYPE_POI = "poi";
|
||||
public static final String POINT_TYPE_ADDRESS = "address";
|
||||
public static final String POINT_TYPE_OSM_NOTE= "osm_note";
|
||||
public static final String POINT_TYPE_MARKER = "marker";
|
||||
public static final String POINT_TYPE_NOTE = "avnote";
|
||||
public static final String POINT_TYPE_LOCATION = "location";
|
||||
public static final String POINT_TYPE_ALARM = "alarm";
|
||||
public static final String POINT_TYPE_TARGET = "destination";
|
||||
|
||||
|
||||
public static final PointDescription LOCATION_POINT = new PointDescription(POINT_TYPE_LOCATION, "");
|
||||
|
||||
public PointDescription(String type, String name) {
|
||||
this.type = type;
|
||||
this.name = name;
|
||||
if (this.name == null) {
|
||||
this.name = "";
|
||||
}
|
||||
}
|
||||
|
||||
public PointDescription(String type, String typeName, String name) {
|
||||
this.type = type;
|
||||
this.name = name;
|
||||
this.typeName = typeName;
|
||||
if (this.name == null) {
|
||||
this.name = "";
|
||||
}
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getFullPlainName(Context ctx, double lat, double lon) {
|
||||
if (isLocation()) {
|
||||
OsmandSettings st = ((OsmandApplication) ctx.getApplicationContext()).getSettings();
|
||||
int f = st.COORDINATES_FORMAT.get();
|
||||
if (f == PointDescription.UTM_FORMAT) {
|
||||
UTMPoint pnt = new UTMPoint(new LatLonPoint(lat, lon));
|
||||
return pnt.zone_number + "" + pnt.zone_letter + " " + ((long) pnt.northing) + " "
|
||||
+ ((long) pnt.easting);
|
||||
} else {
|
||||
return ctx.getString(R.string.location_on_map, convert(lat, f), convert(lon, f));
|
||||
}
|
||||
} else {
|
||||
String typeName = this.typeName;
|
||||
if (isFavorite()) {
|
||||
typeName = ctx.getString(R.string.favorite);
|
||||
} else if (isPoi()) {
|
||||
typeName = ctx.getString(R.string.poi);
|
||||
} else if (isWpt()) {
|
||||
return ctx.getString(R.string.gpx_wpt);
|
||||
}
|
||||
if (!Algorithms.isEmpty(typeName)) {
|
||||
if (Algorithms.isEmpty(name)) {
|
||||
return typeName;
|
||||
} else {
|
||||
return typeName + ": " + name;
|
||||
}
|
||||
}
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isLocation() {
|
||||
return POINT_TYPE_LOCATION.equals(type);
|
||||
}
|
||||
|
||||
public boolean isAddress() {
|
||||
return POINT_TYPE_ADDRESS.equals(type);
|
||||
}
|
||||
|
||||
public boolean isWpt() {
|
||||
return POINT_TYPE_WPT.equals(type);
|
||||
}
|
||||
|
||||
public boolean isPoi() {
|
||||
return POINT_TYPE_POI.equals(type);
|
||||
}
|
||||
|
||||
public boolean isFavorite() {
|
||||
return POINT_TYPE_FAVORITE.equals(type);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((name == null) ? 0 : name.hashCode());
|
||||
result = prime * result + ((type == null) ? 0 : type.hashCode());
|
||||
result = prime * result + ((typeName == null) ? 0 : typeName.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null || getClass() != obj.getClass())
|
||||
return false;
|
||||
PointDescription other = (PointDescription) obj;
|
||||
if (Algorithms.objectEquals(other.name, name)
|
||||
&& Algorithms.objectEquals(other.type, type)
|
||||
&& Algorithms.objectEquals(other.typeName, typeName)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
public static String getSimpleName(LocationPoint o, Context ctx) {
|
||||
return o.getPointDescription(ctx).getFullPlainName(ctx, o.getLatitude(), o.getLongitude());
|
||||
}
|
||||
|
||||
public static String serializeToString(PointDescription p) {
|
||||
if (p == null) {
|
||||
return "";
|
||||
}
|
||||
String tp = p.type ;
|
||||
if(!Algorithms.isEmpty(p.typeName)) {
|
||||
tp = tp +'.' + p.typeName;
|
||||
}
|
||||
return tp + "#" + p.name;
|
||||
}
|
||||
|
||||
public static PointDescription deserializeFromString(String s) {
|
||||
if (s != null && s.length() > 0) {
|
||||
int in = s.indexOf('#');
|
||||
if (in >= 0) {
|
||||
String nm = s.substring(in + 1).trim();
|
||||
String tp = s.substring(0, in);
|
||||
if(tp.contains(".")) {
|
||||
return new PointDescription(tp.substring(0, tp.indexOf('.')), tp.substring(tp.indexOf('.') + 1), nm);
|
||||
} else {
|
||||
return new PointDescription(tp, nm);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// THIS code is copied from Location.convert() in order to change locale
|
||||
// and to fix bug in android implementation : doesn't convert if min = 59.23 or sec = 59.32 or deg=179.3
|
||||
public static final int FORMAT_DEGREES = 0;
|
||||
public static final int FORMAT_MINUTES = 1;
|
||||
public static final int FORMAT_SECONDS = 2;
|
||||
public static final int UTM_FORMAT = 3;
|
||||
private static final char DELIM = ':';
|
||||
|
||||
/**
|
||||
* Converts a String in one of the formats described by
|
||||
* FORMAT_DEGREES, FORMAT_MINUTES, or FORMAT_SECONDS into a
|
||||
* double.
|
||||
*
|
||||
* @throws NullPointerException if coordinate is null
|
||||
* @throws IllegalArgumentException if the coordinate is not
|
||||
* in one of the valid formats.
|
||||
*/
|
||||
public static double convert(String coordinate) {
|
||||
coordinate = coordinate.replace(' ', ':').replace('#', ':').replace(',', '.');
|
||||
if (coordinate == null) {
|
||||
throw new NullPointerException("coordinate");
|
||||
}
|
||||
|
||||
boolean negative = false;
|
||||
if (coordinate.charAt(0) == '-') {
|
||||
coordinate = coordinate.substring(1);
|
||||
negative = true;
|
||||
}
|
||||
|
||||
StringTokenizer st = new StringTokenizer(coordinate, ":");
|
||||
int tokens = st.countTokens();
|
||||
if (tokens < 1) {
|
||||
throw new IllegalArgumentException("coordinate=" + coordinate);
|
||||
}
|
||||
try {
|
||||
String degrees = st.nextToken();
|
||||
double val;
|
||||
if (tokens == 1) {
|
||||
val = Double.parseDouble(degrees);
|
||||
return negative ? -val : val;
|
||||
}
|
||||
|
||||
String minutes = st.nextToken();
|
||||
int deg = Integer.parseInt(degrees);
|
||||
double min;
|
||||
double sec = 0.0;
|
||||
|
||||
if (st.hasMoreTokens()) {
|
||||
min = Integer.parseInt(minutes);
|
||||
String seconds = st.nextToken();
|
||||
sec = Double.parseDouble(seconds);
|
||||
} else {
|
||||
min = Double.parseDouble(minutes);
|
||||
}
|
||||
|
||||
boolean isNegative180 = negative && (deg == 180) &&
|
||||
(min == 0) && (sec == 0);
|
||||
|
||||
// deg must be in [0, 179] except for the case of -180 degrees
|
||||
if ((deg < 0.0) || (deg > 180 && !isNegative180)) {
|
||||
throw new IllegalArgumentException("coordinate=" + coordinate);
|
||||
}
|
||||
if (min < 0 || min > 60d) {
|
||||
throw new IllegalArgumentException("coordinate=" +
|
||||
coordinate);
|
||||
}
|
||||
if (sec < 0 || sec > 60d) {
|
||||
throw new IllegalArgumentException("coordinate=" +
|
||||
coordinate);
|
||||
}
|
||||
|
||||
val = deg*3600.0 + min*60.0 + sec;
|
||||
val /= 3600.0;
|
||||
return negative ? -val : val;
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new IllegalArgumentException("coordinate=" + coordinate);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static String convert(double coordinate, int outputType) {
|
||||
if (coordinate < -180.0 || coordinate > 180.0 || Double.isNaN(coordinate)) {
|
||||
throw new IllegalArgumentException("coordinate=" + coordinate); //$NON-NLS-1$
|
||||
}
|
||||
if ((outputType != FORMAT_DEGREES) && (outputType != FORMAT_MINUTES) && (outputType != FORMAT_SECONDS)) {
|
||||
throw new IllegalArgumentException("outputType=" + outputType); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
// Handle negative values
|
||||
if (coordinate < 0) {
|
||||
sb.append('-');
|
||||
coordinate = -coordinate;
|
||||
}
|
||||
|
||||
DecimalFormat df = new DecimalFormat("###.#####", new DecimalFormatSymbols(Locale.US)); //$NON-NLS-1$
|
||||
if (outputType == FORMAT_MINUTES || outputType == FORMAT_SECONDS) {
|
||||
int degrees = (int) Math.floor(coordinate);
|
||||
sb.append(degrees);
|
||||
sb.append(DELIM);
|
||||
coordinate -= degrees;
|
||||
coordinate *= 60.0;
|
||||
if (outputType == FORMAT_SECONDS) {
|
||||
int minutes = (int) Math.floor(coordinate);
|
||||
sb.append(minutes);
|
||||
sb.append(DELIM);
|
||||
coordinate -= minutes;
|
||||
coordinate *= 60.0;
|
||||
}
|
||||
}
|
||||
sb.append(df.format(coordinate));
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
}
|
|
@ -12,7 +12,6 @@ import java.io.OutputStreamWriter;
|
|||
import java.io.Reader;
|
||||
import java.io.StringWriter;
|
||||
import java.io.Writer;
|
||||
import java.net.URLEncoder;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.DecimalFormatSymbols;
|
||||
import java.text.NumberFormat;
|
||||
|
@ -31,6 +30,7 @@ import java.util.TimeZone;
|
|||
import net.osmand.Location;
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.data.LocationPoint;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.util.Algorithms;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
|
@ -115,9 +115,10 @@ public class GPXUtilities {
|
|||
return lon;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getName(Context ctx) {
|
||||
return name;
|
||||
public PointDescription getPointDescription(Context ctx) {
|
||||
return new PointDescription(PointDescription.POINT_TYPE_WPT, name);
|
||||
}
|
||||
|
||||
public WptPt(double lat, double lon, long time, double ele, double speed, double hdop) {
|
||||
|
|
|
@ -14,9 +14,11 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import net.osmand.IndexConstants;
|
||||
import net.osmand.StateChangedListener;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.map.ITileSource;
|
||||
import net.osmand.map.TileSourceManager;
|
||||
import net.osmand.map.TileSourceManager.TileSourceTemplate;
|
||||
|
@ -1278,10 +1280,10 @@ public class OsmandSettings {
|
|||
return new LatLon(lat, lon);
|
||||
}
|
||||
|
||||
public String getAndClearMapLabelToShow(){
|
||||
public PointDescription getAndClearMapLabelToShow(){
|
||||
String label = settingsAPI.getString(globalPreferences,MAP_LABEL_TO_SHOW, null);
|
||||
settingsAPI.edit(globalPreferences).remove(MAP_LABEL_TO_SHOW).commit();
|
||||
return label;
|
||||
return PointDescription.deserializeFromString(label);
|
||||
}
|
||||
|
||||
private Object objectToShow;
|
||||
|
@ -1295,30 +1297,30 @@ public class OsmandSettings {
|
|||
return settingsAPI.getInt(globalPreferences,MAP_ZOOM_TO_SHOW, 5);
|
||||
}
|
||||
|
||||
public void setMapLocationToShow(double latitude, double longitude, int zoom, String historyDescription,
|
||||
String labelToShow, Object toShow) {
|
||||
public void setMapLocationToShow(double latitude, double longitude, int zoom, PointDescription pointDescription,
|
||||
boolean addToHistory, Object toShow) {
|
||||
SettingsEditor edit = settingsAPI.edit(globalPreferences);
|
||||
edit.putFloat(MAP_LAT_TO_SHOW, (float) latitude);
|
||||
edit.putFloat(MAP_LON_TO_SHOW, (float) longitude);
|
||||
if (labelToShow != null) {
|
||||
edit.putString(MAP_LABEL_TO_SHOW, labelToShow);
|
||||
if (pointDescription != null) {
|
||||
edit.putString(MAP_LABEL_TO_SHOW, PointDescription.serializeToString(pointDescription));
|
||||
} else {
|
||||
edit.remove(MAP_LABEL_TO_SHOW);
|
||||
}
|
||||
edit.putInt(MAP_ZOOM_TO_SHOW, zoom);
|
||||
edit.commit();
|
||||
objectToShow = toShow;
|
||||
if(historyDescription != null){
|
||||
SearchHistoryHelper.getInstance(ctx).addNewItemToHistory(latitude, longitude, historyDescription);
|
||||
if(addToHistory){
|
||||
SearchHistoryHelper.getInstance(ctx).addNewItemToHistory(latitude, longitude, pointDescription);
|
||||
}
|
||||
}
|
||||
|
||||
public void setMapLocationToShow(double latitude, double longitude, int zoom) {
|
||||
setMapLocationToShow(latitude, longitude, zoom, null, null, null);
|
||||
setMapLocationToShow(latitude, longitude, zoom, null, false, null);
|
||||
}
|
||||
|
||||
public void setMapLocationToShow(double latitude, double longitude, int zoom, String historyDescription){
|
||||
setMapLocationToShow(latitude, longitude, zoom, historyDescription, historyDescription, null);
|
||||
public void setMapLocationToShow(double latitude, double longitude, int zoom, PointDescription historyDescription){
|
||||
setMapLocationToShow(latitude, longitude, zoom, historyDescription, true, null);
|
||||
}
|
||||
|
||||
// Do not use that method if you want to show point on map. Use setMapLocationToShow
|
||||
|
@ -1368,12 +1370,14 @@ public class OsmandSettings {
|
|||
return new LatLon(lat, lon);
|
||||
}
|
||||
|
||||
public String getStartPointDescription() {
|
||||
return settingsAPI.getString(globalPreferences, START_POINT_DESCRIPTION, "");
|
||||
public PointDescription getStartPointDescription() {
|
||||
return
|
||||
PointDescription.deserializeFromString(settingsAPI.getString(globalPreferences, START_POINT_DESCRIPTION, ""));
|
||||
}
|
||||
|
||||
public String getPointNavigateDescription() {
|
||||
return settingsAPI.getString(globalPreferences, POINT_NAVIGATE_DESCRIPTION, "");
|
||||
public PointDescription getPointNavigateDescription() {
|
||||
return
|
||||
PointDescription.deserializeFromString(settingsAPI.getString(globalPreferences, POINT_NAVIGATE_DESCRIPTION, ""));
|
||||
}
|
||||
|
||||
|
||||
|
@ -1422,16 +1426,17 @@ public class OsmandSettings {
|
|||
return list;
|
||||
}
|
||||
|
||||
public boolean insertIntermediatePoint(double latitude, double longitude, String historyDescription, int index) {
|
||||
public boolean insertIntermediatePoint(double latitude, double longitude, PointDescription historyDescription, int index) {
|
||||
List<LatLon> ps = getIntermediatePoints();
|
||||
List<String> ds = getIntermediatePointDescriptions(ps.size());
|
||||
ps.add(index, new LatLon(latitude, longitude));
|
||||
ds.add(index, historyDescription);
|
||||
ds.add(index, PointDescription.serializeToString(historyDescription));
|
||||
if (historyDescription != null) {
|
||||
SearchHistoryHelper.getInstance(ctx).addNewItemToHistory(latitude, longitude, historyDescription);
|
||||
}
|
||||
return saveIntermediatePoints(ps,ds);
|
||||
}
|
||||
|
||||
public boolean deleteIntermediatePoint( int index) {
|
||||
List<LatLon> ps = getIntermediatePoints();
|
||||
List<String> ds = getIntermediatePointDescriptions(ps.size());
|
||||
|
@ -1474,23 +1479,20 @@ public class OsmandSettings {
|
|||
remove(START_POINT_DESCRIPTION).commit();
|
||||
}
|
||||
|
||||
public boolean setPointToNavigate(double latitude, double longitude, String historyDescription) {
|
||||
public boolean setPointToNavigate(double latitude, double longitude, PointDescription p) {
|
||||
boolean add = settingsAPI.edit(globalPreferences).putFloat(POINT_NAVIGATE_LAT, (float) latitude).putFloat(POINT_NAVIGATE_LON, (float) longitude).commit();
|
||||
settingsAPI.edit(globalPreferences).putString(POINT_NAVIGATE_DESCRIPTION, historyDescription).commit();
|
||||
settingsAPI.edit(globalPreferences).putString(POINT_NAVIGATE_DESCRIPTION, PointDescription.serializeToString(p)).commit();
|
||||
if(add){
|
||||
if(historyDescription != null){
|
||||
SearchHistoryHelper.getInstance(ctx).addNewItemToHistory(latitude, longitude, historyDescription);
|
||||
if(p != null){
|
||||
SearchHistoryHelper.getInstance(ctx).addNewItemToHistory(latitude, longitude, p);
|
||||
}
|
||||
}
|
||||
return add;
|
||||
}
|
||||
|
||||
public boolean setPointToStart(double latitude, double longitude, String description) {
|
||||
public boolean setPointToStart(double latitude, double longitude, PointDescription p) {
|
||||
boolean add = settingsAPI.edit(globalPreferences).putFloat(START_POINT_LAT, (float) latitude).putFloat(START_POINT_LON, (float) longitude).commit();
|
||||
if (description == null) {
|
||||
description = "";
|
||||
}
|
||||
settingsAPI.edit(globalPreferences).putString(START_POINT_DESCRIPTION, description).commit();
|
||||
settingsAPI.edit(globalPreferences).putString(START_POINT_DESCRIPTION, PointDescription.serializeToString(p)).commit();
|
||||
return add;
|
||||
}
|
||||
|
||||
|
@ -1738,6 +1740,8 @@ public class OsmandSettings {
|
|||
public final OsmandPreference<String> CONTRIBUTION_INSTALL_APP_DATE = new StringPreference("CONTRIBUTION_INSTALL_APP_DATE", null).makeGlobal();
|
||||
|
||||
|
||||
public final OsmandPreference<Integer> COORDINATES_FORMAT = new IntPreference("coordinates_format", PointDescription.FORMAT_DEGREES).makeGlobal();
|
||||
|
||||
public final OsmandPreference<Boolean> FOLLOW_THE_ROUTE = new BooleanPreference("follow_to_route", false).makeGlobal();
|
||||
public final OsmandPreference<String> FOLLOW_THE_GPX_ROUTE = new StringPreference("follow_gpx", null).makeGlobal();
|
||||
|
||||
|
|
|
@ -4,15 +4,15 @@ package net.osmand.plus;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import net.osmand.Location;
|
||||
import net.osmand.StateChangedListener;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.LocationPoint;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.plus.routing.RouteProvider.RouteService;
|
||||
import net.osmand.plus.routing.RoutingHelper;
|
||||
import net.osmand.util.MapUtils;
|
||||
import android.content.Context;
|
||||
|
||||
public class TargetPointsHelper {
|
||||
|
||||
|
@ -26,43 +26,47 @@ public class TargetPointsHelper {
|
|||
|
||||
public static class TargetPoint implements LocationPoint {
|
||||
public LatLon point;
|
||||
public String name;
|
||||
private PointDescription pointDescription;
|
||||
public int index;
|
||||
public boolean intermediate;
|
||||
|
||||
public TargetPoint(LatLon point, String name) {
|
||||
public TargetPoint(LatLon point, PointDescription name) {
|
||||
this.point = point;
|
||||
this.name = name;
|
||||
this.pointDescription = name;
|
||||
}
|
||||
|
||||
public TargetPoint(LatLon point, String name, int index) {
|
||||
public TargetPoint(LatLon point, PointDescription name, int index) {
|
||||
this.point = point;
|
||||
this.name = name;
|
||||
this.pointDescription = name;
|
||||
this.index = index;
|
||||
this.intermediate = true;
|
||||
}
|
||||
|
||||
public PointDescription getPointDescription(Context ctx) {
|
||||
if (!intermediate) {
|
||||
return new PointDescription(PointDescription.POINT_TYPE_TARGET, ctx.getString(R.string.destination_point, ""),
|
||||
getOnlyName());
|
||||
} else {
|
||||
return new PointDescription(PointDescription.POINT_TYPE_TARGET, (index + 1) + ". " + ctx.getString(R.string.intermediate_point, ""),
|
||||
getOnlyName());
|
||||
}
|
||||
}
|
||||
|
||||
public PointDescription getOriginalPointDescription() {
|
||||
return pointDescription;
|
||||
};
|
||||
|
||||
public String getOnlyName() {
|
||||
return pointDescription == null ? "" : pointDescription.getName();
|
||||
}
|
||||
|
||||
public static TargetPoint create(LatLon point, String name) {
|
||||
public static TargetPoint create(LatLon point, PointDescription name) {
|
||||
if(point != null) {
|
||||
return new TargetPoint(point, name);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private String vName() {
|
||||
if(name.trim().length()==0) {
|
||||
return "";
|
||||
}
|
||||
return ": " + name;
|
||||
}
|
||||
|
||||
public String getVisibleName(Context ctx) {
|
||||
if (!intermediate) {
|
||||
return ctx.getString(R.string.destination_point, "") + vName();
|
||||
} else {
|
||||
return (index + 1) + ". " + ctx.getString(R.string.intermediate_point, "") + vName();
|
||||
}
|
||||
}
|
||||
|
||||
public double getLatitude() {
|
||||
return point.getLatitude();
|
||||
|
@ -72,11 +76,6 @@ public class TargetPointsHelper {
|
|||
return point.getLongitude();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName(Context ctx) {
|
||||
return getVisibleName(ctx);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColor() {
|
||||
return 0;
|
||||
|
@ -103,7 +102,7 @@ public class TargetPointsHelper {
|
|||
List<LatLon> ips = settings.getIntermediatePoints();
|
||||
List<String> desc = settings.getIntermediatePointDescriptions(ips.size());
|
||||
for(int i = 0; i < ips.size(); i++) {
|
||||
intermediatePoints.add(new TargetPoint(ips.get(i), desc.get(i), i));
|
||||
intermediatePoints.add(new TargetPoint(ips.get(i), PointDescription.deserializeFromString(desc.get(i)), i));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -115,7 +114,7 @@ public class TargetPointsHelper {
|
|||
return pointToStart;
|
||||
}
|
||||
|
||||
public String getStartPointDescription(){
|
||||
public PointDescription getStartPointDescription(){
|
||||
return settings.getStartPointDescription();
|
||||
}
|
||||
|
||||
|
@ -170,7 +169,7 @@ public class TargetPointsHelper {
|
|||
public void makeWayPointDestination(boolean updateRoute, int index){
|
||||
pointToNavigate = intermediatePoints.remove(index);
|
||||
settings.setPointToNavigate(pointToNavigate.getLatitude(), pointToNavigate.getLongitude(),
|
||||
pointToNavigate.name);
|
||||
pointToNavigate.pointDescription);
|
||||
settings.deleteIntermediatePoint(index);
|
||||
updateRouteAndReferesh(updateRoute);
|
||||
}
|
||||
|
@ -184,7 +183,7 @@ public class TargetPointsHelper {
|
|||
settings.deleteIntermediatePoint(sz- 1);
|
||||
pointToNavigate = intermediatePoints.remove(sz - 1);
|
||||
settings.setPointToNavigate(pointToNavigate.getLatitude(), pointToNavigate.getLongitude(),
|
||||
pointToNavigate.name);
|
||||
pointToNavigate.pointDescription);
|
||||
}
|
||||
} else {
|
||||
settings.deleteIntermediatePoint(index);
|
||||
|
@ -268,12 +267,12 @@ public class TargetPointsHelper {
|
|||
ArrayList<String> names = new ArrayList<String>(subList.size());
|
||||
ArrayList<LatLon> ls = new ArrayList<LatLon>(subList.size());
|
||||
for(int i = 0; i < subList.size(); i++) {
|
||||
names.add(subList.get(i).name);
|
||||
names.add(PointDescription.serializeToString(subList.get(i).pointDescription));
|
||||
ls.add(subList.get(i).point);
|
||||
}
|
||||
settings.saveIntermediatePoints(ls, names);
|
||||
TargetPoint p = point.get(point.size() - 1);
|
||||
settings.setPointToNavigate(p.getLatitude(), p.getLongitude(), p.name);
|
||||
settings.setPointToNavigate(p.getLatitude(), p.getLongitude(), p.pointDescription);
|
||||
} else {
|
||||
settings.clearIntermediatePoints();
|
||||
}
|
||||
|
@ -306,13 +305,13 @@ public class TargetPointsHelper {
|
|||
navigateToPoint(point, updateRoute, intermediate, null);
|
||||
}
|
||||
|
||||
public void navigateToPoint(LatLon point, boolean updateRoute, int intermediate, String historyName){
|
||||
public void navigateToPoint(LatLon point, boolean updateRoute, int intermediate, PointDescription historyName){
|
||||
if(point != null){
|
||||
if(intermediate < 0 || intermediate > intermediatePoints.size()) {
|
||||
if(intermediate > intermediatePoints.size()) {
|
||||
TargetPoint pn = getPointToNavigate();
|
||||
if(pn != null) {
|
||||
settings.insertIntermediatePoint(pn.getLatitude(), pn.getLongitude(), pn.name,
|
||||
settings.insertIntermediatePoint(pn.getLatitude(), pn.getLongitude(), pn.pointDescription,
|
||||
intermediatePoints.size());
|
||||
}
|
||||
}
|
||||
|
@ -329,7 +328,7 @@ public class TargetPointsHelper {
|
|||
updateRouteAndReferesh(updateRoute);
|
||||
}
|
||||
|
||||
public void setStartPoint(LatLon startPoint, boolean updateRoute, String name) {
|
||||
public void setStartPoint(LatLon startPoint, boolean updateRoute, PointDescription name) {
|
||||
if(startPoint != null) {
|
||||
settings.setPointToStart(startPoint.getLatitude(), startPoint.getLongitude(), name);
|
||||
} else {
|
||||
|
|
|
@ -12,13 +12,6 @@ import java.util.Locale;
|
|||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import android.os.Handler;
|
||||
import android.support.v4.view.MenuItemCompat;
|
||||
import android.support.v7.app.ActionBarActivity;
|
||||
import android.support.v7.view.ActionMode;
|
||||
import android.support.v7.widget.PopupMenu;
|
||||
import android.support.v7.widget.SearchView;
|
||||
import android.view.*;
|
||||
import net.osmand.IndexConstants;
|
||||
import net.osmand.access.AccessibleToast;
|
||||
import net.osmand.plus.ContextMenuAdapter;
|
||||
|
@ -46,15 +39,24 @@ import android.content.res.TypedArray;
|
|||
import android.graphics.Typeface;
|
||||
import android.net.Uri;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.support.v4.view.MenuItemCompat;
|
||||
import android.support.v7.app.ActionBarActivity;
|
||||
import android.support.v7.view.ActionMode;
|
||||
import android.support.v7.widget.PopupMenu;
|
||||
import android.support.v7.widget.SearchView;
|
||||
import android.text.Html;
|
||||
import android.text.Spanned;
|
||||
import android.view.ContextMenu.ContextMenuInfo;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ExpandableListView;
|
||||
import android.widget.ExpandableListView.ExpandableListContextMenuInfo;
|
||||
import android.widget.Filter;
|
||||
import android.widget.Filterable;
|
||||
import android.widget.ImageButton;
|
||||
|
@ -70,7 +72,7 @@ public class AvailableGPXFragment extends OsmandExpandableListFragment {
|
|||
// public static final int ACTION_ID = 0;
|
||||
// protected static final int DELETE_ACTION_ID = 1;
|
||||
private boolean selectionMode = false;
|
||||
private List<GpxInfo> selectedItems = new ArrayList<>();
|
||||
private List<GpxInfo> selectedItems = new ArrayList<GpxInfo>();
|
||||
private ActionMode actionMode;
|
||||
private LoadGpxTask asyncLoader;
|
||||
private GpxIndexesAdapter listAdapter;
|
||||
|
|
|
@ -111,10 +111,9 @@ public class FavoritesListFragment extends ListFragment implements SearchActivit
|
|||
|
||||
if (!isSelectFavoriteMode()) {
|
||||
FavouritePoint point = favouritesAdapter.getItem(position);
|
||||
String name = getString(R.string.favorite) + ": " + point.getName();
|
||||
LatLon location = new LatLon(point.getLatitude(), point.getLongitude());
|
||||
final PopupMenu optionsMenu = new PopupMenu(getActivity(), v);
|
||||
DirectionsDialogs.createDirectionActionsPopUpMenu(optionsMenu, location, point, name, settings.getLastKnownMapZoom(),
|
||||
DirectionsDialogs.createDirectionActionsPopUpMenu(optionsMenu, location, point, point.getPointDescription(), settings.getLastKnownMapZoom(),
|
||||
getActivity(), true, false);
|
||||
optionsMenu.show();
|
||||
} else {
|
||||
|
@ -171,10 +170,7 @@ public class FavoritesListFragment extends ListFragment implements SearchActivit
|
|||
}
|
||||
|
||||
public String getName(FavouritePoint model){
|
||||
if(Algorithms.isEmpty(model.getCategory())) {
|
||||
return model.getName();
|
||||
}
|
||||
return model.getCategory() + ": " + model.getName();
|
||||
return model.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -24,6 +24,7 @@ import java.util.Set;
|
|||
import net.osmand.access.AccessibleToast;
|
||||
import net.osmand.data.FavouritePoint;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.plus.ContextMenuAdapter;
|
||||
import net.osmand.plus.FavouritesDbHelper;
|
||||
import net.osmand.plus.FavouritesDbHelper.FavoriteGroup;
|
||||
|
@ -167,10 +168,10 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment {
|
|||
qa.setAnchor(v);
|
||||
final OsmandSettings settings = getMyApplication().getSettings();
|
||||
|
||||
String name = getString(R.string.favorite) + ": " + point.getName();
|
||||
LatLon location = new LatLon(point.getLatitude(), point.getLongitude());
|
||||
final PopupMenu optionsMenu = new PopupMenu(getActivity(), v);
|
||||
DirectionsDialogs.createDirectionActionsPopUpMenu(optionsMenu, location, point, name, settings.getLastKnownMapZoom(),
|
||||
DirectionsDialogs.createDirectionActionsPopUpMenu(optionsMenu, location, point,
|
||||
new PointDescription(PointDescription.POINT_TYPE_FAVORITE, point.getName()), settings.getLastKnownMapZoom(),
|
||||
getActivity(), true, false);
|
||||
|
||||
boolean light = getMyApplication().getSettings().isLightContent();
|
||||
|
@ -427,7 +428,7 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment {
|
|||
for(FavouritePoint fp : favoritesSelected) {
|
||||
targetPointsHelper.navigateToPoint(new LatLon(fp.getLatitude(), fp.getLongitude()), false,
|
||||
targetPointsHelper.getIntermediatePoints().size() + 1,
|
||||
getString(R.string.favorite) + ": " + fp.getName());
|
||||
new PointDescription(PointDescription.POINT_TYPE_FAVORITE, fp.getName()));
|
||||
}
|
||||
if(getMyApplication().getRoutingHelper().isRouteCalculated()) {
|
||||
targetPointsHelper.updateRouteAndReferesh(true);
|
||||
|
|
|
@ -143,7 +143,7 @@ public class IntermediatePointsDialog {
|
|||
TargetPoint start ;
|
||||
if(activity instanceof MapActivity) {
|
||||
LatLon ll = new LatLon(((MapActivity) activity).getMapView().getLatitude(), ((MapActivity) activity).getMapView().getLongitude());
|
||||
start = TargetPoint.create(ll, "");
|
||||
start = TargetPoint.create(ll, null);
|
||||
} else {
|
||||
start = lt.get(0);
|
||||
}
|
||||
|
@ -209,7 +209,7 @@ public class IntermediatePointsDialog {
|
|||
} else {
|
||||
nm += app.getString(R.string.destination_point, distString);
|
||||
}
|
||||
String descr = tp.name;
|
||||
String descr = tp.getOnlyName();
|
||||
if(descr != null && descr.trim().length() > 0) {
|
||||
nm += "\n" + descr;
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ import net.osmand.access.AccessibleToast;
|
|||
import net.osmand.access.MapAccessibilityActions;
|
||||
import net.osmand.core.android.AtlasMapRendererView;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.data.QuadPoint;
|
||||
import net.osmand.data.RotatedTileBox;
|
||||
import net.osmand.map.MapTileDownloader.DownloadRequest;
|
||||
|
@ -370,7 +371,7 @@ public class MapActivity extends AccessibleActivity {
|
|||
|
||||
LatLon cur = new LatLon(mapView.getLatitude(), mapView.getLongitude());
|
||||
LatLon latLonToShow = settings.getAndClearMapLocationToShow();
|
||||
String mapLabelToShow = settings.getAndClearMapLabelToShow();
|
||||
PointDescription mapLabelToShow = settings.getAndClearMapLabelToShow();
|
||||
Object toShow = settings.getAndClearObjectToShow();
|
||||
int status = settings.isRouteToPointNavigateAndClear();
|
||||
if(status != 0){
|
||||
|
@ -382,7 +383,8 @@ public class MapActivity extends AccessibleActivity {
|
|||
}
|
||||
if(mapLabelToShow != null && latLonToShow != null){
|
||||
mapLayers.getContextMenuLayer().setSelectedObject(toShow);
|
||||
mapLayers.getContextMenuLayer().setLocation(latLonToShow, mapLabelToShow);
|
||||
mapLayers.getContextMenuLayer().setLocation(latLonToShow, mapLabelToShow.getFullPlainName(this,
|
||||
latLonToShow.getLatitude(), latLonToShow.getLongitude()));
|
||||
}
|
||||
if (latLonToShow != null && !latLonToShow.equals(cur)) {
|
||||
mapView.getAnimatedDraggingThread().startMoving(latLonToShow.getLatitude(), latLonToShow.getLongitude(),
|
||||
|
@ -799,7 +801,8 @@ public class MapActivity extends AccessibleActivity {
|
|||
if (zoom != null) {
|
||||
z = Integer.parseInt(zoom);
|
||||
}
|
||||
settings.setMapLocationToShow(lt, ln, z, getString(R.string.shared_location));
|
||||
settings.setMapLocationToShow(lt, ln, z, new PointDescription(
|
||||
PointDescription.POINT_TYPE_MARKER, getString(R.string.shared_location)));
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ import net.osmand.Location;
|
|||
import net.osmand.access.AccessibleAlertBuilder;
|
||||
import net.osmand.access.AccessibleToast;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.data.QuadRect;
|
||||
import net.osmand.data.RotatedTileBox;
|
||||
import net.osmand.map.ITileSource;
|
||||
|
@ -333,17 +334,18 @@ public class MapActivityActions implements DialogProvider {
|
|||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||
mapActivity.startActivity(intent);
|
||||
} else if (standardId == R.string.context_menu_item_directions_to) {
|
||||
targets.navigateToPoint(new LatLon(latitude, longitude), true, -1, "");
|
||||
targets.navigateToPoint(new LatLon(latitude, longitude), true, -1, null);
|
||||
enterRoutePlanningMode(null, null, false);
|
||||
} else if (standardId == R.string.context_menu_item_directions_from) {
|
||||
String name = mapActivity.getMapLayers().getContextMenuLayer().getSelectedObjectName();
|
||||
enterRoutePlanningMode(new LatLon(latitude, longitude), name, false);
|
||||
List<PointDescription> nms = mapActivity.getMapLayers().getContextMenuLayer().getSelectedObjectNames();
|
||||
enterRoutePlanningMode(new LatLon(latitude, longitude), nms.isEmpty() ? null : nms.get(0), false);
|
||||
} else if (standardId == R.string.context_menu_item_intermediate_point ||
|
||||
standardId == R.string.context_menu_item_destination_point) {
|
||||
boolean dest = standardId == R.string.context_menu_item_destination_point;
|
||||
String selected = mapActivity.getMapLayers().getContextMenuLayer().getSelectedObjectName();
|
||||
List<PointDescription> nms = mapActivity.getMapLayers().getContextMenuLayer().getSelectedObjectNames();
|
||||
targets.navigateToPoint(new LatLon(latitude, longitude), true,
|
||||
dest ? -1 : targets.getIntermediatePoints().size(), dest? "" : selected);
|
||||
dest ? -1 : targets.getIntermediatePoints().size(), nms.size() == 0?null :
|
||||
nms.get(0));
|
||||
if(targets.getIntermediatePoints().size() > 0) {
|
||||
openIntermediatePointsDialog();
|
||||
}
|
||||
|
@ -388,7 +390,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
}
|
||||
}
|
||||
|
||||
public void enterRoutePlanningMode(final LatLon from, final String fromName, boolean useCurrentGPX) {
|
||||
public void enterRoutePlanningMode(final LatLon from, final PointDescription fromName, boolean useCurrentGPX) {
|
||||
List<SelectedGpxFile> selectedGPXFiles = mapActivity.getMyApplication().getSelectedGpxHelper()
|
||||
.getSelectedGPXFiles();
|
||||
final List<GPXFile> gpxFiles = new ArrayList<GPXFile>();
|
||||
|
@ -446,7 +448,7 @@ public class MapActivityActions implements DialogProvider {
|
|||
}
|
||||
}
|
||||
|
||||
private void enterRoutePlanningModeImpl(GPXFile gpxFile, LatLon from, String fromName) {
|
||||
private void enterRoutePlanningModeImpl(GPXFile gpxFile, LatLon from, PointDescription fromName) {
|
||||
|
||||
ApplicationMode mode = settings.DEFAULT_APPLICATION_MODE.get();
|
||||
ApplicationMode selected = settings.APPLICATION_MODE.get();
|
||||
|
@ -549,7 +551,8 @@ public class MapActivityActions implements DialogProvider {
|
|||
switch (id) {
|
||||
case DIALOG_ADD_FAVORITE:
|
||||
FavoriteDialogs.prepareAddFavouriteDialog(mapActivity, dialog, args,
|
||||
args.getDouble(KEY_LATITUDE), args.getDouble(KEY_LONGITUDE),args.getString(KEY_NAME));
|
||||
args.getDouble(KEY_LATITUDE), args.getDouble(KEY_LONGITUDE),
|
||||
new PointDescription(PointDescription.POINT_TYPE_FAVORITE, args.getString(KEY_NAME)));
|
||||
break;
|
||||
case DIALOG_ADD_WAYPOINT:
|
||||
EditText v = (EditText) dialog.getWindow().findViewById(android.R.id.edit);
|
||||
|
|
|
@ -1,14 +1,8 @@
|
|||
package net.osmand.plus.activities;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.DecimalFormatSymbols;
|
||||
import java.util.Locale;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.support.v4.view.MenuItemCompat;
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.TargetPointsHelper;
|
||||
|
@ -20,10 +14,11 @@ import net.osmand.plus.helpers.ScreenOrientationHelper;
|
|||
import net.osmand.util.MapUtils;
|
||||
import android.app.Dialog;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.location.Location;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.support.v4.view.MenuItemCompat;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.util.Log;
|
||||
|
@ -50,7 +45,6 @@ public class NavigatePointFragment extends Fragment implements SearchActivityChi
|
|||
public static final String SEARCH_NORTHING = "NORTHING";
|
||||
public static final String SEARCH_EASTING = "EASTING";
|
||||
public static final String SEARCH_ZONE = "ZONE";
|
||||
private static final int UTM_FORMAT = 3;
|
||||
private static final String SELECTION = "SELECTION";
|
||||
|
||||
|
||||
|
@ -62,12 +56,14 @@ public class NavigatePointFragment extends Fragment implements SearchActivityChi
|
|||
private View view;
|
||||
private LatLon location;
|
||||
|
||||
private OsmandApplication app;
|
||||
|
||||
public View onCreateView(android.view.LayoutInflater inflater, android.view.ViewGroup container, Bundle savedInstanceState) {
|
||||
view = inflater.inflate(R.layout.navigate_point, container, false);
|
||||
setHasOptionsMenu(true);
|
||||
|
||||
location = null;
|
||||
OsmandApplication app = (OsmandApplication) getActivity().getApplication();
|
||||
app = (OsmandApplication) getActivity().getApplication();
|
||||
Intent intent = getActivity().getIntent();
|
||||
if(intent != null){
|
||||
double lat = intent.getDoubleExtra(SEARCH_LAT, 0);
|
||||
|
@ -82,9 +78,10 @@ public class NavigatePointFragment extends Fragment implements SearchActivityChi
|
|||
if (location == null) {
|
||||
location = app.getSettings().getLastKnownMapLocation();
|
||||
}
|
||||
currentFormat = app.getSettings().COORDINATES_FORMAT.get();
|
||||
initUI(location.getLatitude(), location.getLongitude());
|
||||
if(savedInstanceState != null && savedInstanceState.containsKey(SEARCH_LAT) && savedInstanceState.containsKey(SEARCH_LON) &&
|
||||
currentFormat != UTM_FORMAT) {
|
||||
currentFormat != PointDescription.UTM_FORMAT) {
|
||||
String lat = savedInstanceState.getString(SEARCH_LAT);
|
||||
String lon = savedInstanceState.getString(SEARCH_LON);
|
||||
if(lat != null && lon != null && lat.length() > 0 && lon.length() > 0) {
|
||||
|
@ -223,13 +220,13 @@ public class NavigatePointFragment extends Fragment implements SearchActivityChi
|
|||
protected void showCurrentFormat(LatLon l) {
|
||||
final EditText latEdit = ((EditText)view.findViewById(R.id.LatitudeEdit));
|
||||
final EditText lonEdit = ((EditText)view.findViewById(R.id.LongitudeEdit));
|
||||
boolean utm = currentFormat == UTM_FORMAT;
|
||||
boolean utm = currentFormat == PointDescription.UTM_FORMAT;
|
||||
view.findViewById(R.id.easting_row).setVisibility(utm ? View.VISIBLE : View.GONE);
|
||||
view.findViewById(R.id.northing_row).setVisibility(utm ? View.VISIBLE : View.GONE);
|
||||
view.findViewById(R.id.zone_row).setVisibility(utm ? View.VISIBLE : View.GONE);
|
||||
view.findViewById(R.id.lat_row).setVisibility(!utm ? View.VISIBLE : View.GONE);
|
||||
view.findViewById(R.id.lon_row).setVisibility(!utm ? View.VISIBLE : View.GONE);
|
||||
if(currentFormat == UTM_FORMAT) {
|
||||
if(currentFormat == PointDescription.UTM_FORMAT) {
|
||||
final EditText northingEdit = ((EditText)view.findViewById(R.id.NorthingEdit));
|
||||
final EditText eastingEdit = ((EditText)view.findViewById(R.id.EastingEdit));
|
||||
final EditText zoneEdit = ((EditText)view.findViewById(R.id.ZoneEdit));
|
||||
|
@ -238,14 +235,14 @@ public class NavigatePointFragment extends Fragment implements SearchActivityChi
|
|||
northingEdit.setText(((long)pnt.northing)+"");
|
||||
eastingEdit.setText(((long)pnt.easting)+"");
|
||||
} else {
|
||||
latEdit.setText(convert(MapUtils.checkLatitude(l.getLatitude()), currentFormat));
|
||||
lonEdit.setText(convert(MapUtils.checkLongitude(l.getLongitude()), currentFormat));
|
||||
latEdit.setText(PointDescription. convert(MapUtils.checkLatitude(l.getLatitude()), currentFormat));
|
||||
lonEdit.setText(PointDescription. convert(MapUtils.checkLongitude(l.getLongitude()), currentFormat));
|
||||
}
|
||||
}
|
||||
|
||||
protected LatLon parseLocation() {
|
||||
LatLon loc ;
|
||||
if(currentFormat == UTM_FORMAT) {
|
||||
if(currentFormat == PointDescription.UTM_FORMAT) {
|
||||
double northing = Double.parseDouble(((EditText)view.findViewById(R.id.NorthingEdit)).getText().toString());
|
||||
double easting = Double.parseDouble(((EditText)view.findViewById(R.id.EastingEdit)).getText().toString());
|
||||
String zone = ((EditText)view.findViewById(R.id.ZoneEdit)).getText().toString();
|
||||
|
@ -255,15 +252,14 @@ public class NavigatePointFragment extends Fragment implements SearchActivityChi
|
|||
LatLonPoint ll = upoint.toLatLonPoint();
|
||||
loc = new LatLon(ll.getLatitude(), ll.getLongitude());
|
||||
} else {
|
||||
double lat = convert(((EditText) view.findViewById(R.id.LatitudeEdit)).getText().toString());
|
||||
double lon = convert(((EditText) view.findViewById(R.id.LongitudeEdit)).getText().toString());
|
||||
double lat = PointDescription. convert(((EditText) view.findViewById(R.id.LatitudeEdit)).getText().toString());
|
||||
double lon = PointDescription. convert(((EditText) view.findViewById(R.id.LongitudeEdit)).getText().toString());
|
||||
loc = new LatLon(lat, lon);
|
||||
}
|
||||
return loc;
|
||||
}
|
||||
|
||||
public void initUI(double latitude, double longitude){
|
||||
currentFormat = Location.FORMAT_DEGREES;
|
||||
showCurrentFormat(new LatLon(latitude, longitude));
|
||||
final Spinner format = ((Spinner)view.findViewById(R.id.Format));
|
||||
ArrayAdapter<String> adapter = new ArrayAdapter<String>(getActivity(), android.R.layout.simple_spinner_item, new String[] {
|
||||
|
@ -282,17 +278,18 @@ public class NavigatePointFragment extends Fragment implements SearchActivityChi
|
|||
int newFormat = currentFormat;
|
||||
String itm = (String) format.getItemAtPosition(position);
|
||||
if(getString(R.string.navigate_point_format_D).equals(itm)){
|
||||
newFormat = Location.FORMAT_DEGREES;
|
||||
newFormat = PointDescription.FORMAT_DEGREES;
|
||||
} else if(getString(R.string.navigate_point_format_DM).equals(itm)){
|
||||
newFormat = Location.FORMAT_MINUTES;
|
||||
newFormat = PointDescription.FORMAT_MINUTES;
|
||||
} else if(getString(R.string.navigate_point_format_DMS).equals(itm)){
|
||||
newFormat = Location.FORMAT_SECONDS;
|
||||
} else if (position == UTM_FORMAT) {
|
||||
newFormat = UTM_FORMAT;
|
||||
newFormat = PointDescription.FORMAT_SECONDS;
|
||||
} else if (position == PointDescription.UTM_FORMAT) {
|
||||
newFormat = PointDescription.UTM_FORMAT;
|
||||
}
|
||||
try {
|
||||
LatLon loc = parseLocation();
|
||||
currentFormat = newFormat;
|
||||
app.getSettings().COORDINATES_FORMAT.set(currentFormat);
|
||||
view.findViewById(R.id.ValidateTextView).setVisibility(View.INVISIBLE);
|
||||
showCurrentFormat(loc);
|
||||
} catch (RuntimeException e) {
|
||||
|
@ -397,15 +394,15 @@ public class NavigatePointFragment extends Fragment implements SearchActivityChi
|
|||
Bundle b = new Bundle();
|
||||
Dialog dlg = FavoriteDialogs.createAddFavouriteDialog(getActivity(), b);
|
||||
dlg.show();
|
||||
FavoriteDialogs.prepareAddFavouriteDialog(getActivity(), dlg, b, lat, lon, getString(R.string.point_on_map, lat, lon));
|
||||
FavoriteDialogs.prepareAddFavouriteDialog(getActivity(), dlg, b, lat, lon, PointDescription.LOCATION_POINT);
|
||||
} else if (mode == NAVIGATE_TO) {
|
||||
DirectionsDialogs.directionsToDialogAndLaunchMap(getActivity(), lat, lon, getString(R.string.point_on_map, lat, lon));
|
||||
DirectionsDialogs.directionsToDialogAndLaunchMap(getActivity(), lat, lon, PointDescription.LOCATION_POINT);
|
||||
} else if (mode == ADD_WAYPOINT) {
|
||||
DirectionsDialogs.addWaypointDialogAndLaunchMap(getActivity(), lat, lon, getString(R.string.point_on_map, lat, lon));
|
||||
DirectionsDialogs.addWaypointDialogAndLaunchMap(getActivity(), lat, lon, PointDescription.LOCATION_POINT);
|
||||
} else if (mode == SHOW_ON_MAP){
|
||||
OsmandApplication app = (OsmandApplication) getActivity().getApplication();
|
||||
app.getSettings().setMapLocationToShow(lat, lon, Math.max(12, app.getSettings().getLastKnownMapZoom()),
|
||||
getString(R.string.point_on_map, lat, lon));
|
||||
PointDescription.LOCATION_POINT);
|
||||
MapActivity.launchMapActivityMoveToTop(getActivity());
|
||||
}
|
||||
|
||||
|
@ -416,119 +413,4 @@ public class NavigatePointFragment extends Fragment implements SearchActivityChi
|
|||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// THIS code is copied from Location.convert() in order to change locale
|
||||
// and to fix bug in android implementation : doesn't convert if min = 59.23 or sec = 59.32 or deg=179.3
|
||||
public static final int FORMAT_DEGREES = 0;
|
||||
public static final int FORMAT_MINUTES = 1;
|
||||
public static final int FORMAT_SECONDS = 2;
|
||||
private static final char DELIM = ':';
|
||||
|
||||
/**
|
||||
* Converts a String in one of the formats described by
|
||||
* FORMAT_DEGREES, FORMAT_MINUTES, or FORMAT_SECONDS into a
|
||||
* double.
|
||||
*
|
||||
* @throws NullPointerException if coordinate is null
|
||||
* @throws IllegalArgumentException if the coordinate is not
|
||||
* in one of the valid formats.
|
||||
*/
|
||||
public static double convert(String coordinate) {
|
||||
coordinate = coordinate.replace(' ', ':').replace('#', ':').replace(',', '.');
|
||||
if (coordinate == null) {
|
||||
throw new NullPointerException("coordinate");
|
||||
}
|
||||
|
||||
boolean negative = false;
|
||||
if (coordinate.charAt(0) == '-') {
|
||||
coordinate = coordinate.substring(1);
|
||||
negative = true;
|
||||
}
|
||||
|
||||
StringTokenizer st = new StringTokenizer(coordinate, ":");
|
||||
int tokens = st.countTokens();
|
||||
if (tokens < 1) {
|
||||
throw new IllegalArgumentException("coordinate=" + coordinate);
|
||||
}
|
||||
try {
|
||||
String degrees = st.nextToken();
|
||||
double val;
|
||||
if (tokens == 1) {
|
||||
val = Double.parseDouble(degrees);
|
||||
return negative ? -val : val;
|
||||
}
|
||||
|
||||
String minutes = st.nextToken();
|
||||
int deg = Integer.parseInt(degrees);
|
||||
double min;
|
||||
double sec = 0.0;
|
||||
|
||||
if (st.hasMoreTokens()) {
|
||||
min = Integer.parseInt(minutes);
|
||||
String seconds = st.nextToken();
|
||||
sec = Double.parseDouble(seconds);
|
||||
} else {
|
||||
min = Double.parseDouble(minutes);
|
||||
}
|
||||
|
||||
boolean isNegative180 = negative && (deg == 180) &&
|
||||
(min == 0) && (sec == 0);
|
||||
|
||||
// deg must be in [0, 179] except for the case of -180 degrees
|
||||
if ((deg < 0.0) || (deg > 180 && !isNegative180)) {
|
||||
throw new IllegalArgumentException("coordinate=" + coordinate);
|
||||
}
|
||||
if (min < 0 || min > 60d) {
|
||||
throw new IllegalArgumentException("coordinate=" +
|
||||
coordinate);
|
||||
}
|
||||
if (sec < 0 || sec > 60d) {
|
||||
throw new IllegalArgumentException("coordinate=" +
|
||||
coordinate);
|
||||
}
|
||||
|
||||
val = deg*3600.0 + min*60.0 + sec;
|
||||
val /= 3600.0;
|
||||
return negative ? -val : val;
|
||||
} catch (NumberFormatException nfe) {
|
||||
throw new IllegalArgumentException("coordinate=" + coordinate);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static String convert(double coordinate, int outputType) {
|
||||
if (coordinate < -180.0 || coordinate > 180.0 || Double.isNaN(coordinate)) {
|
||||
throw new IllegalArgumentException("coordinate=" + coordinate); //$NON-NLS-1$
|
||||
}
|
||||
if ((outputType != FORMAT_DEGREES) && (outputType != FORMAT_MINUTES) && (outputType != FORMAT_SECONDS)) {
|
||||
throw new IllegalArgumentException("outputType=" + outputType); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
// Handle negative values
|
||||
if (coordinate < 0) {
|
||||
sb.append('-');
|
||||
coordinate = -coordinate;
|
||||
}
|
||||
|
||||
DecimalFormat df = new DecimalFormat("###.#####", new DecimalFormatSymbols(Locale.US)); //$NON-NLS-1$
|
||||
if (outputType == FORMAT_MINUTES || outputType == FORMAT_SECONDS) {
|
||||
int degrees = (int) Math.floor(coordinate);
|
||||
sb.append(degrees);
|
||||
sb.append(DELIM);
|
||||
coordinate -= degrees;
|
||||
coordinate *= 60.0;
|
||||
if (outputType == FORMAT_SECONDS) {
|
||||
int minutes = (int) Math.floor(coordinate);
|
||||
sb.append(minutes);
|
||||
sb.append(DELIM);
|
||||
coordinate -= minutes;
|
||||
coordinate *= 60.0;
|
||||
}
|
||||
}
|
||||
sb.append(df.format(coordinate));
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ import java.util.List;
|
|||
|
||||
import net.osmand.data.FavouritePoint;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.plus.ContextMenuAdapter;
|
||||
import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
|
||||
import net.osmand.plus.FavouritesDbHelper;
|
||||
|
@ -190,7 +191,7 @@ public class SelectedGPXFragment extends OsmandExpandableListFragment {
|
|||
if (resId == R.string.show_gpx_route) {
|
||||
OsmandSettings settings = app.getSettings();
|
||||
settings.setMapLocationToShow(gpxDisplayItem.locationStart.lat, gpxDisplayItem.locationStart.lon,
|
||||
settings.getLastKnownMapZoom(), Html.fromHtml(gpxDisplayItem.name).toString());
|
||||
settings.getLastKnownMapZoom(), new PointDescription(PointDescription.POINT_TYPE_WPT, Html.fromHtml(gpxDisplayItem.name).toString()));
|
||||
MapActivity.launchMapActivityMoveToTop(getMyActivity());
|
||||
}
|
||||
return true;
|
||||
|
@ -609,7 +610,7 @@ public class SelectedGPXFragment extends OsmandExpandableListFragment {
|
|||
child.group.getType() == GpxDisplayItemType.TRACK_ROUTE_POINTS) {
|
||||
ContextMenuAdapter qa = new ContextMenuAdapter(v.getContext());
|
||||
qa.setAnchor(v);
|
||||
String name = app.getString(R.string.favorite) + ": " + child.name;
|
||||
PointDescription name = new PointDescription(PointDescription.POINT_TYPE_FAVORITE, child.name);
|
||||
LatLon location = new LatLon(child.locationStart.lat, child.locationStart.lon);
|
||||
OsmandSettings settings = app.getSettings();
|
||||
final PopupMenu optionsMenu = new PopupMenu(getActivity(), v);
|
||||
|
|
|
@ -16,6 +16,7 @@ import android.view.*;
|
|||
import android.widget.*;
|
||||
import net.osmand.IndexConstants;
|
||||
import net.osmand.Location;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.plus.GPXUtilities;
|
||||
import net.osmand.plus.GPXUtilities.GPXFile;
|
||||
import net.osmand.plus.OsmAndFormatter;
|
||||
|
@ -125,7 +126,9 @@ public class ShowRouteInfoActivity extends OsmandListActivity {
|
|||
MapRouteInfoControl.directionInfo = position - 1;
|
||||
OsmandSettings settings = ((OsmandApplication) getApplication()).getSettings();
|
||||
settings.setMapLocationToShow(loc.getLatitude(),loc.getLongitude(),
|
||||
Math.max(13, settings.getLastKnownMapZoom()), null, item.getDescriptionRoutePart() + " " + getTimeDescription(item), null);
|
||||
Math.max(13, settings.getLastKnownMapZoom()),
|
||||
new PointDescription(PointDescription.POINT_TYPE_MARKER, item.getDescriptionRoutePart() + " " + getTimeDescription(item)),
|
||||
false, null);
|
||||
MapActivity.launchMapActivityMoveToTop(this);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ import net.osmand.data.Amenity;
|
|||
import net.osmand.data.City;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.MapObject;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.data.Street;
|
||||
import net.osmand.plus.OsmAndFormatter;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
|
@ -165,19 +166,20 @@ public class GeoIntentActivity extends OsmandListActivity {
|
|||
} else {
|
||||
distanceLabel.setText(""); //$NON-NLS-1$
|
||||
}
|
||||
label.setText(getString(model));
|
||||
label.setText(getString(model).getFullPlainName(getApplication(), 0, 0));
|
||||
return row;
|
||||
}
|
||||
}
|
||||
|
||||
private String getString(MapObject o) {
|
||||
private PointDescription getString(MapObject o) {
|
||||
if (o instanceof Amenity) {
|
||||
return OsmAndFormatter.getPoiSimpleFormat((Amenity) o, getMyApplication(), false);
|
||||
return new PointDescription(PointDescription.POINT_TYPE_POI,
|
||||
OsmAndFormatter.getPoiSimpleFormat((Amenity) o, getMyApplication(), false));
|
||||
}
|
||||
if (o instanceof Street) {
|
||||
return getString(R.string.address) + " " + ((Street) o).getCity().getName() + " " + o.getName();
|
||||
return new PointDescription(PointDescription.POINT_TYPE_ADDRESS, ((Street) o).getCity().getName() + " " + o.getName());
|
||||
}
|
||||
return getString(R.string.address) + " : " + o.toString();
|
||||
return new PointDescription(PointDescription.POINT_TYPE_ADDRESS, o.toString());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ import android.view.MenuItem;
|
|||
import android.view.MenuItem.OnMenuItemClickListener;
|
||||
import net.osmand.access.AccessibleToast;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
|
@ -290,18 +291,22 @@ public class SearchAddressFragment extends Fragment {
|
|||
}
|
||||
|
||||
public static class AddressInformation {
|
||||
String historyName = null;
|
||||
String objectName = "";
|
||||
String objectType = "";
|
||||
int zoom = 14;
|
||||
public String objectName ="";
|
||||
|
||||
public PointDescription getHistoryName() {
|
||||
return new PointDescription(PointDescription.POINT_TYPE_ADDRESS, objectType, objectName);
|
||||
}
|
||||
|
||||
public static AddressInformation build2StreetIntersection(Context ctx, OsmandSettings settings){
|
||||
AddressInformation ai = new AddressInformation();
|
||||
String postcode = settings.getLastSearchedPostcode();
|
||||
String city = settings.getLastSearchedCityName();
|
||||
String cityName = !Algorithms.isEmpty(postcode) ? postcode : city;
|
||||
ai.objectName = settings.getLastSearchedStreet();
|
||||
ai.historyName = MessageFormat.format(ctx != null ? ctx.getString(R.string.search_history_int_streets) : "", settings.getLastSearchedStreet(),
|
||||
settings.getLastSearchedIntersectedStreet(), cityName);
|
||||
ai.objectName = settings.getLastSearchedStreet() +" x " +
|
||||
settings.getLastSearchedIntersectedStreet() + " " + cityName;
|
||||
ai.objectType = ctx.getString(R.string.search_address_street_option);
|
||||
ai.zoom = 17;
|
||||
return ai;
|
||||
}
|
||||
|
@ -312,8 +317,8 @@ public class SearchAddressFragment extends Fragment {
|
|||
String city = settings.getLastSearchedCityName();
|
||||
String cityName = !Algorithms.isEmpty(postcode) ? postcode : city;
|
||||
String street = settings.getLastSearchedStreet();
|
||||
ai.objectName = street;
|
||||
ai.historyName = MessageFormat.format(ctx != null ? ctx.getString(R.string.search_history_street) : "", street, cityName);
|
||||
ai.objectName = cityName + ", " + street;
|
||||
ai.objectType = ctx.getString(R.string.search_address_street);
|
||||
ai.zoom = 16;
|
||||
return ai;
|
||||
}
|
||||
|
@ -326,9 +331,8 @@ public class SearchAddressFragment extends Fragment {
|
|||
String cityName = !Algorithms.isEmpty(postcode) ? postcode : city;
|
||||
String street = settings.getLastSearchedStreet();
|
||||
String building = settings.getLastSearchedBuilding();
|
||||
ai.objectName = street + " " + building;
|
||||
ai.historyName = MessageFormat.format(ctx != null ? ctx.getString(R.string.search_history_building) : "", building, street,
|
||||
cityName);
|
||||
ai.objectName = cityName+", "+ street + " " + building;
|
||||
ai.objectType = ctx.getString(R.string.search_address_building);;
|
||||
ai.zoom = 17;
|
||||
return ai;
|
||||
}
|
||||
|
@ -336,8 +340,8 @@ public class SearchAddressFragment extends Fragment {
|
|||
public static AddressInformation buildCity(Context ctx, OsmandSettings settings){
|
||||
AddressInformation ai = new AddressInformation();
|
||||
String city = settings.getLastSearchedCityName();
|
||||
ai.historyName = MessageFormat.format(ctx != null ? ctx.getString(R.string.search_history_city) : "", city);
|
||||
ai.objectName = city;
|
||||
ai.objectType = ctx.getString(R.string.search_address_city);
|
||||
ai.zoom = 14;
|
||||
return ai;
|
||||
}
|
||||
|
@ -362,7 +366,8 @@ public class SearchAddressFragment extends Fragment {
|
|||
Bundle b = new Bundle();
|
||||
Dialog dlg = FavoriteDialogs.createAddFavouriteDialog(getActivity(), b);
|
||||
dlg.show();
|
||||
FavoriteDialogs.prepareAddFavouriteDialog(getActivity(), dlg, b, searchPoint.getLatitude(), searchPoint.getLongitude(), ai.objectName);
|
||||
FavoriteDialogs.prepareAddFavouriteDialog(getActivity(), dlg, b, searchPoint.getLatitude(), searchPoint.getLongitude(),
|
||||
ai.getHistoryName());
|
||||
} else if(mode == SELECT_POINT ){
|
||||
Intent intent = getActivity().getIntent();
|
||||
intent.putExtra(SELECT_ADDRESS_POINT_INTENT_KEY, ai.objectName);
|
||||
|
@ -372,11 +377,11 @@ public class SearchAddressFragment extends Fragment {
|
|||
getActivity().finish();
|
||||
} else {
|
||||
if (mode == NAVIGATE_TO) {
|
||||
DirectionsDialogs.directionsToDialogAndLaunchMap(getActivity(), searchPoint.getLatitude(), searchPoint.getLongitude(), ai.historyName);
|
||||
DirectionsDialogs.directionsToDialogAndLaunchMap(getActivity(), searchPoint.getLatitude(), searchPoint.getLongitude(), ai.getHistoryName());
|
||||
} else if (mode == ADD_WAYPOINT) {
|
||||
DirectionsDialogs.addWaypointDialogAndLaunchMap(getActivity(), searchPoint.getLatitude(), searchPoint.getLongitude(), ai.historyName);
|
||||
DirectionsDialogs.addWaypointDialogAndLaunchMap(getActivity(), searchPoint.getLatitude(), searchPoint.getLongitude(), ai.getHistoryName());
|
||||
} else if (mode == SHOW_ON_MAP) {
|
||||
osmandSettings.setMapLocationToShow(searchPoint.getLatitude(), searchPoint.getLongitude(), ai.zoom, ai.historyName);
|
||||
osmandSettings.setMapLocationToShow(searchPoint.getLatitude(), searchPoint.getLongitude(), ai.zoom, ai.getHistoryName());
|
||||
MapActivity.launchMapActivityMoveToTop(getActivity());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,11 @@ import android.view.MenuItem.OnMenuItemClickListener;
|
|||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.access.AccessibleToast;
|
||||
import net.osmand.data.LatLon;
|
||||
<<<<<<< HEAD
|
||||
import net.osmand.osm.io.NetworkUtils;
|
||||
=======
|
||||
import net.osmand.data.PointDescription;
|
||||
>>>>>>> Update recents
|
||||
import net.osmand.plus.ContextMenuAdapter;
|
||||
import net.osmand.plus.OsmAndFormatter;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
|
@ -230,7 +234,7 @@ public class SearchAddressOnlineFragment extends Fragment implements SearchActiv
|
|||
Place item = adapter.getItem(position);
|
||||
final PopupMenu optionsMenu = new PopupMenu(getActivity(), view);
|
||||
DirectionsDialogs.createDirectionsActionsPopUpMenu(optionsMenu, new LatLon(item.lat, item.lon), item,
|
||||
getString(R.string.address) + " : " + item.displayName, Math.max(15, settings.getLastKnownMapZoom()),
|
||||
new PointDescription(PointDescription.POINT_TYPE_ADDRESS, item.displayName), Math.max(15, settings.getLastKnownMapZoom()),
|
||||
getActivity(), true);
|
||||
optionsMenu.show();
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@ import java.util.Comparator;
|
|||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import android.content.pm.ActivityInfo;
|
||||
import android.os.*;
|
||||
import android.support.v4.view.MenuItemCompat;
|
||||
|
@ -22,6 +21,7 @@ import net.osmand.OsmAndCollator;
|
|||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.MapObject;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.plus.OsmAndConstants;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
|
@ -32,9 +32,8 @@ import net.osmand.plus.activities.OsmandListActivity;
|
|||
import net.osmand.plus.activities.search.SearchAddressFragment.AddressInformation;
|
||||
import net.osmand.plus.dialogs.DirectionsDialogs;
|
||||
import net.osmand.plus.dialogs.FavoriteDialogs;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.ActionBar;
|
||||
import android.app.Activity;
|
||||
import android.app.Dialog;
|
||||
|
@ -51,6 +50,7 @@ import android.widget.TextView.BufferType;
|
|||
import android.widget.TextView.OnEditorActionListener;
|
||||
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
public abstract class SearchByNameAbstractActivity<T> extends OsmandListActivity {
|
||||
|
||||
private EditText searchText;
|
||||
|
@ -82,11 +82,15 @@ public abstract class SearchByNameAbstractActivity<T> extends OsmandListActivity
|
|||
|
||||
protected void setActionBarSettings() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
|
||||
getWindow().setUiOptions(ActivityInfo.UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW);
|
||||
separateMethod();
|
||||
}
|
||||
getSupportActionBar().setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
|
||||
getSupportActionBar().setIcon(R.drawable.tab_search_address_icon);
|
||||
}
|
||||
|
||||
private void separateMethod() {
|
||||
getWindow().setUiOptions(ActivityInfo.UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
|
@ -585,16 +589,16 @@ public abstract class SearchByNameAbstractActivity<T> extends OsmandListActivity
|
|||
Dialog dlg = FavoriteDialogs.createAddFavouriteDialog(getActivity(), b);
|
||||
dlg.show();
|
||||
FavoriteDialogs.prepareAddFavouriteDialog(getActivity(), dlg, b, searchPoint.getLatitude(),
|
||||
searchPoint.getLongitude(), ai.objectName);
|
||||
searchPoint.getLongitude(), new PointDescription(PointDescription.POINT_TYPE_ADDRESS, ai.objectName));
|
||||
} else if (mode == NAVIGATE_TO) {
|
||||
DirectionsDialogs.directionsToDialogAndLaunchMap(getActivity(), searchPoint.getLatitude(),
|
||||
searchPoint.getLongitude(), ai.historyName);
|
||||
searchPoint.getLongitude(), ai.getHistoryName());
|
||||
} else if (mode == ADD_WAYPOINT) {
|
||||
DirectionsDialogs.addWaypointDialogAndLaunchMap(getActivity(), searchPoint.getLatitude(),
|
||||
searchPoint.getLongitude(), ai.historyName);
|
||||
searchPoint.getLongitude(), ai.getHistoryName());
|
||||
} else if (mode == SHOW_ON_MAP) {
|
||||
settings.setMapLocationToShow(searchPoint.getLatitude(), searchPoint.getLongitude(), ai.zoom,
|
||||
ai.historyName);
|
||||
ai.getHistoryName());
|
||||
MapActivity.launchMapActivityMoveToTop(getActivity());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,34 +1,34 @@
|
|||
package net.osmand.plus.activities.search;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.List;
|
||||
|
||||
import android.support.v4.app.ListFragment;
|
||||
import android.support.v7.widget.PopupMenu;
|
||||
import android.view.*;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.plus.ContextMenuAdapter;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.plus.OsmAndFormatter;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.helpers.SearchHistoryHelper;
|
||||
import net.osmand.plus.helpers.SearchHistoryHelper.HistoryEntry;
|
||||
import net.osmand.plus.activities.MapActivityActions;
|
||||
import net.osmand.plus.activities.search.SearchActivity.SearchActivityChild;
|
||||
import net.osmand.plus.dialogs.DirectionsDialogs;
|
||||
import net.osmand.plus.helpers.SearchHistoryHelper;
|
||||
import net.osmand.plus.helpers.SearchHistoryHelper.HistoryEntry;
|
||||
import net.osmand.util.MapUtils;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.support.v4.app.ListFragment;
|
||||
import android.support.v7.widget.PopupMenu;
|
||||
import android.text.Spannable;
|
||||
import android.text.style.ForegroundColorSpan;
|
||||
import android.view.View.OnClickListener;
|
||||
import android.widget.AbsListView;
|
||||
import android.widget.ActionMenuView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.Menu;
|
||||
import android.view.MenuInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.TextView.BufferType;
|
||||
|
@ -94,6 +94,8 @@ public class SearchHistoryFragment extends ListFragment implements SearchActivit
|
|||
if (location == null) {
|
||||
location = ((OsmandApplication) activity.getApplication()).getSettings().getLastKnownMapLocation();
|
||||
}
|
||||
historyAdapter.clear();
|
||||
historyAdapter.addAll(helper.getHistoryEntries());
|
||||
locationUpdate(location);
|
||||
clearButton.setVisibility(historyAdapter.isEmpty() ? View.GONE : View.VISIBLE);
|
||||
|
||||
|
@ -115,11 +117,11 @@ public class SearchHistoryFragment extends ListFragment implements SearchActivit
|
|||
}
|
||||
|
||||
private void selectModel(final HistoryEntry model, View v) {
|
||||
String name = model.getName();
|
||||
PointDescription name = model.getName();
|
||||
final PopupMenu optionsMenu = new PopupMenu(getActivity(), v);
|
||||
OsmandSettings settings = ((OsmandApplication) getActivity().getApplication()).getSettings();
|
||||
DirectionsDialogs.createDirectionsActionsPopUpMenu(optionsMenu, new LatLon(model.getLat(), model.getLon()),
|
||||
model, name, settings.getLastKnownMapZoom(), getActivity(), false);
|
||||
model, name, settings.getLastKnownMapZoom(), getActivity(), true);
|
||||
optionsMenu.show();
|
||||
}
|
||||
|
||||
|
@ -150,7 +152,8 @@ public class SearchHistoryFragment extends ListFragment implements SearchActivit
|
|||
int dist = (int) (MapUtils.getDistance(location, model.getLat(), model.getLon()));
|
||||
distance = OsmAndFormatter.getFormattedDistance(dist, (OsmandApplication) getActivity().getApplication()) + " ";
|
||||
}
|
||||
label.setText(distance + model.getName(), BufferType.SPANNABLE);
|
||||
String rnk = MessageFormat.format(" {0,number,#.##E00} ", ((float)model.getRank(System.currentTimeMillis())));
|
||||
label.setText(distance + rnk + model.getName().getName(), BufferType.SPANNABLE);
|
||||
((Spannable) label.getText()).setSpan(new ForegroundColorSpan(getResources().getColor(R.color.color_distance)), 0, distance.length(), 0);
|
||||
icon.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
|
|
@ -20,6 +20,7 @@ import net.osmand.access.AccessibleToast;
|
|||
import net.osmand.access.NavigationInfo;
|
||||
import net.osmand.data.Amenity;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.osm.PoiCategory;
|
||||
import net.osmand.osm.PoiType;
|
||||
import net.osmand.plus.OsmAndConstants;
|
||||
|
@ -560,7 +561,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
|||
public void onItemClick(AdapterView<?> parent,final View view, int position, long id) {
|
||||
final Amenity amenity = ((AmenityAdapter) getListAdapter()).getItem(position);
|
||||
String poiSimpleFormat = OsmAndFormatter.getPoiSimpleFormat(amenity, getMyApplication(), settings.usingEnglishNames());
|
||||
String name = poiSimpleFormat;
|
||||
PointDescription name = new PointDescription(PointDescription.POINT_TYPE_POI, poiSimpleFormat);
|
||||
int z = Math.max(16, settings.getLastKnownMapZoom());
|
||||
final PopupMenu optionsMenu = new PopupMenu(this, view);
|
||||
DirectionsDialogs.createDirectionsActionsPopUpMenu(optionsMenu, amenity.getLocation(), amenity, name, z, this, true);
|
||||
|
|
|
@ -7,6 +7,7 @@ import net.osmand.access.AccessibleAlertBuilder;
|
|||
import net.osmand.access.AccessibleToast;
|
||||
import net.osmand.data.DataTileManager;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.data.QuadRect;
|
||||
import net.osmand.data.RotatedTileBox;
|
||||
import net.osmand.plus.ContextMenuAdapter;
|
||||
|
@ -167,12 +168,12 @@ public class AudioNotesLayer extends OsmandMapLayer implements IContextMenuProvi
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getObjectName(Object o) {
|
||||
public PointDescription getObjectName(Object o) {
|
||||
if(o instanceof Recording){
|
||||
if(((Recording)o).getName() == null) {
|
||||
return view.getResources().getString(R.string.recording_default_name);
|
||||
return new PointDescription(PointDescription.POINT_TYPE_NOTE, view.getResources().getString(R.string.recording_default_name));
|
||||
}
|
||||
return ((Recording)o).getName(); //$NON-NLS-1$
|
||||
return new PointDescription(PointDescription.POINT_TYPE_NOTE, ((Recording)o).getName());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package net.osmand.plus.audionotes;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
|
@ -95,8 +96,9 @@ public class DashAudioVideoNotesFragment extends DashBaseFragment {
|
|||
view.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
getMyApplication().getSettings().setMapLocationToShow(recording.getLatitude(), recording.getLongitude(), 15, null,
|
||||
recording.getName() != null ? recording.getName() : recording.getDescription(getActivity()),
|
||||
getMyApplication().getSettings().setMapLocationToShow(recording.getLatitude(), recording.getLongitude(), 15,
|
||||
new PointDescription(PointDescription.POINT_TYPE_NOTE,
|
||||
recording.getName() != null ? recording.getName() : recording.getDescription(getActivity())), true,
|
||||
recording); //$NON-NLS-1$
|
||||
MapActivity.launchMapActivityMoveToTop(getActivity());
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ import android.widget.ExpandableListView;
|
|||
import android.widget.ImageButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
import net.osmand.plus.R;
|
||||
|
@ -27,7 +27,6 @@ import net.osmand.plus.activities.FavoritesActivity;
|
|||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.audionotes.AudioVideoNotesPlugin.Recording;
|
||||
import net.osmand.plus.dialogs.DirectionsDialogs;
|
||||
|
||||
import android.support.v4.app.ListFragment;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -55,7 +54,7 @@ public class NotesFragment extends ListFragment {
|
|||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
items = new ArrayList<>(plugin.getAllRecordings());
|
||||
items = new ArrayList<Recording>(plugin.getAllRecordings());
|
||||
listAdapter = new NotesAdapter(items);
|
||||
getListView().setAdapter(listAdapter);
|
||||
}
|
||||
|
@ -129,7 +128,8 @@ public class NotesFragment extends ListFragment {
|
|||
}
|
||||
|
||||
private void showOnMap(Recording recording) {
|
||||
getMyApplication().getSettings().setMapLocationToShow(recording.getLatitude(), recording.getLongitude(), 15, null, recording.getName(),
|
||||
getMyApplication().getSettings().setMapLocationToShow(recording.getLatitude(), recording.getLongitude(), 15,
|
||||
new PointDescription(PointDescription.POINT_TYPE_NOTE, recording.getName()), true,
|
||||
recording); //$NON-NLS-1$
|
||||
MapActivity.launchMapActivityMoveToTop(getActivity());
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ import java.util.List;
|
|||
import net.osmand.Location;
|
||||
import net.osmand.data.FavouritePoint;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.plus.FavouritesDbHelper;
|
||||
import net.osmand.plus.OsmAndAppCustomization;
|
||||
import net.osmand.plus.OsmAndFormatter;
|
||||
|
@ -16,20 +17,15 @@ import net.osmand.plus.activities.MapActivity;
|
|||
import net.osmand.plus.base.FavoriteImageDrawable;
|
||||
import net.osmand.plus.dialogs.DirectionsDialogs;
|
||||
import net.osmand.plus.helpers.FontCache;
|
||||
import net.osmand.plus.views.DirectionDrawable;
|
||||
import net.osmand.util.MapUtils;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Typeface;
|
||||
import android.hardware.Sensor;
|
||||
import android.hardware.SensorManager;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
|
@ -152,7 +148,8 @@ public class DashFavoritesFragment extends DashLocationFragment implements Favou
|
|||
view.findViewById(R.id.navigate_to).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
DirectionsDialogs.directionsToDialogAndLaunchMap(getActivity(), point.getLatitude(), point.getLongitude(), point.getName());
|
||||
DirectionsDialogs.directionsToDialogAndLaunchMap(getActivity(), point.getLatitude(), point.getLongitude(),
|
||||
new PointDescription(PointDescription.POINT_TYPE_FAVORITE, point.getName()));
|
||||
}
|
||||
});
|
||||
label.setText(distance, TextView.BufferType.SPANNABLE);
|
||||
|
@ -160,7 +157,8 @@ public class DashFavoritesFragment extends DashLocationFragment implements Favou
|
|||
view.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
getMyApplication().getSettings().setMapLocationToShow(point.getLatitude(), point.getLongitude(), 15, null, point.getName(),
|
||||
getMyApplication().getSettings().setMapLocationToShow(point.getLatitude(), point.getLongitude(), 15,
|
||||
new PointDescription(PointDescription.POINT_TYPE_FAVORITE, point.getName()), true,
|
||||
point); //$NON-NLS-1$
|
||||
MapActivity.launchMapActivityMoveToTop(getActivity());
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package net.osmand.plus.dialogs;
|
||||
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.plus.ContextMenuAdapter;
|
||||
import net.osmand.plus.ContextMenuAdapter.Item;
|
||||
import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
|
||||
|
@ -24,7 +25,7 @@ import java.lang.reflect.Method;
|
|||
|
||||
public class DirectionsDialogs {
|
||||
|
||||
public static void directionsToDialogAndLaunchMap(final Activity act, final double lat, final double lon, final String name) {
|
||||
public static void directionsToDialogAndLaunchMap(final Activity act, final double lat, final double lon, final PointDescription name) {
|
||||
final OsmandApplication ctx = (OsmandApplication) act.getApplication();
|
||||
final TargetPointsHelper targetPointsHelper = ctx.getTargetPointsHelper();
|
||||
if (targetPointsHelper.getIntermediatePoints().size() > 0) {
|
||||
|
@ -52,13 +53,13 @@ public class DirectionsDialogs {
|
|||
}
|
||||
}
|
||||
|
||||
public static void createDirectionsActionsPopUpMenu(final PopupMenu optionsMenu , final LatLon location, final Object obj, final String name,
|
||||
public static void createDirectionsActionsPopUpMenu(final PopupMenu optionsMenu , final LatLon location, final Object obj, final PointDescription name,
|
||||
final int z, final Activity activity, final boolean saveHistory) {
|
||||
createDirectionActionsPopUpMenu(optionsMenu, location, obj, name, z, activity, saveHistory, true);
|
||||
}
|
||||
|
||||
|
||||
public static void createDirectionActionsPopUpMenu(final PopupMenu optionsMenu, final LatLon location, final Object obj, final String name,
|
||||
public static void createDirectionActionsPopUpMenu(final PopupMenu optionsMenu, final LatLon location, final Object obj, final PointDescription name,
|
||||
final int z, final Activity activity, final boolean saveHistory, boolean favorite) {
|
||||
setupPopUpMenuIcon(optionsMenu);
|
||||
final OsmandApplication app = ((OsmandApplication) activity.getApplication());
|
||||
|
@ -100,7 +101,7 @@ public class DirectionsDialogs {
|
|||
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
app.getSettings().setMapLocationToShow(location.getLatitude(), location.getLongitude(), z, saveHistory ? name : null, name,
|
||||
app.getSettings().setMapLocationToShow(location.getLatitude(), location.getLongitude(), z, name, saveHistory,
|
||||
obj); //$NON-NLS-1$
|
||||
MapActivity.launchMapActivityMoveToTop(activity);
|
||||
return true;
|
||||
|
@ -124,7 +125,7 @@ public class DirectionsDialogs {
|
|||
}
|
||||
}
|
||||
|
||||
public static void addWaypointDialogAndLaunchMap(final Activity act, final double lat, final double lon, final String name) {
|
||||
public static void addWaypointDialogAndLaunchMap(final Activity act, final double lat, final double lon, final PointDescription name) {
|
||||
final OsmandApplication ctx = (OsmandApplication) act.getApplication();
|
||||
final TargetPointsHelper targetPointsHelper = ctx.getTargetPointsHelper();
|
||||
if (targetPointsHelper.getPointToNavigate() != null) {
|
||||
|
|
|
@ -11,6 +11,7 @@ import java.util.List;
|
|||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.access.AccessibleToast;
|
||||
import net.osmand.data.FavouritePoint;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.plus.FavouritesDbHelper;
|
||||
import net.osmand.plus.FavouritesDbHelper.FavoriteGroup;
|
||||
import net.osmand.plus.OsmAndFormatter;
|
||||
|
@ -153,9 +154,10 @@ public class FavoriteDialogs {
|
|||
return al;
|
||||
}
|
||||
|
||||
public static void prepareAddFavouriteDialog(Activity activity, Dialog dialog, Bundle args, double lat, double lon, String name) {
|
||||
public static void prepareAddFavouriteDialog(Activity activity, Dialog dialog, Bundle args, double lat, double lon, PointDescription desc) {
|
||||
final Resources resources = activity.getResources();
|
||||
if(name == null) {
|
||||
String name = desc == null ? "" : desc.getName();
|
||||
if(name.length() == 0) {
|
||||
name = resources.getString(R.string.add_favorite_dialog_default_favourite_name);
|
||||
}
|
||||
OsmandApplication app = (OsmandApplication) activity.getApplication();
|
||||
|
|
|
@ -14,6 +14,7 @@ import net.osmand.CallbackWithObject;
|
|||
import net.osmand.IndexConstants;
|
||||
import net.osmand.access.AccessibleToast;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.data.RotatedTileBox;
|
||||
import net.osmand.plus.ApplicationMode;
|
||||
import net.osmand.plus.ContextMenuAdapter;
|
||||
|
@ -611,7 +612,7 @@ public class DistanceCalculatorPlugin extends OsmandPlugin {
|
|||
@Override
|
||||
public String getObjectDescription(Object o) {
|
||||
if(o instanceof WptPt) {
|
||||
String desc = getObjectName(o);
|
||||
PointDescription desc = getObjectName(o);
|
||||
List<String> l = new ArrayList<String>();
|
||||
if(!Double.isNaN(((WptPt) o).ele)) {
|
||||
l.add(app.getString(R.string.plugin_distance_point_ele) + " "+ OsmAndFormatter.getFormattedDistance((float) ((WptPt) o).ele, app));
|
||||
|
@ -628,18 +629,18 @@ public class DistanceCalculatorPlugin extends OsmandPlugin {
|
|||
java.text.DateFormat timeFormat = android.text.format.DateFormat.getTimeFormat(app);
|
||||
l.add(app.getString(R.string.plugin_distance_point_time) + " "+ dateFormat.format(date) + " " + timeFormat.format(date));
|
||||
}
|
||||
return desc + " " + l;
|
||||
return desc.getName() + " " + l;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getObjectName(Object o) {
|
||||
public PointDescription getObjectName(Object o) {
|
||||
if(o instanceof WptPt) {
|
||||
if(((WptPt) o).desc == null) {
|
||||
return app.getString(R.string.plugin_distance_point);
|
||||
return new PointDescription(PointDescription.POINT_TYPE_MARKER, app.getString(R.string.plugin_distance_point));
|
||||
}
|
||||
return ((WptPt) o).desc;
|
||||
return new PointDescription(PointDescription.POINT_TYPE_MARKER, ((WptPt) o).desc );
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -156,7 +156,7 @@ public class DownloadIndexesThread {
|
|||
DownloadEntry item = (DownloadEntry)o;
|
||||
String name = item.item.getBasename();
|
||||
long count = dbHelper.getCount(name, DatabaseHelper.DOWNLOAD_ENTRY) + 1;
|
||||
DatabaseHelper.HistoryEntry entry = new DatabaseHelper.HistoryEntry(name,count);
|
||||
DatabaseHelper.HistoryDownloadEntry entry = new DatabaseHelper.HistoryDownloadEntry(name,count);
|
||||
if (count == 1) {
|
||||
dbHelper.add(entry, DatabaseHelper.DOWNLOAD_ENTRY);
|
||||
} else {
|
||||
|
@ -171,7 +171,7 @@ public class DownloadIndexesThread {
|
|||
IndexItem item = (IndexItem)o;
|
||||
|
||||
long count = dbHelper.getCount(item.getBasename(), DatabaseHelper.DOWNLOAD_ENTRY) + 1;
|
||||
dbHelper.add(new DatabaseHelper.HistoryEntry(item.getBasename(), count), DatabaseHelper.DOWNLOAD_ENTRY);
|
||||
dbHelper.add(new DatabaseHelper.HistoryDownloadEntry(item.getBasename(), count), DatabaseHelper.DOWNLOAD_ENTRY);
|
||||
}
|
||||
} else if (o instanceof String) {
|
||||
String message = (String) o;
|
||||
|
|
|
@ -13,29 +13,24 @@ import java.util.List;
|
|||
public class DatabaseHelper {
|
||||
|
||||
public static final int DOWNLOAD_ENTRY = 0;
|
||||
public static final int FAVORITES_ENTRY = 1;
|
||||
|
||||
private static final String DB_NAME = "usage_history"; //$NON-NLS-1$
|
||||
private static final int DB_VERSION = 1;
|
||||
|
||||
private static final String DOWNLOADS_TABLE_NAME = "downloads"; //$NON-NLS-1$
|
||||
private static final String FAVORITES_TABLE_NAME = "favorites"; //$NON-NLS-1$
|
||||
|
||||
private static final String HISTORY_COL_NAME = "name"; //$NON-NLS-1$
|
||||
private static final String HISTORY_COL_COUNT = "count"; //$NON-NLS-1$
|
||||
private static final String DOWNLOAD_TABLE_CREATE = "CREATE TABLE " + DOWNLOADS_TABLE_NAME + " (" + //$NON-NLS-1$ //$NON-NLS-2$
|
||||
HISTORY_COL_NAME + " TEXT, " + HISTORY_COL_COUNT + " long);"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
||||
private static final String FAVORITES_TABLE_CREATE = "CREATE TABLE " + FAVORITES_TABLE_NAME + " (" + //$NON-NLS-1$ //$NON-NLS-2$
|
||||
HISTORY_COL_NAME + " TEXT, " + HISTORY_COL_COUNT + " long);"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
||||
private OsmandApplication app;
|
||||
|
||||
public static class HistoryEntry {
|
||||
public static class HistoryDownloadEntry {
|
||||
long count;
|
||||
String name;
|
||||
|
||||
public HistoryEntry(String name, long count){
|
||||
public HistoryDownloadEntry(String name, long count){
|
||||
this.count = count;
|
||||
this.name = name;
|
||||
|
||||
|
@ -74,21 +69,18 @@ public class DatabaseHelper {
|
|||
|
||||
public void onCreate(SQLiteAPI.SQLiteConnection db) {
|
||||
db.execSQL(DOWNLOAD_TABLE_CREATE);
|
||||
db.execSQL(FAVORITES_TABLE_CREATE);
|
||||
}
|
||||
|
||||
public void onUpgrade(SQLiteAPI.SQLiteConnection db, int oldVersion, int newVersion) {
|
||||
}
|
||||
|
||||
public boolean remove(HistoryEntry e, int type){
|
||||
public boolean remove(HistoryDownloadEntry e, int type){
|
||||
SQLiteAPI.SQLiteConnection db = openConnection(false);
|
||||
if(db != null){
|
||||
try {
|
||||
switch (type){
|
||||
case DOWNLOAD_ENTRY:
|
||||
db.execSQL("DELETE FROM " + DOWNLOADS_TABLE_NAME + " WHERE " + HISTORY_COL_NAME + " = ?", new Object[] { e.getName() }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
case FAVORITES_ENTRY:
|
||||
db.execSQL("DELETE FROM " + FAVORITES_TABLE_NAME + " WHERE " + HISTORY_COL_NAME + " = ?", new Object[] { e.getName() }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
}
|
||||
} finally {
|
||||
db.close();
|
||||
|
@ -111,15 +103,13 @@ public class DatabaseHelper {
|
|||
return false;
|
||||
}
|
||||
|
||||
public boolean update(HistoryEntry e, int type){
|
||||
public boolean update(HistoryDownloadEntry e, int type){
|
||||
SQLiteAPI.SQLiteConnection db = openConnection(false);
|
||||
if(db != null){
|
||||
try {
|
||||
switch (type) {
|
||||
case DOWNLOAD_ENTRY:
|
||||
db.execSQL("UPDATE " + DOWNLOADS_TABLE_NAME + " SET " + HISTORY_COL_COUNT + " = ? WHERE " + HISTORY_COL_NAME + " = ?", new Object[] { e.getCount(), e.getName() }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
case FAVORITES_ENTRY:
|
||||
db.execSQL("UPDATE " + FAVORITES_TABLE_NAME + " SET " + HISTORY_COL_COUNT + " = ? WHERE " + HISTORY_COL_NAME + " = ?", new Object[] { e.getCount(), e.getName() }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
}
|
||||
} finally {
|
||||
db.close();
|
||||
|
@ -129,15 +119,13 @@ public class DatabaseHelper {
|
|||
return false;
|
||||
}
|
||||
|
||||
public boolean add(HistoryEntry e, int type){
|
||||
public boolean add(HistoryDownloadEntry e, int type){
|
||||
SQLiteAPI.SQLiteConnection db = openConnection(false);
|
||||
if(db != null){
|
||||
try {
|
||||
switch (type) {
|
||||
case DOWNLOAD_ENTRY:
|
||||
db.execSQL("INSERT INTO " + DOWNLOADS_TABLE_NAME + " VALUES (?, ?)", new Object[] { e.getName(), e.getCount()}); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
case FAVORITES_ENTRY:
|
||||
db.execSQL("INSERT INTO " + FAVORITES_TABLE_NAME + " VALUES (?, ?)", new Object[] { e.getName(), e.getCount()}); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
} finally {
|
||||
db.close();
|
||||
|
@ -159,11 +147,6 @@ public class DatabaseHelper {
|
|||
"SELECT " + HISTORY_COL_COUNT + " FROM " + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
DOWNLOADS_TABLE_NAME + " WHERE " + HISTORY_COL_NAME + "='" + name + "'", null); //$NON-NLS-1$//$NON-NLS-2$
|
||||
break;
|
||||
case FAVORITES_ENTRY:
|
||||
query = db.rawQuery(
|
||||
"SELECT " + HISTORY_COL_COUNT + " FROM " + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
FAVORITES_TABLE_NAME + " WHERE " + HISTORY_COL_NAME + "='" + name + "'", null); //$NON-NLS-1$//$NON-NLS-2$
|
||||
break;
|
||||
default:
|
||||
query = null;
|
||||
break;
|
||||
|
@ -182,8 +165,8 @@ public class DatabaseHelper {
|
|||
return count;
|
||||
}
|
||||
|
||||
public List<HistoryEntry> getEntries(int type){
|
||||
List<HistoryEntry> entries = new ArrayList<HistoryEntry>();
|
||||
public List<HistoryDownloadEntry> getEntries(int type){
|
||||
List<HistoryDownloadEntry> entries = new ArrayList<HistoryDownloadEntry>();
|
||||
SQLiteAPI.SQLiteConnection db = openConnection(true);
|
||||
if(db != null){
|
||||
try {
|
||||
|
@ -194,11 +177,6 @@ public class DatabaseHelper {
|
|||
"SELECT " + HISTORY_COL_NAME + " FROM " + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
DOWNLOADS_TABLE_NAME + " ORDER BY " + HISTORY_COL_COUNT + " DESC", null); //$NON-NLS-1$//$NON-NLS-2$
|
||||
break;
|
||||
case FAVORITES_ENTRY:
|
||||
query = db.rawQuery(
|
||||
"SELECT " + HISTORY_COL_NAME + " FROM " + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
FAVORITES_TABLE_NAME + " ORDER BY " + HISTORY_COL_COUNT + " DESC", null); //$NON-NLS-1$//$NON-NLS-2$
|
||||
break;
|
||||
default:
|
||||
query = null; //$NON-NLS-1$//$NON-NLS-2$
|
||||
break;
|
||||
|
@ -206,7 +184,7 @@ public class DatabaseHelper {
|
|||
if (query != null) {
|
||||
if (query.moveToFirst()) {
|
||||
do {
|
||||
HistoryEntry e = new HistoryEntry(
|
||||
HistoryDownloadEntry e = new HistoryDownloadEntry(
|
||||
query.getString(0), query.getInt(1));
|
||||
entries.add(e);
|
||||
} while (query.moveToNext());
|
||||
|
|
|
@ -1,134 +1,269 @@
|
|||
package net.osmand.plus.helpers;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.TreeMap;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.api.SQLiteAPI.SQLiteConnection;
|
||||
import net.osmand.plus.api.SQLiteAPI.SQLiteCursor;
|
||||
import net.osmand.util.Algorithms;
|
||||
|
||||
public class SearchHistoryHelper {
|
||||
|
||||
private static final int HISTORY_LIMIT = 50;
|
||||
private static final int HISTORY_LIMIT = 1500;
|
||||
private OsmandApplication context;
|
||||
private List<HistoryEntry> loadedEntries = null;
|
||||
private Map<PointDescription, HistoryEntry> mp = new HashMap<PointDescription, SearchHistoryHelper.HistoryEntry>();
|
||||
|
||||
public SearchHistoryHelper(OsmandApplication context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
private static SearchHistoryHelper instance = null;
|
||||
public static SearchHistoryHelper getInstance(OsmandApplication context){
|
||||
return new SearchHistoryHelper(context);
|
||||
if(instance == null) {
|
||||
instance = new SearchHistoryHelper(context);
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
|
||||
private static final int[] DEF_INTERVALS_MIN = new int[] {
|
||||
5, 60, 60 * 24, 5 * 60 * 24, 10 * 60 * 24, 30 * 60 * 24
|
||||
};
|
||||
|
||||
private static Comparator<HistoryEntry> historyEntryComparator = new Comparator<HistoryEntry>() {
|
||||
|
||||
@Override
|
||||
public int compare(HistoryEntry lhs, HistoryEntry rhs) {
|
||||
long time = System.currentTimeMillis();
|
||||
double l = lhs.getRank(time);
|
||||
double r = rhs.getRank(time);
|
||||
return -Double.compare(l, r);
|
||||
}
|
||||
};
|
||||
|
||||
public static class HistoryEntry {
|
||||
double lat;
|
||||
double lon;
|
||||
String name;
|
||||
PointDescription name;
|
||||
private long lastAccessedTime;
|
||||
private int[] intervals = new int[0];
|
||||
private double[] intervalValues = new double[0];
|
||||
|
||||
public HistoryEntry(double lat, double lon, String name){
|
||||
public HistoryEntry(double lat, double lon, PointDescription name){
|
||||
this.lat = lat;
|
||||
this.lon = lon;
|
||||
this.name = name;
|
||||
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
private double rankFunction(double cf, double timeDiff) {
|
||||
if(timeDiff <= 0) {
|
||||
return 0;
|
||||
}
|
||||
return cf / timeDiff;
|
||||
}
|
||||
|
||||
public double getRank(long time) {
|
||||
double baseTimeDiff = ((time - lastAccessedTime) / 1000) + 1;
|
||||
double timeDiff = 0;
|
||||
double vl = 1;
|
||||
double rnk = rankFunction(vl, baseTimeDiff + timeDiff);
|
||||
for (int k = 0; k < intervals.length; k++) {
|
||||
double ntimeDiff = intervals[k] * 60 * 1000;
|
||||
double nvl = intervalValues[k];
|
||||
if(ntimeDiff < timeDiff || nvl <= vl){
|
||||
continue;
|
||||
}
|
||||
rnk += rankFunction(nvl - vl, baseTimeDiff + (ntimeDiff - timeDiff) / 2 + timeDiff);
|
||||
vl = nvl - vl;
|
||||
timeDiff = ntimeDiff;
|
||||
}
|
||||
return rnk;
|
||||
}
|
||||
|
||||
public PointDescription getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getSerializedName() {
|
||||
return PointDescription.serializeToString(name);
|
||||
}
|
||||
|
||||
public double getLat() {
|
||||
return lat;
|
||||
}
|
||||
public double getLon() {
|
||||
return lon;
|
||||
}
|
||||
|
||||
public void markAsAccessed(long time) {
|
||||
int[] nintervals = new int[DEF_INTERVALS_MIN.length];
|
||||
double[] nintervalValues = new double[DEF_INTERVALS_MIN.length];
|
||||
for(int k = 0; k < nintervals.length; k++) {
|
||||
nintervals[k] = DEF_INTERVALS_MIN[k];
|
||||
nintervalValues[k] = getUsageLastTime(time, 0, 0, nintervals[k]) + 1;
|
||||
}
|
||||
intervals = nintervals;
|
||||
intervalValues = nintervalValues;
|
||||
this.lastAccessedTime = time;
|
||||
}
|
||||
|
||||
public double getUsageLastTime(long time, int days, int hours, int minutes) {
|
||||
long mins = (minutes + (hours + 24 * days) * 60);
|
||||
long timeInPast = time - mins * 60 * 1000;
|
||||
if (this.lastAccessedTime <= timeInPast) {
|
||||
return 0;
|
||||
}
|
||||
double res = 0;
|
||||
for (int k = 0; k < intervals.length; k++) {
|
||||
long intPast = intervals[k] * 60 * 1000;
|
||||
if (intPast > 0) {
|
||||
double r;
|
||||
if (lastAccessedTime - timeInPast >= intPast) {
|
||||
r = intervalValues[k];
|
||||
} else {
|
||||
r = intervalValues[k] * ((double) lastAccessedTime - timeInPast) / ((double) intPast);
|
||||
}
|
||||
res = Math.max(res, r);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
public void setFrequency(String intervalsString, String values) {
|
||||
if(!Algorithms.isEmpty(intervalsString) && !Algorithms.isEmpty(values)) {
|
||||
markAsAccessed(this.lastAccessedTime);
|
||||
return;
|
||||
}
|
||||
String[] ints = intervalsString.split(",");
|
||||
String[] vsl = values.split(",");
|
||||
intervals = new int[ints.length];
|
||||
intervalValues = new double[ints.length];
|
||||
try {
|
||||
for(int i = 0; i < ints.length && i < vsl.length; i++) {
|
||||
intervals[i] = Integer.parseInt(ints[i]);
|
||||
intervalValues[i] = Double.parseDouble(vsl[i]);
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public long getLastAccessTime() {
|
||||
return lastAccessedTime;
|
||||
}
|
||||
|
||||
public String getIntervalsValues() {
|
||||
StringBuilder s = new StringBuilder();
|
||||
for(int i = 0; i < intervalValues.length; i++) {
|
||||
if(i > 0) {
|
||||
s.append(",");
|
||||
}
|
||||
s.append(intervalValues[i]);
|
||||
}
|
||||
return s.toString();
|
||||
}
|
||||
|
||||
public String getIntervals() {
|
||||
StringBuilder s = new StringBuilder();
|
||||
for(int i = 0; i < intervals.length; i++) {
|
||||
if(i > 0) {
|
||||
s.append(",");
|
||||
}
|
||||
s.append(intervals[i]);
|
||||
}
|
||||
return s.toString();
|
||||
}
|
||||
|
||||
public void setLastAccessTime(long time) {
|
||||
this.lastAccessedTime = time;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public List<HistoryEntry> getHistoryEntries() {
|
||||
if(loadedEntries == null){
|
||||
checkLoadedEntries();
|
||||
}
|
||||
return loadedEntries;
|
||||
return new ArrayList<SearchHistoryHelper.HistoryEntry>(loadedEntries);
|
||||
}
|
||||
|
||||
private HistoryItemDBHelper checkLoadedEntries(){
|
||||
private HistoryItemDBHelper checkLoadedEntries() {
|
||||
HistoryItemDBHelper helper = new HistoryItemDBHelper();
|
||||
if(loadedEntries == null){
|
||||
if (loadedEntries == null) {
|
||||
loadedEntries = helper.getEntries();
|
||||
Collections.sort(loadedEntries, historyEntryComparator);
|
||||
for(HistoryEntry he : loadedEntries) {
|
||||
mp.put(he.getName(), he);
|
||||
}
|
||||
}
|
||||
return helper;
|
||||
}
|
||||
|
||||
public void remove(HistoryEntry model) {
|
||||
HistoryItemDBHelper helper = checkLoadedEntries();
|
||||
if(helper.remove(model)){
|
||||
if (helper.remove(model)) {
|
||||
loadedEntries.remove(model);
|
||||
mp.remove(model.getName());
|
||||
}
|
||||
}
|
||||
|
||||
public void removeAll() {
|
||||
HistoryItemDBHelper helper = checkLoadedEntries();
|
||||
if(helper.removeAll()){
|
||||
if (helper.removeAll()) {
|
||||
loadedEntries.clear();
|
||||
mp.clear();
|
||||
}
|
||||
}
|
||||
|
||||
public void selectEntry(HistoryEntry model) {
|
||||
public void addNewItemToHistory(HistoryEntry model) {
|
||||
HistoryItemDBHelper helper = checkLoadedEntries();
|
||||
int i = loadedEntries.indexOf(model);
|
||||
updateModelAt(model, helper, i);
|
||||
}
|
||||
|
||||
private void updateModelAt(HistoryEntry model, HistoryItemDBHelper helper, int i) {
|
||||
if(i == -1){
|
||||
if(helper.add(model)){
|
||||
loadedEntries.add(0, model);
|
||||
if(loadedEntries.size() > HISTORY_LIMIT){
|
||||
if(helper.remove(loadedEntries.get(loadedEntries.size() - 1))){
|
||||
loadedEntries.remove(loadedEntries.size() - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
if(mp.containsKey(model.getName())) {
|
||||
model = mp.get(model.getName());
|
||||
model.markAsAccessed(System.currentTimeMillis());
|
||||
helper.update(model);
|
||||
} else {
|
||||
if(helper.update(model)){
|
||||
loadedEntries.remove(i);
|
||||
loadedEntries.add(0, model);
|
||||
loadedEntries.add(model);
|
||||
mp.put(model.getName(), model);
|
||||
model.markAsAccessed(System.currentTimeMillis());
|
||||
helper.add(model);
|
||||
}
|
||||
Collections.sort(loadedEntries, historyEntryComparator);
|
||||
if(loadedEntries.size() > HISTORY_LIMIT){
|
||||
if(helper.remove(loadedEntries.get(loadedEntries.size() - 1))){
|
||||
loadedEntries.remove(loadedEntries.size() - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public HistoryEntry addNewItemToHistory(double lat, double lon, String description){
|
||||
HistoryItemDBHelper helper = checkLoadedEntries();
|
||||
int i = 0;
|
||||
HistoryEntry model = new HistoryEntry(lat, lon, description);
|
||||
for(HistoryEntry e : loadedEntries){
|
||||
if(description.equals(e.getName())){
|
||||
break;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if(i == loadedEntries.size()){
|
||||
i = -1;
|
||||
}
|
||||
if (i != 0) {
|
||||
updateModelAt(model, helper, i);
|
||||
}
|
||||
return model;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private class HistoryItemDBHelper {
|
||||
|
||||
private static final String DB_NAME = "search_history"; //$NON-NLS-1$
|
||||
private static final int DB_VERSION = 1;
|
||||
private static final String HISTORY_TABLE_NAME = "history"; //$NON-NLS-1$
|
||||
private static final int DB_VERSION = 2;
|
||||
private static final String HISTORY_TABLE_NAME = "history_recents"; //$NON-NLS-1$
|
||||
private static final String HISTORY_COL_NAME = "name"; //$NON-NLS-1$
|
||||
private static final String HISTORY_COL_TIME = "time"; //$NON-NLS-1$
|
||||
private static final String HISTORY_COL_TYPE = "type"; //$NON-NLS-1$
|
||||
private static final String HISTORY_COL_FREQ_INTERVALS = "freq_intervals"; //$NON-NLS-1$
|
||||
private static final String HISTORY_COL_FREQ_VALUES = "freq_values"; //$NON-NLS-1$
|
||||
private static final String HISTORY_COL_LAT = "latitude"; //$NON-NLS-1$
|
||||
private static final String HISTORY_COL_LON = "longitude"; //$NON-NLS-1$
|
||||
private static final String HISTORY_TABLE_CREATE = "CREATE TABLE " + HISTORY_TABLE_NAME + " (" + //$NON-NLS-1$ //$NON-NLS-2$
|
||||
HISTORY_COL_NAME + " TEXT, " + HISTORY_COL_TIME + " long, " + HISTORY_COL_TYPE + " TEXT, " + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
private static final String HISTORY_TABLE_CREATE = "CREATE TABLE IF NOT EXISTS " + HISTORY_TABLE_NAME + " (" + //$NON-NLS-1$ //$NON-NLS-2$
|
||||
HISTORY_COL_NAME + " TEXT, " +
|
||||
HISTORY_COL_TIME + " long, " +
|
||||
HISTORY_COL_FREQ_INTERVALS + " TEXT, " +
|
||||
HISTORY_COL_FREQ_VALUES + " TEXT, " +
|
||||
HISTORY_COL_LAT + " double, " +HISTORY_COL_LON + " double);"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
||||
|
||||
|
@ -158,13 +293,19 @@ public class SearchHistoryHelper {
|
|||
}
|
||||
|
||||
public void onUpgrade(SQLiteConnection db, int oldVersion, int newVersion) {
|
||||
if(newVersion == 2) {
|
||||
db.execSQL(HISTORY_TABLE_CREATE);
|
||||
for(HistoryEntry he : getLegacyEntries(db)) {
|
||||
insert(he, db);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean remove(HistoryEntry e){
|
||||
SQLiteConnection db = openConnection(false);
|
||||
if(db != null){
|
||||
try {
|
||||
db.execSQL("DELETE FROM " + HISTORY_TABLE_NAME + " WHERE " + HISTORY_COL_NAME + " = ?", new Object[] { e.getName() }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
removeQuery(e.getSerializedName(), db);
|
||||
} finally {
|
||||
db.close();
|
||||
}
|
||||
|
@ -172,6 +313,11 @@ public class SearchHistoryHelper {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void removeQuery(String name, SQLiteConnection db) {
|
||||
db.execSQL("DELETE FROM " + HISTORY_TABLE_NAME + " WHERE " + HISTORY_COL_NAME + " = ?",
|
||||
new Object[] { name }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
}
|
||||
|
||||
public boolean removeAll(){
|
||||
SQLiteConnection db = openConnection(false);
|
||||
|
@ -191,7 +337,9 @@ public class SearchHistoryHelper {
|
|||
if(db != null){
|
||||
try {
|
||||
db.execSQL(
|
||||
"UPDATE " + HISTORY_TABLE_NAME + " SET time = ? WHERE " + HISTORY_COL_NAME + " = ?", new Object[] { System.currentTimeMillis(), e.getName() }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
"UPDATE " + HISTORY_TABLE_NAME + " SET time = ? and freq_intervals = ? and freq_values = ? WHERE " + HISTORY_COL_NAME + " = ?",
|
||||
new Object[] { e.getLastAccessTime(), e.getIntervals(), e.getIntervalsValues(),
|
||||
e.getSerializedName() }); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
} finally {
|
||||
db.close();
|
||||
}
|
||||
|
@ -204,28 +352,88 @@ public class SearchHistoryHelper {
|
|||
SQLiteConnection db = openConnection(false);
|
||||
if(db != null){
|
||||
try {
|
||||
db.execSQL(
|
||||
"INSERT INTO " + HISTORY_TABLE_NAME + " VALUES (?, ?, ?, ?, ?)", new Object[] { e.getName(), System.currentTimeMillis(), null, e.getLat(), e.getLon() }); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
insert(e, db);
|
||||
} finally {
|
||||
db.close();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void insert(HistoryEntry e, SQLiteConnection db) {
|
||||
db.execSQL(
|
||||
"INSERT INTO " + HISTORY_TABLE_NAME + " VALUES (?, ?, ?, ?, ?, ?)",
|
||||
new Object[] { e.getSerializedName(), e.getLastAccessTime(),
|
||||
e.getIntervals(), e.getIntervalsValues(), e.getLat(), e.getLon() }); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
|
||||
public List<HistoryEntry> getLegacyEntries(SQLiteConnection db){
|
||||
List<HistoryEntry> entries = new ArrayList<HistoryEntry>();
|
||||
if (db != null) {
|
||||
// LEGACY QUERY !!
|
||||
SQLiteCursor query = db.rawQuery(
|
||||
"SELECT name, latitude, longitude, time FROM history ORDER BY time DESC", null); //$NON-NLS-1$//$NON-NLS-2$
|
||||
if (query.moveToFirst()) {
|
||||
do {
|
||||
String name = query.getString(0);
|
||||
String type = PointDescription.POINT_TYPE_MARKER;
|
||||
// make it proper name with type
|
||||
if (name.contains(context.getString(R.string.favorite))) {
|
||||
type = PointDescription.POINT_TYPE_FAVORITE;
|
||||
} else if (name.contains(context.getString(R.string.search_address_building))) {
|
||||
type = PointDescription.POINT_TYPE_ADDRESS;
|
||||
} else if (name.contains(context.getString(R.string.search_address_city))) {
|
||||
type = PointDescription.POINT_TYPE_ADDRESS;
|
||||
} else if (name.contains(context.getString(R.string.search_address_street))) {
|
||||
type = PointDescription.POINT_TYPE_ADDRESS;
|
||||
} else if (name.contains(context.getString(R.string.search_address_street_option))) {
|
||||
type = PointDescription.POINT_TYPE_ADDRESS;
|
||||
} else if (name.contains(context.getString(R.string.poi))) {
|
||||
type = PointDescription.POINT_TYPE_POI;
|
||||
}
|
||||
if (name.contains(":")) {
|
||||
name = name.substring(name.indexOf(':') + 1);
|
||||
}
|
||||
HistoryEntry e = new HistoryEntry(query.getDouble(1), query.getDouble(2), new PointDescription(
|
||||
type, name));
|
||||
e.markAsAccessed(query.getLong(3));
|
||||
entries.add(e);
|
||||
} while (query.moveToNext());
|
||||
}
|
||||
query.close();
|
||||
}
|
||||
return entries;
|
||||
}
|
||||
|
||||
public List<HistoryEntry> getEntries(){
|
||||
List<HistoryEntry> entries = new ArrayList<HistoryEntry>();
|
||||
SQLiteConnection db = openConnection(true);
|
||||
if(db != null){
|
||||
try {
|
||||
SQLiteCursor query = db.rawQuery(
|
||||
"SELECT " + HISTORY_COL_NAME + ", " + HISTORY_COL_LAT + "," + HISTORY_COL_LON + " FROM " + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
HISTORY_TABLE_NAME + " ORDER BY " + HISTORY_COL_TIME + " DESC", null); //$NON-NLS-1$//$NON-NLS-2$
|
||||
"SELECT " + HISTORY_COL_NAME + ", " + HISTORY_COL_LAT + "," + HISTORY_COL_LON +", " +
|
||||
HISTORY_COL_TIME + ", " + HISTORY_COL_FREQ_INTERVALS + ", " + HISTORY_COL_FREQ_VALUES +
|
||||
" FROM " + HISTORY_TABLE_NAME , null); //$NON-NLS-1$//$NON-NLS-2$
|
||||
Map<String, HistoryEntry> st = new TreeMap<String, HistoryEntry>();
|
||||
if (query.moveToFirst()) {
|
||||
do {
|
||||
HistoryEntry e = new HistoryEntry(query.getDouble(1), query.getDouble(2), query.getString(0));
|
||||
String name = query.getString(0);
|
||||
HistoryEntry prev = st.get(name);
|
||||
HistoryEntry e = new HistoryEntry(query.getDouble(1), query.getDouble(2),
|
||||
PointDescription.deserializeFromString(name));
|
||||
long time = query.getLong(3);
|
||||
e.setLastAccessTime(time);
|
||||
e.setFrequency(query.getString(4), query.getString(5));
|
||||
if(prev != null) {
|
||||
entries.remove(prev);
|
||||
}
|
||||
if(prev != null || !Algorithms.objectEquals(name, e.getSerializedName())) {
|
||||
removeQuery(name, db);
|
||||
insert(e, db);
|
||||
}
|
||||
entries.add(e);
|
||||
st.put(name, e);
|
||||
} while (query.moveToNext());
|
||||
}
|
||||
query.close();
|
||||
|
@ -237,6 +445,11 @@ public class SearchHistoryHelper {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
public void addNewItemToHistory(double latitude, double longitude, PointDescription pointDescription) {
|
||||
addNewItemToHistory(new HistoryEntry(latitude, longitude, pointDescription));
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ import java.util.List;
|
|||
import net.osmand.Location;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.LocationPoint;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.plus.OsmAndFormatter;
|
||||
import net.osmand.plus.OsmAndLocationProvider.OsmAndLocationListener;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
|
@ -164,7 +165,7 @@ public class WaypointDialogHelper implements OsmAndLocationListener {
|
|||
} else {
|
||||
textDist.setText("");
|
||||
}
|
||||
text.setText(point.getName(app));
|
||||
text.setText(PointDescription.getSimpleName(point, app));
|
||||
// ((Spannable) text.getText()).setSpan(
|
||||
// new ForegroundColorSpan(ctx.getResources().getColor(R.color.color_distance)), 0, distance.length() - 1,
|
||||
// 0);
|
||||
|
@ -687,7 +688,7 @@ public class WaypointDialogHelper implements OsmAndLocationListener {
|
|||
ctx.getMapLayers()
|
||||
.getContextMenuLayer()
|
||||
.setLocation(new LatLon(locationPoint.getLatitude(), locationPoint.getLongitude()),
|
||||
locationPoint.getName(ctx));
|
||||
PointDescription.getSimpleName(locationPoint, ctx));
|
||||
dialog.dismiss();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ import net.osmand.binary.BinaryMapRouteReaderAdapter.RouteRegion;
|
|||
import net.osmand.binary.BinaryMapRouteReaderAdapter.RouteTypeRule;
|
||||
import net.osmand.binary.RouteDataObject;
|
||||
import net.osmand.data.Amenity;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.data.Amenity.AmenityRoutePoint;
|
||||
import net.osmand.data.LocationPoint;
|
||||
import net.osmand.osm.PoiType;
|
||||
|
@ -783,9 +784,10 @@ public class WaypointHelper {
|
|||
return a.getLocation().getLongitude();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getName(Context ctx) {
|
||||
return OsmAndFormatter.getPoiSimpleFormat(a, ctx, app.getSettings().usingEnglishNames());
|
||||
public PointDescription getPointDescription(Context ctx) {
|
||||
return new PointDescription(PointDescription.POINT_TYPE_POI, OsmAndFormatter.getPoiSimpleFormat(a, ctx, app.getSettings().usingEnglishNames()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -14,6 +14,7 @@ import net.osmand.AndroidUtils;
|
|||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.access.AccessibleToast;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.data.QuadRect;
|
||||
import net.osmand.data.RotatedTileBox;
|
||||
import net.osmand.osm.io.NetworkUtils;
|
||||
|
@ -523,9 +524,9 @@ public class OsmBugsLayer extends OsmandMapLayer implements IContextMenuProvider
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getObjectName(Object o) {
|
||||
public PointDescription getObjectName(Object o) {
|
||||
if(o instanceof OpenStreetNote){
|
||||
return ((OpenStreetNote)o).getCommentDescription();
|
||||
return new PointDescription(PointDescription.POINT_TYPE_OSM_NOTE, ((OpenStreetNote)o).getCommentDescription());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import java.util.List;
|
|||
|
||||
import net.osmand.Location;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.plus.NavigationService;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.TargetPointsHelper;
|
||||
|
@ -92,7 +93,7 @@ public class OsMoControlDevice implements OsMoReactor {
|
|||
robj.put("version", Version.getAppVersion(app));
|
||||
TargetPointsHelper tg = app.getTargetPointsHelper();
|
||||
if(tg.getPointToNavigate() != null) {
|
||||
addPoint(robj, "target_", tg.getPointToNavigate().point, tg.getPointToNavigate().name);
|
||||
addPoint(robj, "target_", tg.getPointToNavigate().point, tg.getPointToNavigate().getOriginalPointDescription());
|
||||
}
|
||||
List<TargetPoint> intermediatePoints = tg.getIntermediatePoints();
|
||||
if (intermediatePoints.size() > 0) {
|
||||
|
@ -101,7 +102,7 @@ public class OsMoControlDevice implements OsMoReactor {
|
|||
for (int i = 0; i < intermediatePoints.size(); i++) {
|
||||
JSONObject js = new JSONObject();
|
||||
ar.put(js);
|
||||
addPoint(js, "", intermediatePoints.get(i).point, intermediatePoints.get(i).name);
|
||||
addPoint(js, "", intermediatePoints.get(i).point, intermediatePoints.get(i).getOriginalPointDescription());
|
||||
}
|
||||
}
|
||||
service.pushCommand("OSMAND_INFO|"+robj.toString());
|
||||
|
@ -118,11 +119,11 @@ public class OsMoControlDevice implements OsMoReactor {
|
|||
return false;
|
||||
}
|
||||
|
||||
private void addPoint(JSONObject robj, String prefix, LatLon pointToNavigate, String pointNavigateDescription) throws JSONException {
|
||||
private void addPoint(JSONObject robj, String prefix, LatLon pointToNavigate, PointDescription pointNavigateDescription) throws JSONException {
|
||||
robj.put(prefix+"lat", pointToNavigate.getLatitude());
|
||||
robj.put(prefix+"lon", pointToNavigate.getLongitude());
|
||||
if(pointNavigateDescription != null) {
|
||||
robj.put(prefix+"name", pointNavigateDescription);
|
||||
robj.put(prefix+"name", pointNavigateDescription.getName());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ import android.support.v4.view.MenuItemCompat;
|
|||
import android.support.v7.view.ActionMode;
|
||||
import android.view.*;
|
||||
import gnu.trove.list.array.TIntArrayList;
|
||||
|
||||
import java.text.Collator;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
@ -17,10 +18,12 @@ import java.util.Date;
|
|||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.Location;
|
||||
import net.osmand.access.AccessibleToast;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.plus.NavigationService;
|
||||
import net.osmand.plus.OsmAndConstants;
|
||||
import net.osmand.plus.OsmAndFormatter;
|
||||
|
@ -528,7 +531,8 @@ public class OsMoGroupsActivity extends OsmandExpandableListActivity implements
|
|||
MapActivity.getSingleMapViewTrackingUtilities().setMapLinkedToLocation(false);
|
||||
if (location != null) {
|
||||
app.getSettings().setMapLocationToShow(location.getLatitude(), location.getLongitude(), app.getSettings().getLastKnownMapZoom(),
|
||||
null, device.getVisibleName(), device);
|
||||
new PointDescription(PointDescription.POINT_TYPE_MARKER, device.getVisibleName()), false,
|
||||
device);
|
||||
}
|
||||
OsMoPositionLayer.setFollowTrackerId(device);
|
||||
MapActivity.launchMapActivityMoveToTop(OsMoGroupsActivity.this);
|
||||
|
|
|
@ -9,6 +9,7 @@ import java.util.concurrent.ConcurrentLinkedQueue;
|
|||
import net.osmand.Location;
|
||||
import net.osmand.access.AccessibleToast;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.data.RotatedTileBox;
|
||||
import net.osmand.plus.OsmAndFormatter;
|
||||
import net.osmand.plus.R;
|
||||
|
@ -246,11 +247,12 @@ public class OsMoPositionLayer extends OsmandMapLayer implements ContextMenuLaye
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getObjectName(Object o) {
|
||||
public PointDescription getObjectName(Object o) {
|
||||
// if(o instanceof OsMoDevice) {
|
||||
// return map.getString(R.string.osmo_user_name) + " " + ((OsMoDevice) o).getVisibleName();
|
||||
// }
|
||||
return getObjectDescription(o);
|
||||
String desc = getObjectDescription(o);
|
||||
return desc == null ? null : new PointDescription(PointDescription.POINT_TYPE_MARKER, desc);
|
||||
}
|
||||
|
||||
public void refresh() {
|
||||
|
|
|
@ -5,6 +5,7 @@ import java.util.List;
|
|||
|
||||
import net.osmand.access.AccessibleToast;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.data.RotatedTileBox;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
|
@ -177,8 +178,9 @@ public class ParkingPositionLayer extends OsmandMapLayer implements ContextMenuL
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getObjectName(Object o) {
|
||||
return view.getContext().getString(R.string.osmand_parking_position_name);
|
||||
public PointDescription getObjectName(Object o) {
|
||||
return new PointDescription(PointDescription.POINT_TYPE_MARKER,
|
||||
view.getContext().getString(R.string.osmand_parking_position_name), "");
|
||||
}
|
||||
|
||||
public void refresh() {
|
||||
|
|
|
@ -5,6 +5,7 @@ import android.graphics.PointF;
|
|||
import android.os.AsyncTask;
|
||||
import android.widget.ArrayAdapter;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.data.RotatedTileBox;
|
||||
import net.osmand.plus.ContextMenuAdapter;
|
||||
import net.osmand.plus.GPXUtilities;
|
||||
|
@ -45,7 +46,7 @@ public class RoutePointsLayer extends OsmandMapLayer implements ContextMenuLaye
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getObjectName(Object o) {
|
||||
public PointDescription getObjectName(Object o) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,21 +1,25 @@
|
|||
package net.osmand.plus.routepointsnavigation;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.widget.Button;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.TextView;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.plus.*;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.plus.ApplicationMode;
|
||||
import net.osmand.plus.GPXUtilities;
|
||||
import net.osmand.plus.GPXUtilities.GPXFile;
|
||||
import net.osmand.plus.GPXUtilities.Route;
|
||||
import net.osmand.plus.GPXUtilities.WptPt;
|
||||
import net.osmand.plus.OsmAndFormatter;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.TargetPointsHelper;
|
||||
import net.osmand.plus.TargetPointsHelper.TargetPoint;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.views.MapInfoLayer;
|
||||
|
@ -24,10 +28,18 @@ import net.osmand.plus.views.OsmandMapTileView;
|
|||
import net.osmand.plus.views.mapwidgets.TextInfoWidget;
|
||||
import net.osmand.util.Algorithms;
|
||||
import net.osmand.util.MapUtils;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Paint;
|
||||
import android.os.AsyncTask;
|
||||
import android.text.format.DateFormat;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
/**
|
||||
* Created by Barsik on 10.06.2014.
|
||||
|
@ -261,7 +273,7 @@ public class RoutePointsPlugin extends OsmandPlugin {
|
|||
public UUID id;
|
||||
|
||||
public String getName() {
|
||||
return wpt.name;
|
||||
return wpt.name == null ? "" : wpt.name;
|
||||
}
|
||||
|
||||
public WptPt getWpt() {
|
||||
|
@ -401,7 +413,8 @@ public class RoutePointsPlugin extends OsmandPlugin {
|
|||
|
||||
RoutePoint first = currentPoints.get(0);
|
||||
if (!first.isVisited()) {
|
||||
app.getTargetPointsHelper().navigateToPoint(first.getPoint(), true, -1, first.getName());
|
||||
app.getTargetPointsHelper().navigateToPoint(first.getPoint(), true, -1,
|
||||
new PointDescription(PointDescription.POINT_TYPE_WPT, first.getName()));
|
||||
first.isNextNavigate = true;
|
||||
return true;
|
||||
} else {
|
||||
|
@ -445,7 +458,7 @@ public class RoutePointsPlugin extends OsmandPlugin {
|
|||
if (rt != null) {
|
||||
TargetPointsHelper targetPointsHelper = app.getTargetPointsHelper();
|
||||
TargetPoint pointToNavigate = targetPointsHelper.getPointToNavigate();
|
||||
String locName = pointToNavigate == null ? null : pointToNavigate.name;
|
||||
String locName = pointToNavigate == null ? null : pointToNavigate.getOnlyName();
|
||||
for (int i = 0; i < rt.points.size(); i++) {
|
||||
WptPt wptPt = rt.points.get(i);
|
||||
RoutePoint rtp = new RoutePoint(wptPt);
|
||||
|
@ -473,7 +486,8 @@ public class RoutePointsPlugin extends OsmandPlugin {
|
|||
}
|
||||
rp.isNextNavigate = true;
|
||||
sortPoints();
|
||||
app.getTargetPointsHelper().navigateToPoint(rp.getPoint(), true, -1, rp.getName());
|
||||
app.getTargetPointsHelper().navigateToPoint(rp.getPoint(), true, -1,
|
||||
new PointDescription(PointDescription.POINT_TYPE_WPT, rp.getName()));
|
||||
}
|
||||
|
||||
public void updateCurrentTargetPoint() {
|
||||
|
@ -481,11 +495,8 @@ public class RoutePointsPlugin extends OsmandPlugin {
|
|||
TargetPoint tp = targetPointsHelper.getPointToNavigate();
|
||||
for (int i = 0; i < currentPoints.size(); i++) {
|
||||
RoutePoint rtp = currentPoints.get(i);
|
||||
rtp.isNextNavigate = rtp.visitedTime == 0 && tp != null && !Algorithms.isEmpty(tp.name) && tp.name.equals(rtp.getName());
|
||||
if (rtp.isNextNavigate) {
|
||||
tp.name = "";
|
||||
}
|
||||
|
||||
rtp.isNextNavigate = rtp.visitedTime == 0 && tp != null && !Algorithms.isEmpty(tp.getOnlyName()) &&
|
||||
tp.getOnlyName().equals(rtp.getName());
|
||||
}
|
||||
sortPoints();
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import android.content.Context;
|
|||
import net.osmand.Location;
|
||||
import net.osmand.binary.BinaryMapRouteReaderAdapter.RouteTypeRule;
|
||||
import net.osmand.data.LocationPoint;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.plus.R;
|
||||
|
||||
public class AlarmInfo implements LocationPoint {
|
||||
|
@ -146,10 +147,10 @@ public class AlarmInfo implements LocationPoint {
|
|||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getName(Context ctx) {
|
||||
return type.getVisualName(ctx);
|
||||
public PointDescription getPointDescription(Context ctx) {
|
||||
return new PointDescription(PointDescription.POINT_TYPE_ALARM, type.getVisualName(ctx));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1049,7 +1049,7 @@ public class RouteProvider {
|
|||
pt.lat = ps.get(k).getLatitude();
|
||||
pt.lon = ps.get(k).getLongitude();
|
||||
if(k < ps.size()) {
|
||||
pt.name = ps.get(k).name +"";
|
||||
pt.name = ps.get(k).getOnlyName() +"";
|
||||
if(k == ps.size() - 1) {
|
||||
String target = ctx.getString(R.string.destination_point, "" );
|
||||
if(pt.name.startsWith(target)) {
|
||||
|
|
|
@ -439,7 +439,7 @@ public class RoutingHelper {
|
|||
int toDel = targets.getIntermediatePoints().size() - route.getIntermediatePointsToPass();
|
||||
int currentIndex = toDel - 1;
|
||||
String name = currentIndex < 0 || currentIndex >= ns.size() ||
|
||||
ns.get(currentIndex ) == null ? "" : ns.get(currentIndex ).name;
|
||||
ns.get(currentIndex ) == null ? "" : ns.get(currentIndex ).getOnlyName();
|
||||
if(isFollowingMode) {
|
||||
voiceRouter.arrivedIntermediatePoint(name);
|
||||
}
|
||||
|
@ -459,7 +459,7 @@ public class RoutingHelper {
|
|||
showMessage(app.getString(R.string.arrived_at_destination));
|
||||
TargetPointsHelper targets = app.getTargetPointsHelper();
|
||||
TargetPoint tp = targets.getPointToNavigate();
|
||||
String description = tp == null ? "" : tp.name;
|
||||
String description = tp == null ? "" : tp.getOnlyName();
|
||||
if(isFollowingMode) {
|
||||
voiceRouter.arrivedDestinationPoint(description);
|
||||
}
|
||||
|
|
|
@ -2,12 +2,12 @@ package net.osmand.plus.routing;
|
|||
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import net.osmand.Location;
|
||||
import net.osmand.binary.RouteDataObject;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.plus.ApplicationMode;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.helpers.WaypointHelper.LocationPointWrapper;
|
||||
|
@ -22,11 +22,8 @@ import net.osmand.util.Algorithms;
|
|||
import net.osmand.util.MapUtils;
|
||||
import alice.tuprolog.Struct;
|
||||
import alice.tuprolog.Term;
|
||||
import android.content.Context;
|
||||
import android.media.AudioManager;
|
||||
import android.media.SoundPool;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
|
||||
|
||||
public class VoiceRouter {
|
||||
|
@ -322,7 +319,7 @@ public class VoiceRouter {
|
|||
} else {
|
||||
text += ", ";
|
||||
}
|
||||
text += point.getPoint().getName(router.getApplication());
|
||||
text += PointDescription.getSimpleName(point.getPoint(), router.getApplication());
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
|
|
@ -711,7 +711,7 @@ public class SherpafyCustomization extends OsmAndAppCustomization {
|
|||
WptPt lp = gpx.getLastPoint();
|
||||
if (lp != null) {
|
||||
TargetPointsHelper targetPointsHelper = app.getTargetPointsHelper();
|
||||
targetPointsHelper.navigateToPoint(new LatLon(lp.lat, lp.lon), true, -1, lp.name);
|
||||
targetPointsHelper.navigateToPoint(new LatLon(lp.lat, lp.lon), true, -1, lp.getPointDescription(a));
|
||||
app.getSettings().navigateDialog(true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,9 +4,6 @@ import java.util.ArrayList;
|
|||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
import android.graphics.PointF;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import net.osmand.data.LocationPoint;
|
||||
import net.osmand.data.RotatedTileBox;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
|
@ -14,7 +11,8 @@ import net.osmand.plus.R;
|
|||
import net.osmand.plus.sherpafy.TourInformation.StageFavorite;
|
||||
import net.osmand.plus.sherpafy.TourInformation.StageInformation;
|
||||
import net.osmand.plus.views.FavoritesLayer;
|
||||
import net.osmand.plus.views.OsmandMapTileView;
|
||||
import android.graphics.PointF;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
|
||||
public class StageFavoritesLayer extends FavoritesLayer {
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ import java.util.WeakHashMap;
|
|||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.LocationPoint;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.plus.GPXUtilities.GPXFile;
|
||||
import net.osmand.util.Algorithms;
|
||||
|
||||
|
@ -300,9 +301,10 @@ public class TourInformation {
|
|||
public double getLongitude() {
|
||||
return location.getLongitude();
|
||||
}
|
||||
|
||||
public String getName(Context ctx) {
|
||||
return name;
|
||||
|
||||
@Override
|
||||
public PointDescription getPointDescription(Context ctx) {
|
||||
return new PointDescription(PointDescription.POINT_TYPE_WPT, name);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
|
|
|
@ -9,11 +9,11 @@ import java.util.concurrent.ConcurrentHashMap;
|
|||
|
||||
import net.osmand.CallbackWithObject;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.data.RotatedTileBox;
|
||||
import net.osmand.plus.ContextMenuAdapter;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import alice.util.Sleep;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.AlertDialog.Builder;
|
||||
import android.content.DialogInterface;
|
||||
|
@ -41,7 +41,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
|||
|
||||
public String getObjectDescription(Object o);
|
||||
|
||||
public String getObjectName(Object o);
|
||||
public PointDescription getObjectName(Object o);
|
||||
|
||||
|
||||
}
|
||||
|
@ -196,9 +196,8 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
|||
public void setLocation(LatLon loc, String description){
|
||||
latLon = loc;
|
||||
if(latLon != null){
|
||||
if(description == null || description.length() == 0){
|
||||
description = view.getContext().getString(R.string.point_on_map,
|
||||
latLon.getLatitude(), latLon.getLongitude());
|
||||
if(description == null){
|
||||
description = PointDescription.LOCATION_POINT.getFullPlainName(activity, loc.getLatitude(), loc.getLongitude());
|
||||
}
|
||||
textView.setText(Html.fromHtml(description.replace("\n", "<br/>")));
|
||||
} else {
|
||||
|
@ -309,6 +308,19 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
|||
return getSelectedObjectInfo(true);
|
||||
}
|
||||
|
||||
public List<PointDescription> getSelectedObjectNames() {
|
||||
List<PointDescription> list = new ArrayList<PointDescription>();
|
||||
Iterator<Entry<Object, IContextMenuProvider>> it = selectedObjects.entrySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
Entry<Object, IContextMenuProvider> e = it.next();
|
||||
PointDescription onames = e.getValue().getObjectName(e.getKey());
|
||||
if (onames != null) {
|
||||
list.add(onames);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public String getSelectedObjectDescription(){
|
||||
return getSelectedObjectInfo(false);
|
||||
}
|
||||
|
@ -327,7 +339,10 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
|||
description.append("\n" + (i + 1) + ". ");
|
||||
}
|
||||
if(name) {
|
||||
description.append(e.getValue().getObjectName(e.getKey()));
|
||||
PointDescription nm = e.getValue().getObjectName(e.getKey());
|
||||
LatLon ll = e.getValue().getObjectLocation(e.getKey());
|
||||
description.append(nm.getFullPlainName(activity, ll == null? 0 : ll.getLatitude(), ll == null? 0
|
||||
: ll.getLongitude()));
|
||||
} else {
|
||||
description.append(e.getValue().getObjectDescription(e.getKey()));
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import net.osmand.access.AccessibleToast;
|
|||
import net.osmand.data.FavouritePoint;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.LocationPoint;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.data.QuadRect;
|
||||
import net.osmand.data.RotatedTileBox;
|
||||
import net.osmand.plus.ContextMenuAdapter;
|
||||
|
@ -150,9 +151,9 @@ public class FavoritesLayer extends OsmandMapLayer implements ContextMenuLayer.
|
|||
int i = 0;
|
||||
for(LocationPoint fav : favs) {
|
||||
if (i++ > 0) {
|
||||
res.append("\n\n");
|
||||
res.append("\n");
|
||||
}
|
||||
res.append(getObjName() + " : " + fav.getName(view.getContext())); //$NON-NLS-1$
|
||||
res.append(PointDescription.getSimpleName(fav, view.getContext())); //$NON-NLS-1$
|
||||
}
|
||||
AccessibleToast.makeText(view.getContext(), res.toString(), Toast.LENGTH_LONG).show();
|
||||
return true;
|
||||
|
@ -167,7 +168,7 @@ public class FavoritesLayer extends OsmandMapLayer implements ContextMenuLayer.
|
|||
if(o!= null && fcl.isInstance(o)) {
|
||||
String desciption = ((FavouritePoint)o).getDescription() != null ?
|
||||
" " + ((FavouritePoint)o).getDescription() : "";
|
||||
return getObjName() + ": " + ((LocationPoint)o).getName(view.getContext())
|
||||
return PointDescription.getSimpleName((LocationPoint) o, view.getContext()) + " "
|
||||
+ desciption; //$NON-NLS-1$
|
||||
}
|
||||
return null;
|
||||
|
@ -176,9 +177,9 @@ public class FavoritesLayer extends OsmandMapLayer implements ContextMenuLayer.
|
|||
|
||||
|
||||
@Override
|
||||
public String getObjectName(Object o) {
|
||||
public PointDescription getObjectName(Object o) {
|
||||
if(o instanceof LocationPoint){
|
||||
return ((LocationPoint)o).getName(view.getContext()); //$NON-NLS-1$
|
||||
return ((LocationPoint) o).getPointDescription(view.getContext()); //$NON-NLS-1$
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -238,7 +239,7 @@ public class FavoritesLayer extends OsmandMapLayer implements ContextMenuLayer.
|
|||
|
||||
@Override
|
||||
public String getText(LocationPoint o) {
|
||||
return o.getName(view.getContext());
|
||||
return PointDescription.getSimpleName(o, view.getContext());
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ import java.util.List;
|
|||
|
||||
import net.osmand.access.AccessibleToast;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.data.QuadRect;
|
||||
import net.osmand.data.RotatedTileBox;
|
||||
import net.osmand.plus.GPXUtilities.GPXFile;
|
||||
|
@ -403,9 +404,9 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getObjectName(Object o) {
|
||||
public PointDescription getObjectName(Object o) {
|
||||
if(o instanceof WptPt){
|
||||
return ((WptPt)o).name; //$NON-NLS-1$
|
||||
return new PointDescription(PointDescription.POINT_TYPE_WPT, ((WptPt)o).name); //$NON-NLS-1$
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import net.osmand.ResultMatcher;
|
|||
import net.osmand.access.AccessibleToast;
|
||||
import net.osmand.data.Amenity;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.data.QuadRect;
|
||||
import net.osmand.data.RotatedTileBox;
|
||||
import net.osmand.osm.MapPoiTypes;
|
||||
|
@ -320,9 +321,9 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getObjectName(Object o) {
|
||||
public PointDescription getObjectName(Object o) {
|
||||
if (o instanceof Amenity) {
|
||||
return ((Amenity) o).getName(); //$NON-NLS-1$
|
||||
return new PointDescription(PointDescription.POINT_TYPE_POI, ((Amenity) o).getName());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package net.osmand.plus.views;
|
|||
import java.util.List;
|
||||
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.data.QuadPoint;
|
||||
import net.osmand.data.RotatedTileBox;
|
||||
import net.osmand.plus.ContextMenuAdapter;
|
||||
|
@ -201,15 +202,16 @@ public class PointNavigationLayer extends OsmandMapLayer implements IContextMenu
|
|||
@Override
|
||||
public String getObjectDescription(Object o) {
|
||||
if (o instanceof TargetPoint) {
|
||||
return ((TargetPoint) o).getVisibleName(view.getContext());
|
||||
return ((TargetPoint) o).getPointDescription(view.getContext()).getFullPlainName(view.getContext(),
|
||||
((TargetPoint) o).getLatitude(), ((TargetPoint) o).getLongitude());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getObjectName(Object o) {
|
||||
public PointDescription getObjectName(Object o) {
|
||||
if (o instanceof TargetPoint) {
|
||||
return ((TargetPoint) o).getVisibleName(view.getContext());
|
||||
return ((TargetPoint) o).getPointDescription(view.getContext());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import java.util.List;
|
|||
|
||||
import net.osmand.access.AccessibleToast;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.data.QuadRect;
|
||||
import net.osmand.data.RotatedTileBox;
|
||||
import net.osmand.data.TransportStop;
|
||||
|
@ -190,9 +191,10 @@ public class TransportStopsLayer extends OsmandMapLayer implements ContextMenuLa
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getObjectName(Object o) {
|
||||
public PointDescription getObjectName(Object o) {
|
||||
if(o instanceof TransportStop){
|
||||
return ((TransportStop)o).getName();
|
||||
return new PointDescription(PointDescription.POINT_TYPE_POI, view.getContext().getString(R.string.transport_Stop),
|
||||
((TransportStop)o).getName());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -3,20 +3,19 @@ package net.osmand.plus.views.controls;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import android.view.*;
|
||||
import net.osmand.data.FavouritePoint;
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.RotatedTileBox;
|
||||
import net.osmand.plus.OsmAndLocationProvider;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
import net.osmand.plus.development.OsmandDevelopmentPlugin;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.TargetPointsHelper;
|
||||
import net.osmand.plus.TargetPointsHelper.TargetPoint;
|
||||
import net.osmand.plus.activities.FavoritesListFragment.FavouritesAdapter;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.activities.ShowRouteInfoActivity;
|
||||
import net.osmand.plus.development.OsmandDevelopmentPlugin;
|
||||
import net.osmand.plus.routing.RouteDirectionInfo;
|
||||
import net.osmand.plus.routing.RoutingHelper;
|
||||
import net.osmand.plus.routing.RoutingHelper.IRouteInformationListener;
|
||||
|
@ -33,6 +32,10 @@ import android.graphics.Canvas;
|
|||
import android.graphics.PointF;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Handler;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
|
@ -216,11 +219,10 @@ public class MapRouteInfoControl extends MapControls implements IRouteInformatio
|
|||
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
||||
FavouritePoint fp = favouritesAdapter.getItem(position);
|
||||
LatLon point = new LatLon(fp.getLatitude(), fp.getLongitude());
|
||||
String name = mapActivity.getString(R.string.favorite) + ": " + fp.getName();
|
||||
if(target) {
|
||||
getTargets().navigateToPoint(point, true, -1, name);
|
||||
getTargets().navigateToPoint(point, true, -1, fp.getPointDescription());
|
||||
} else {
|
||||
getTargets().setStartPoint(point, true, name);
|
||||
getTargets().setStartPoint(point, true, fp.getPointDescription());
|
||||
}
|
||||
favoritesDialog.dismiss();
|
||||
//Next 2 lines ensure Dialog is shown in the right correct position after a selection been made
|
||||
|
@ -360,7 +362,7 @@ public class MapRouteInfoControl extends MapControls implements IRouteInformatio
|
|||
return via;
|
||||
}
|
||||
for (int i = 0; i < points.size() ; i++) {
|
||||
via += "\n - " + getRoutePointDescription(points.get(i).point, points.get(i).name);
|
||||
via += "\n - " + getRoutePointDescription(points.get(i).point, points.get(i).getOnlyName());
|
||||
}
|
||||
return mapActivity.getString(R.string.route_via) + via;
|
||||
}
|
||||
|
@ -387,7 +389,7 @@ public class MapRouteInfoControl extends MapControls implements IRouteInformatio
|
|||
|
||||
TargetPoint start = getTargets().getPointToStart();
|
||||
if (start != null) {
|
||||
String oname = start.name != null && start.name.length() > 0 ? start.name
|
||||
String oname = start.getOnlyName().length() > 0 ? start.getOnlyName()
|
||||
: (mapActivity.getString(R.string.route_descr_map_location) + " " + getRoutePointDescription(start.getLatitude(), start.getLongitude()));
|
||||
fromActions.add(oname);
|
||||
}
|
||||
|
@ -416,7 +418,7 @@ public class MapRouteInfoControl extends MapControls implements IRouteInformatio
|
|||
if (targets.getPointToNavigate() != null) {
|
||||
toActions.add(mapActivity.getString(R.string.route_descr_destination) + " "
|
||||
+ getRoutePointDescription(targets.getPointToNavigate().point,
|
||||
targets.getPointToNavigate().name));
|
||||
targets.getPointToNavigate().getOnlyName()));
|
||||
} else {
|
||||
toSpinner.setPromptId(R.string.route_descr_select_destination);
|
||||
toActions.add(mapActivity.getString(R.string.route_descr_select_destination));
|
||||
|
|
Loading…
Reference in a new issue