Merge branch 'r3.3' of https://github.com/osmandapp/Osmand into r3.3
This commit is contained in:
commit
99e818e12c
22 changed files with 236 additions and 110 deletions
|
@ -92,7 +92,7 @@ public class TransportRoutingConfiguration {
|
||||||
maxRouteTime = router.getIntAttribute("maxRouteTime", maxRouteTime);
|
maxRouteTime = router.getIntAttribute("maxRouteTime", maxRouteTime);
|
||||||
finishTimeSeconds = router.getIntAttribute("delayForAlternativesRoutes", finishTimeSeconds);
|
finishTimeSeconds = router.getIntAttribute("delayForAlternativesRoutes", finishTimeSeconds);
|
||||||
String mn = params.get("max_num_changes");
|
String mn = params.get("max_num_changes");
|
||||||
maxNumberOfChanges = RoutingConfiguration.parseSilentInt(mn, maxNumberOfChanges);
|
maxNumberOfChanges = (int) RoutingConfiguration.parseSilentFloat(mn, maxNumberOfChanges);
|
||||||
|
|
||||||
walkSpeed = router.getFloatAttribute("minDefaultSpeed", this.walkSpeed * 3.6f) / 3.6f;
|
walkSpeed = router.getFloatAttribute("minDefaultSpeed", this.walkSpeed * 3.6f) / 3.6f;
|
||||||
defaultTravelSpeed = router.getFloatAttribute("maxDefaultSpeed", this.defaultTravelSpeed * 3.6f) / 3.6f;
|
defaultTravelSpeed = router.getFloatAttribute("maxDefaultSpeed", this.defaultTravelSpeed * 3.6f) / 3.6f;
|
||||||
|
|
|
@ -4,6 +4,7 @@ import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.osmand.Location;
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
import net.osmand.data.MapObject;
|
import net.osmand.data.MapObject;
|
||||||
import net.osmand.data.QuadPoint;
|
import net.osmand.data.QuadPoint;
|
||||||
|
|
|
@ -11,6 +11,11 @@
|
||||||
Thx - Hardy
|
Thx - Hardy
|
||||||
|
|
||||||
-->
|
-->
|
||||||
|
<string name="shared_string_degrees">Degrees</string>
|
||||||
|
<string name="shared_string_milliradians">Milliradians</string>
|
||||||
|
<string name="angular_measeurement">Angular measurement units</string>
|
||||||
|
<string name="angular_measeurement_descr">Change what azimuth is measured in.</string>
|
||||||
|
<string name="quick_action_day_night_mode">%s mode</string>
|
||||||
<string name="avoid_pt_types_descr">Select a public transport types you want to avoid during navigation:</string>
|
<string name="avoid_pt_types_descr">Select a public transport types you want to avoid during navigation:</string>
|
||||||
<string name="avoid_pt_types">Avoid transport types…</string>
|
<string name="avoid_pt_types">Avoid transport types…</string>
|
||||||
<string name="shared_string_walk">Walk</string>
|
<string name="shared_string_walk">Walk</string>
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
<!-- ListPreference android:key="map_preferred_locale" android:title="@string/map_preferred_locale" android:summary="@string/map_preferred_locale_descr"></ListPreference -->
|
<!-- ListPreference android:key="map_preferred_locale" android:title="@string/map_preferred_locale" android:summary="@string/map_preferred_locale_descr"></ListPreference -->
|
||||||
<ListPreference android:key="default_metric_system" android:title="@string/unit_of_length" android:summary="@string/unit_of_length_descr"></ListPreference>
|
<ListPreference android:key="default_metric_system" android:title="@string/unit_of_length" android:summary="@string/unit_of_length_descr"></ListPreference>
|
||||||
<ListPreference android:key="coordinates_format" android:title="@string/coords_format" android:summary="@string/coords_format_descr"></ListPreference>
|
<ListPreference android:key="coordinates_format" android:title="@string/coords_format" android:summary="@string/coords_format_descr"></ListPreference>
|
||||||
|
<ListPreference android:key="angular_measurement" android:title="@string/angular_measeurement" android:summary="@string/angular_measeurement_descr"></ListPreference>
|
||||||
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@ import net.osmand.osm.AbstractPoiType;
|
||||||
import net.osmand.osm.MapPoiTypes;
|
import net.osmand.osm.MapPoiTypes;
|
||||||
import net.osmand.osm.PoiCategory;
|
import net.osmand.osm.PoiCategory;
|
||||||
import net.osmand.osm.PoiType;
|
import net.osmand.osm.PoiType;
|
||||||
|
import net.osmand.plus.OsmandSettings.AngularConstants;
|
||||||
import net.osmand.plus.OsmandSettings.MetricsConstants;
|
import net.osmand.plus.OsmandSettings.MetricsConstants;
|
||||||
import net.osmand.plus.OsmandSettings.SpeedConstants;
|
import net.osmand.plus.OsmandSettings.SpeedConstants;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
@ -166,6 +167,22 @@ public class OsmAndFormatter {
|
||||||
return df.format(meters / mainUnitInMeters) + " " + app.getString(mainUnitStr);
|
return df.format(meters / mainUnitInMeters) + " " + app.getString(mainUnitStr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getFormattedAzimuth(float bearing, OsmandApplication app) {
|
||||||
|
int azimuth;
|
||||||
|
if (bearing < 0.0) {
|
||||||
|
azimuth = (int) (360 + bearing);
|
||||||
|
} else {
|
||||||
|
azimuth = (int) bearing;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (app.getSettings().ANGULAR_UNITS.get() == AngularConstants.MILLIRADS) {
|
||||||
|
return (int) (azimuth * 17.4533) + " " + AngularConstants.MILLIRADS.getUnitSymbol();
|
||||||
|
} else {
|
||||||
|
return azimuth + AngularConstants.DEGREES.getUnitSymbol();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public static String getFormattedDistance(float meters, OsmandApplication ctx) {
|
public static String getFormattedDistance(float meters, OsmandApplication ctx) {
|
||||||
return getFormattedDistance(meters, ctx, true);
|
return getFormattedDistance(meters, ctx, true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -930,6 +930,17 @@ public class OsmandSettings {
|
||||||
;
|
;
|
||||||
}.makeGlobal();
|
}.makeGlobal();
|
||||||
|
|
||||||
|
//public final OsmandPreference<Integer> COORDINATES_FORMAT = new IntPreference("coordinates_format", PointDescription.FORMAT_DEGREES).makeGlobal();
|
||||||
|
|
||||||
|
public final OsmandPreference<AngularConstants> ANGULAR_UNITS = new EnumIntPreference<AngularConstants>(
|
||||||
|
"angular_measurement", AngularConstants.DEGREES, AngularConstants.values()) {
|
||||||
|
@Override
|
||||||
|
protected AngularConstants getValue(Object prefs, AngularConstants defaultValue) {
|
||||||
|
return super.getValue(prefs, defaultValue);
|
||||||
|
}
|
||||||
|
}.makeGlobal();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public final OsmandPreference<SpeedConstants> SPEED_SYSTEM = new EnumIntPreference<SpeedConstants>(
|
public final OsmandPreference<SpeedConstants> SPEED_SYSTEM = new EnumIntPreference<SpeedConstants>(
|
||||||
"default_speed_system", SpeedConstants.KILOMETERS_PER_HOUR, SpeedConstants.values()) {
|
"default_speed_system", SpeedConstants.KILOMETERS_PER_HOUR, SpeedConstants.values()) {
|
||||||
|
@ -2900,6 +2911,27 @@ public class OsmandSettings {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum AngularConstants {
|
||||||
|
DEGREES(R.string.shared_string_degrees, "°"),
|
||||||
|
MILLIRADS(R.string.shared_string_milliradians, "mil");
|
||||||
|
|
||||||
|
private final int key;
|
||||||
|
private final String unit;
|
||||||
|
|
||||||
|
AngularConstants(int key, String unit) {
|
||||||
|
this.key = key;
|
||||||
|
this.unit = unit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toHumanString(Context ctx) {
|
||||||
|
return ctx.getString(key);
|
||||||
|
}
|
||||||
|
public String getUnitSymbol() {
|
||||||
|
return unit;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public enum AutoZoomMap {
|
public enum AutoZoomMap {
|
||||||
FARTHEST(R.string.auto_zoom_farthest, 1f, 15.5f),
|
FARTHEST(R.string.auto_zoom_farthest, 1f, 15.5f),
|
||||||
FAR(R.string.auto_zoom_far, 1.4f, 17f),
|
FAR(R.string.auto_zoom_far, 1.4f, 17f),
|
||||||
|
|
|
@ -443,6 +443,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
||||||
@Override
|
@Override
|
||||||
public void start() {
|
public void start() {
|
||||||
setupRouteCalculationProgressBar(pb);
|
setupRouteCalculationProgressBar(pb);
|
||||||
|
mapRouteInfoMenu.routeCalculationStarted();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1499,8 +1500,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
||||||
if (zoom != null) {
|
if (zoom != null) {
|
||||||
z = Integer.parseInt(zoom);
|
z = Integer.parseInt(zoom);
|
||||||
}
|
}
|
||||||
settings.setMapLocationToShow(lt, ln, z, new PointDescription(
|
settings.setMapLocationToShow(lt, ln, z, new PointDescription(lt, ln));
|
||||||
PointDescription.POINT_TYPE_MARKER, getString(R.string.shared_location)));
|
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
LOG.error("error", e);
|
LOG.error("error", e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,7 @@ import net.osmand.osm.io.NetworkUtils;
|
||||||
import net.osmand.plus.ApplicationMode;
|
import net.osmand.plus.ApplicationMode;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
|
import net.osmand.plus.OsmandSettings.AngularConstants;
|
||||||
import net.osmand.plus.OsmandSettings.DrivingRegion;
|
import net.osmand.plus.OsmandSettings.DrivingRegion;
|
||||||
import net.osmand.plus.OsmandSettings.MetricsConstants;
|
import net.osmand.plus.OsmandSettings.MetricsConstants;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
@ -209,6 +210,13 @@ public class SettingsGeneralActivity extends SettingsBaseActivity implements OnR
|
||||||
entries[4] = PointDescription.formatToHumanString(this, PointDescription.OLC_FORMAT);
|
entries[4] = PointDescription.formatToHumanString(this, PointDescription.OLC_FORMAT);
|
||||||
registerListPreference(settings.COORDINATES_FORMAT, screen, entries, cvls);
|
registerListPreference(settings.COORDINATES_FORMAT, screen, entries, cvls);
|
||||||
|
|
||||||
|
AngularConstants[] ac = AngularConstants.values();
|
||||||
|
entries = new String[ac.length];
|
||||||
|
for (int i = 0; i < entries.length; i++) {
|
||||||
|
entries[i] = ac[i].toHumanString(getMyApplication());
|
||||||
|
}
|
||||||
|
registerListPreference(settings.ANGULAR_UNITS, screen, entries, ac);
|
||||||
|
|
||||||
// See language list and statistics at: https://hosted.weblate.org/projects/osmand/main/
|
// See language list and statistics at: https://hosted.weblate.org/projects/osmand/main/
|
||||||
// Hardy maintenance 2016-05-29:
|
// Hardy maintenance 2016-05-29:
|
||||||
// - Include languages if their translation is >= ~10% (but any language will be visible if it is the device's system locale)
|
// - Include languages if their translation is >= ~10% (but any language will be visible if it is the device's system locale)
|
||||||
|
|
|
@ -137,13 +137,13 @@ public class GeoIntentActivity extends OsmandListActivity {
|
||||||
}
|
}
|
||||||
settings.setMapLocationToShow(p.getLatitude(), p.getLongitude(),
|
settings.setMapLocationToShow(p.getLatitude(), p.getLongitude(),
|
||||||
settings.getLastKnownMapZoom(), pd); //$NON-NLS-1$
|
settings.getLastKnownMapZoom(), pd); //$NON-NLS-1$
|
||||||
MapActivity.launchMapActivityMoveToTop(GeoIntentActivity.this);
|
|
||||||
} else {
|
} else {
|
||||||
Uri uri = intent.getData();
|
Uri uri = intent.getData();
|
||||||
String searchString = p != null && p.isGeoAddress() ? p.getQuery() : uri.toString();
|
String searchString = p != null && p.isGeoAddress() ? p.getQuery() : uri.toString();
|
||||||
settings.setSearchRequestToShow(searchString);
|
settings.setSearchRequestToShow(searchString);
|
||||||
MapActivity.launchMapActivityMoveToTop(GeoIntentActivity.this);
|
|
||||||
}
|
}
|
||||||
|
MapActivity.launchMapActivityMoveToTop(GeoIntentActivity.this);
|
||||||
|
GeoIntentActivity.this.finish();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -151,8 +151,6 @@ public class GeoIntentActivity extends OsmandListActivity {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop() {
|
protected void onStop() {
|
||||||
dismiss();
|
dismiss();
|
||||||
|
|
|
@ -63,11 +63,6 @@ public class AddWaypointBottomSheetDialogFragment extends MenuBottomSheetDialogF
|
||||||
.setOnClickListener(new View.OnClickListener() {
|
.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
TargetPoint start = targetPointsHelper.getPointToStart();
|
|
||||||
if (start != null) {
|
|
||||||
targetPointsHelper.navigateToPoint(new LatLon(start.getLatitude(), start.getLongitude()),
|
|
||||||
false, 0, start.getOriginalPointDescription());
|
|
||||||
}
|
|
||||||
targetPointsHelper.setStartPoint(latLon, true, name);
|
targetPointsHelper.setStartPoint(latLon, true, name);
|
||||||
dismiss();
|
dismiss();
|
||||||
}
|
}
|
||||||
|
|
|
@ -705,11 +705,12 @@ public class MapContextMenuFragment extends BaseOsmAndFragment implements Downlo
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<TransportStopRoute> filterNearbyTransportRoutes(List<TransportStopRoute> routes, List<TransportStopRoute> filterFromRoutes) {
|
private List<TransportStopRoute> filterNearbyTransportRoutes(List<TransportStopRoute> routes, List<TransportStopRoute> filterFromRoutes) {
|
||||||
if (filterFromRoutes == null) {
|
List<TransportStopRoute> nearbyFilteredTransportStopRoutes = filterTransportRoutes(routes);
|
||||||
return routes;
|
if (filterFromRoutes == null || filterFromRoutes.isEmpty()) {
|
||||||
|
return nearbyFilteredTransportStopRoutes;
|
||||||
}
|
}
|
||||||
List<TransportStopRoute> filteredRoutes = new ArrayList<>();
|
List<TransportStopRoute> filteredRoutes = new ArrayList<>();
|
||||||
for (TransportStopRoute route : routes) {
|
for (TransportStopRoute route : nearbyFilteredTransportStopRoutes) {
|
||||||
if (!containsRef(filterFromRoutes, route.route)) {
|
if (!containsRef(filterFromRoutes, route.route)) {
|
||||||
filteredRoutes.add(route);
|
filteredRoutes.add(route);
|
||||||
}
|
}
|
||||||
|
|
|
@ -360,9 +360,10 @@ public class MeasurementToolFragment extends BaseOsmAndFragment {
|
||||||
|
|
||||||
measurementLayer.setOnMeasureDistanceToCenterListener(new MeasurementToolLayer.OnMeasureDistanceToCenter() {
|
measurementLayer.setOnMeasureDistanceToCenterListener(new MeasurementToolLayer.OnMeasureDistanceToCenter() {
|
||||||
@Override
|
@Override
|
||||||
public void onMeasure(float distance) {
|
public void onMeasure(float distance, float bearing) {
|
||||||
String distStr = OsmAndFormatter.getFormattedDistance(distance, mapActivity.getMyApplication());
|
String distStr = OsmAndFormatter.getFormattedDistance(distance, mapActivity.getMyApplication());
|
||||||
distanceToCenterTv.setText(" – " + distStr);
|
String azimuthStr = OsmAndFormatter.getFormattedAzimuth(bearing, getMyApplication());
|
||||||
|
distanceToCenterTv.setText(String.format(" – %s • %s", distStr, azimuthStr));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ import android.graphics.Paint;
|
||||||
import android.graphics.Path;
|
import android.graphics.Path;
|
||||||
import android.graphics.PointF;
|
import android.graphics.PointF;
|
||||||
|
|
||||||
|
import net.osmand.Location;
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
import net.osmand.data.PointDescription;
|
import net.osmand.data.PointDescription;
|
||||||
import net.osmand.data.QuadPoint;
|
import net.osmand.data.QuadPoint;
|
||||||
|
@ -201,12 +202,16 @@ public class MeasurementToolLayer extends OsmandMapLayer implements ContextMenuL
|
||||||
drawCenterIcon(canvas, tb, tb.getCenterPixelPoint(), settings.isNightMode());
|
drawCenterIcon(canvas, tb, tb.getCenterPixelPoint(), settings.isNightMode());
|
||||||
if (measureDistanceToCenterListener != null) {
|
if (measureDistanceToCenterListener != null) {
|
||||||
float distance = 0;
|
float distance = 0;
|
||||||
|
float bearing = 0;
|
||||||
if (editingCtx.getPointsCount() > 0) {
|
if (editingCtx.getPointsCount() > 0) {
|
||||||
WptPt lastPoint = editingCtx.getPoints().get(editingCtx.getPointsCount() - 1);
|
WptPt lastPoint = editingCtx.getPoints().get(editingCtx.getPointsCount() - 1);
|
||||||
LatLon centerLatLon = tb.getCenterLatLon();
|
LatLon centerLatLon = tb.getCenterLatLon();
|
||||||
distance = (float) MapUtils.getDistance(lastPoint.lat, lastPoint.lon, centerLatLon.getLatitude(), centerLatLon.getLongitude());
|
distance = (float) MapUtils.getDistance(
|
||||||
|
lastPoint.lat, lastPoint.lon, centerLatLon.getLatitude(), centerLatLon.getLongitude());
|
||||||
|
bearing = getLocationFromLL(lastPoint.lat, lastPoint.lon)
|
||||||
|
.bearingTo(getLocationFromLL(centerLatLon.getLatitude(), centerLatLon.getLongitude()));
|
||||||
}
|
}
|
||||||
measureDistanceToCenterListener.onMeasure(distance);
|
measureDistanceToCenterListener.onMeasure(distance, bearing);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -411,6 +416,13 @@ public class MeasurementToolLayer extends OsmandMapLayer implements ContextMenuL
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Location getLocationFromLL(double lat, double lon) {
|
||||||
|
Location l = new Location("");
|
||||||
|
l.setLatitude(lat);
|
||||||
|
l.setLongitude(lon);
|
||||||
|
return l;
|
||||||
|
}
|
||||||
|
|
||||||
interface OnSingleTapListener {
|
interface OnSingleTapListener {
|
||||||
|
|
||||||
void onAddPoint();
|
void onAddPoint();
|
||||||
|
@ -423,6 +435,6 @@ public class MeasurementToolLayer extends OsmandMapLayer implements ContextMenuL
|
||||||
}
|
}
|
||||||
|
|
||||||
interface OnMeasureDistanceToCenter {
|
interface OnMeasureDistanceToCenter {
|
||||||
void onMeasure(float distance);
|
void onMeasure(float distance, float bearing);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@ import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import net.osmand.GPXUtilities.WptPt;
|
import net.osmand.GPXUtilities.WptPt;
|
||||||
|
import net.osmand.Location;
|
||||||
import net.osmand.plus.UiUtilities;
|
import net.osmand.plus.UiUtilities;
|
||||||
import net.osmand.plus.OsmAndFormatter;
|
import net.osmand.plus.OsmAndFormatter;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
@ -31,6 +32,7 @@ public class MeasurementToolAdapter extends RecyclerView.Adapter<MeasurementTool
|
||||||
private MeasurementAdapterListener listener;
|
private MeasurementAdapterListener listener;
|
||||||
private boolean nightMode;
|
private boolean nightMode;
|
||||||
private final ActionType actionType;
|
private final ActionType actionType;
|
||||||
|
private final static String BULLET = " • ";
|
||||||
|
|
||||||
public MeasurementToolAdapter(MapActivity mapActivity, List<WptPt> points, ActionType actionType) {
|
public MeasurementToolAdapter(MapActivity mapActivity, List<WptPt> points, ActionType actionType) {
|
||||||
this.mapActivity = mapActivity;
|
this.mapActivity = mapActivity;
|
||||||
|
@ -88,15 +90,29 @@ public class MeasurementToolAdapter extends RecyclerView.Adapter<MeasurementTool
|
||||||
if (!TextUtils.isEmpty(pointDesc)) {
|
if (!TextUtils.isEmpty(pointDesc)) {
|
||||||
holder.descr.setText(pointDesc);
|
holder.descr.setText(pointDesc);
|
||||||
} else {
|
} else {
|
||||||
|
String text = "";
|
||||||
|
Location l1;
|
||||||
|
Location l2;
|
||||||
if (pos < 1) {
|
if (pos < 1) {
|
||||||
holder.descr.setText(mapActivity.getString(R.string.shared_string_control_start));
|
text = mapActivity.getString(R.string.shared_string_control_start);
|
||||||
|
if (mapActivity.getMyApplication().getLocationProvider().getLastKnownLocation() != null) {
|
||||||
|
l1 = mapActivity.getMyApplication().getLocationProvider().getLastKnownLocation();
|
||||||
|
l2 = getLocationFromLL(points.get(0).lat, points.get(0).lon);
|
||||||
|
text = text
|
||||||
|
+ BULLET + OsmAndFormatter.getFormattedDistance(l1.distanceTo(l2), mapActivity.getMyApplication())
|
||||||
|
+ BULLET + OsmAndFormatter.getFormattedAzimuth(l1.bearingTo(l2), mapActivity.getMyApplication());
|
||||||
|
}
|
||||||
|
holder.descr.setText(text);
|
||||||
} else {
|
} else {
|
||||||
float dist = 0;
|
float dist = 0;
|
||||||
for (int i = 1; i <= pos; i++) {
|
for (int i = 1; i <= pos; i++) {
|
||||||
dist += MapUtils.getDistance(points.get(i - 1).lat, points.get(i - 1).lon,
|
l1 = getLocationFromLL(points.get(i - 1).lat, points.get(i - 1).lon);
|
||||||
points.get(i).lat, points.get(i).lon);
|
l2 = getLocationFromLL(points.get(i).lat, points.get(i).lon);
|
||||||
|
dist += l1.distanceTo(l2);
|
||||||
|
text = OsmAndFormatter.getFormattedDistance(dist, mapActivity.getMyApplication())
|
||||||
|
+ BULLET + OsmAndFormatter.getFormattedAzimuth(l1.bearingTo(l2), mapActivity.getMyApplication());
|
||||||
}
|
}
|
||||||
holder.descr.setText(OsmAndFormatter.getFormattedDistance(dist, mapActivity.getMyApplication()));
|
holder.descr.setText(text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (actionType == ActionType.EDIT_SEGMENT) {
|
if (actionType == ActionType.EDIT_SEGMENT) {
|
||||||
|
@ -131,6 +147,13 @@ public class MeasurementToolAdapter extends RecyclerView.Adapter<MeasurementTool
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Location getLocationFromLL(double lat, double lon) {
|
||||||
|
Location l = new Location("");
|
||||||
|
l.setLatitude(lat);
|
||||||
|
l.setLongitude(lon);
|
||||||
|
return l;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getItemCount() {
|
public int getItemCount() {
|
||||||
return points.size();
|
return points.size();
|
||||||
|
|
|
@ -7,6 +7,7 @@ import android.view.ViewGroup;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandSettings;
|
import net.osmand.plus.OsmandSettings;
|
||||||
|
import net.osmand.plus.OsmandSettings.DayNightMode;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.quickaction.QuickAction;
|
import net.osmand.plus.quickaction.QuickAction;
|
||||||
|
@ -20,23 +21,10 @@ public class DayNightModeAction extends QuickAction {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(MapActivity activity) {
|
public void execute(MapActivity activity) {
|
||||||
switch (activity.getMyApplication().getSettings().DAYNIGHT_MODE.get()){
|
if (activity.getMyApplication().getDaynightHelper().isNightMode()) {
|
||||||
case DAY: {
|
activity.getMyApplication().getSettings().DAYNIGHT_MODE.set(OsmandSettings.DayNightMode.DAY);
|
||||||
activity.getMyApplication().getSettings().DAYNIGHT_MODE.set(OsmandSettings.DayNightMode.NIGHT);
|
} else {
|
||||||
break;
|
activity.getMyApplication().getSettings().DAYNIGHT_MODE.set(OsmandSettings.DayNightMode.NIGHT);
|
||||||
}
|
|
||||||
case NIGHT: {
|
|
||||||
activity.getMyApplication().getSettings().DAYNIGHT_MODE.set(OsmandSettings.DayNightMode.DAY);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case AUTO: {
|
|
||||||
activity.getMyApplication().getSettings().DAYNIGHT_MODE.set(OsmandSettings.DayNightMode.DAY);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case SENSOR: {
|
|
||||||
activity.getMyApplication().getSettings().DAYNIGHT_MODE.set(OsmandSettings.DayNightMode.DAY);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,33 +32,28 @@ public class DayNightModeAction extends QuickAction {
|
||||||
public void drawUI(ViewGroup parent, MapActivity activity) {
|
public void drawUI(ViewGroup parent, MapActivity activity) {
|
||||||
View view = LayoutInflater.from(parent.getContext())
|
View view = LayoutInflater.from(parent.getContext())
|
||||||
.inflate(R.layout.quick_action_with_text, parent, false);
|
.inflate(R.layout.quick_action_with_text, parent, false);
|
||||||
|
|
||||||
((TextView) view.findViewById(R.id.text))
|
((TextView) view.findViewById(R.id.text))
|
||||||
.setText(R.string.quick_action_switch_day_night_descr);
|
.setText(R.string.quick_action_switch_day_night_descr);
|
||||||
|
|
||||||
parent.addView(view);
|
parent.addView(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getIconRes(Context context) {
|
public int getIconRes(Context context) {
|
||||||
if(context instanceof MapActivity) {
|
if (context instanceof MapActivity
|
||||||
switch (((MapActivity) context).getMyApplication().getSettings().DAYNIGHT_MODE.get()) {
|
&& ((MapActivity) context).getMyApplication().getDaynightHelper().isNightMode()) {
|
||||||
case NIGHT: {
|
return R.drawable.ic_action_map_day;
|
||||||
return R.drawable.ic_action_map_night;
|
|
||||||
}
|
|
||||||
case AUTO: {
|
|
||||||
return R.drawable.ic_action_map_sunst;
|
|
||||||
}
|
|
||||||
case SENSOR: {
|
|
||||||
return R.drawable.ic_action_map_light_sensor;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return R.drawable.ic_action_map_day;
|
return R.drawable.ic_action_map_night;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getActionText(OsmandApplication application) {
|
public String getActionText(OsmandApplication application) {
|
||||||
return application.getSettings().DAYNIGHT_MODE.get().toHumanString(application) + " Mode";
|
if (application.getDaynightHelper().isNightMode()) {
|
||||||
|
return String.format(application.getString(R.string.quick_action_day_night_mode),
|
||||||
|
DayNightMode.DAY.toHumanString(application));
|
||||||
|
} else {
|
||||||
|
return String.format(application.getString(R.string.quick_action_day_night_mode),
|
||||||
|
DayNightMode.NIGHT.toHumanString(application));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -382,6 +382,17 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void routeCalculationStarted() {
|
||||||
|
WeakReference<MapRouteInfoMenuFragment> fragmentRef = findMenuFragment();
|
||||||
|
MapRouteInfoMenuFragment fragment = fragmentRef != null ? fragmentRef.get() : null;
|
||||||
|
if (fragmentRef != null && fragment.isVisible()) {
|
||||||
|
setRouteCalculationInProgress(true);
|
||||||
|
fragment.updateRouteCalculationProgress(0);
|
||||||
|
fragment.updateControlButtons();
|
||||||
|
fragment.updateInfo();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void updateRouteCalculationProgress(int progress) {
|
public void updateRouteCalculationProgress(int progress) {
|
||||||
WeakReference<MapRouteInfoMenuFragment> fragmentRef = findMenuFragment();
|
WeakReference<MapRouteInfoMenuFragment> fragmentRef = findMenuFragment();
|
||||||
MapRouteInfoMenuFragment fragment = fragmentRef != null ? fragmentRef.get() : null;
|
MapRouteInfoMenuFragment fragment = fragmentRef != null ? fragmentRef.get() : null;
|
||||||
|
@ -397,12 +408,17 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
||||||
public void routeCalculationFinished() {
|
public void routeCalculationFinished() {
|
||||||
WeakReference<MapRouteInfoMenuFragment> fragmentRef = findMenuFragment();
|
WeakReference<MapRouteInfoMenuFragment> fragmentRef = findMenuFragment();
|
||||||
MapRouteInfoMenuFragment fragment = fragmentRef != null ? fragmentRef.get() : null;
|
MapRouteInfoMenuFragment fragment = fragmentRef != null ? fragmentRef.get() : null;
|
||||||
if (fragmentRef != null && fragment.isVisible()) {
|
OsmandApplication app = getApp();
|
||||||
setRouteCalculationInProgress(false);
|
if (app != null && fragmentRef != null && fragment.isVisible()) {
|
||||||
fragment.hideRouteCalculationProgressBar();
|
boolean routeCalculating = app.getRoutingHelper().isRouteBeingCalculated() || app.getTransportRoutingHelper().isRouteBeingCalculated();
|
||||||
fragment.updateControlButtons();
|
if (setRouteCalculationInProgress(routeCalculating)) {
|
||||||
fragment.updateInfo();
|
fragment.updateControlButtons();
|
||||||
fragment.openMenuHalfScreen();
|
fragment.updateInfo();
|
||||||
|
if (!routeCalculationInProgress) {
|
||||||
|
fragment.hideRouteCalculationProgressBar();
|
||||||
|
fragment.openMenuHalfScreen();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -460,7 +476,6 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
||||||
mainView = main;
|
mainView = main;
|
||||||
OsmandApplication app = mapActivity.getMyApplication();
|
OsmandApplication app = mapActivity.getMyApplication();
|
||||||
nightMode = app.getDaynightHelper().isNightModeForMapControls();
|
nightMode = app.getDaynightHelper().isNightModeForMapControls();
|
||||||
TargetPointsHelper targetPointsHelper = app.getTargetPointsHelper();
|
|
||||||
|
|
||||||
updateStartPointView();
|
updateStartPointView();
|
||||||
updateWaypointsView();
|
updateWaypointsView();
|
||||||
|
@ -470,11 +485,26 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
||||||
updateApplicationModesOptions();
|
updateApplicationModesOptions();
|
||||||
updateOptionsButtons();
|
updateOptionsButtons();
|
||||||
|
|
||||||
|
updateCards();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateCards() {
|
||||||
|
MapActivity mapActivity = getMapActivity();
|
||||||
|
if (mapActivity == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
OsmandApplication app = mapActivity.getMyApplication();
|
||||||
|
nightMode = app.getDaynightHelper().isNightModeForMapControls();
|
||||||
|
|
||||||
|
TargetPointsHelper targetPointsHelper = app.getTargetPointsHelper();
|
||||||
|
RoutingHelper routingHelper = app.getRoutingHelper();
|
||||||
|
|
||||||
menuCards.clear();
|
menuCards.clear();
|
||||||
|
|
||||||
boolean bottomShadowVisible = true;
|
boolean bottomShadowVisible = true;
|
||||||
if (isBasicRouteCalculated()) {
|
if (isBasicRouteCalculated()) {
|
||||||
GPXFile gpx = GpxUiHelper.makeGpxFromRoute(app.getRoutingHelper().getRoute(), app);
|
GPXFile gpx = GpxUiHelper.makeGpxFromRoute(routingHelper.getRoute(), app);
|
||||||
if (gpx != null) {
|
if (gpx != null) {
|
||||||
SimpleRouteCard simpleRouteCard = new SimpleRouteCard(mapActivity, gpx);
|
SimpleRouteCard simpleRouteCard = new SimpleRouteCard(mapActivity, gpx);
|
||||||
simpleRouteCard.setListener(this);
|
simpleRouteCard.setListener(this);
|
||||||
|
@ -494,8 +524,11 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
||||||
}
|
}
|
||||||
bottomShadowVisible = routes.size() == 0;
|
bottomShadowVisible = routes.size() == 0;
|
||||||
} else if (routeCalculationInProgress) {
|
} else if (routeCalculationInProgress) {
|
||||||
WarningCard warningCard = new WarningCard(mapActivity);
|
if (app.getTargetPointsHelper().hasTooLongDistanceToNavigate() || routingHelper.isPublicTransportMode()) {
|
||||||
menuCards.add(warningCard);
|
// WarningCard card
|
||||||
|
WarningCard warningCard = new WarningCard(mapActivity);
|
||||||
|
menuCards.add(warningCard);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// Home/work card
|
// Home/work card
|
||||||
HomeWorkCard homeWorkCard = new HomeWorkCard(mapActivity);
|
HomeWorkCard homeWorkCard = new HomeWorkCard(mapActivity);
|
||||||
|
|
|
@ -627,6 +627,11 @@ public class MapRouteInfoMenuFragment extends BaseOsmAndFragment {
|
||||||
|
|
||||||
boolean canceled = false;
|
boolean canceled = false;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAnimationStart(Animator animation) {
|
||||||
|
moving = true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAnimationCancel(Animator animation) {
|
public void onAnimationCancel(Animator animation) {
|
||||||
canceled = true;
|
canceled = true;
|
||||||
|
@ -634,6 +639,7 @@ public class MapRouteInfoMenuFragment extends BaseOsmAndFragment {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAnimationEnd(Animator animation) {
|
public void onAnimationEnd(Animator animation) {
|
||||||
|
moving = false;
|
||||||
if (!canceled) {
|
if (!canceled) {
|
||||||
if (needCloseMenu) {
|
if (needCloseMenu) {
|
||||||
menu.hide();
|
menu.hide();
|
||||||
|
@ -796,7 +802,9 @@ public class MapRouteInfoMenuFragment extends BaseOsmAndFragment {
|
||||||
if (menu != null) {
|
if (menu != null) {
|
||||||
menu.updateInfo(view);
|
menu.updateInfo(view);
|
||||||
applyDayNightMode();
|
applyDayNightMode();
|
||||||
runLayoutListener();
|
if (!moving) {
|
||||||
|
runLayoutListener();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -834,9 +842,6 @@ public class MapRouteInfoMenuFragment extends BaseOsmAndFragment {
|
||||||
}
|
}
|
||||||
TextViewExProgress textViewExProgress = (TextViewExProgress) view.findViewById(R.id.start_button_descr);
|
TextViewExProgress textViewExProgress = (TextViewExProgress) view.findViewById(R.id.start_button_descr);
|
||||||
textViewExProgress.percent = progress / 100f;
|
textViewExProgress.percent = progress / 100f;
|
||||||
int color = nightMode ? R.color.main_font_dark : R.color.card_and_list_background_light;
|
|
||||||
textViewExProgress.color1 = ContextCompat.getColor(mapActivity, color);
|
|
||||||
textViewExProgress.color2 = ContextCompat.getColor(mapActivity, R.color.description_font_and_bottom_sheet_icons);
|
|
||||||
textViewExProgress.invalidate();
|
textViewExProgress.invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1496,7 +1496,10 @@ public class RouteDetailsFragment extends ContextMenuFragment implements PublicT
|
||||||
|
|
||||||
public static CumulativeInfo getRouteDirectionCumulativeInfo(int position, List<RouteDirectionInfo> routeDirections) {
|
public static CumulativeInfo getRouteDirectionCumulativeInfo(int position, List<RouteDirectionInfo> routeDirections) {
|
||||||
CumulativeInfo cumulativeInfo = new CumulativeInfo();
|
CumulativeInfo cumulativeInfo = new CumulativeInfo();
|
||||||
for (int i = position; i < routeDirections.size(); i++) {
|
if (position >= routeDirections.size()) {
|
||||||
|
return cumulativeInfo;
|
||||||
|
}
|
||||||
|
for (int i = 0; i < position; i++) {
|
||||||
RouteDirectionInfo routeDirectionInfo = routeDirections.get(i);
|
RouteDirectionInfo routeDirectionInfo = routeDirections.get(i);
|
||||||
cumulativeInfo.time += routeDirectionInfo.getExpectedTime();
|
cumulativeInfo.time += routeDirectionInfo.getExpectedTime();
|
||||||
cumulativeInfo.distance += routeDirectionInfo.distance;
|
cumulativeInfo.distance += routeDirectionInfo.distance;
|
||||||
|
|
|
@ -64,6 +64,7 @@ public class RoutingHelper {
|
||||||
private String lastRouteCalcErrorShort;
|
private String lastRouteCalcErrorShort;
|
||||||
private long recalculateCountInInterval = 0;
|
private long recalculateCountInInterval = 0;
|
||||||
private int evalWaitInterval = 0;
|
private int evalWaitInterval = 0;
|
||||||
|
private boolean waitingNextJob;
|
||||||
|
|
||||||
private ApplicationMode mode;
|
private ApplicationMode mode;
|
||||||
private OsmandSettings settings;
|
private OsmandSettings settings;
|
||||||
|
@ -872,6 +873,7 @@ public class RoutingHelper {
|
||||||
public void run() {
|
public void run() {
|
||||||
synchronized (RoutingHelper.this) {
|
synchronized (RoutingHelper.this) {
|
||||||
currentRunningJob = this;
|
currentRunningJob = this;
|
||||||
|
waitingNextJob = prevRunningJob != null;
|
||||||
}
|
}
|
||||||
if(prevRunningJob != null) {
|
if(prevRunningJob != null) {
|
||||||
while(prevRunningJob.isAlive()){
|
while(prevRunningJob.isAlive()){
|
||||||
|
@ -883,6 +885,7 @@ public class RoutingHelper {
|
||||||
}
|
}
|
||||||
synchronized (RoutingHelper.this) {
|
synchronized (RoutingHelper.this) {
|
||||||
currentRunningJob = this;
|
currentRunningJob = this;
|
||||||
|
waitingNextJob = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
lastRouteCalcError = null;
|
lastRouteCalcError = null;
|
||||||
|
@ -1086,8 +1089,8 @@ public class RoutingHelper {
|
||||||
return mode == ApplicationMode.PUBLIC_TRANSPORT;
|
return mode == ApplicationMode.PUBLIC_TRANSPORT;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isRouteBeingCalculated(){
|
public boolean isRouteBeingCalculated() {
|
||||||
return currentRunningJob instanceof RouteRecalculationThread;
|
return currentRunningJob instanceof RouteRecalculationThread || waitingNextJob;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showMessage(final String msg){
|
private void showMessage(final String msg){
|
||||||
|
|
|
@ -63,6 +63,7 @@ public class TransportRoutingHelper {
|
||||||
private String lastRouteCalcError;
|
private String lastRouteCalcError;
|
||||||
private String lastRouteCalcErrorShort;
|
private String lastRouteCalcErrorShort;
|
||||||
private long lastTimeEvaluatedRoute = 0;
|
private long lastTimeEvaluatedRoute = 0;
|
||||||
|
private boolean waitingNextJob;
|
||||||
|
|
||||||
private TransportRouteCalculationProgressCallback progressRoute;
|
private TransportRouteCalculationProgressCallback progressRoute;
|
||||||
|
|
||||||
|
@ -253,7 +254,7 @@ public class TransportRoutingHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isRouteBeingCalculated() {
|
public boolean isRouteBeingCalculated() {
|
||||||
return currentRunningJob instanceof RouteRecalculationThread;
|
return currentRunningJob instanceof RouteRecalculationThread || waitingNextJob;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setNewRoute(final List<TransportRouteResult> res) {
|
private void setNewRoute(final List<TransportRouteResult> res) {
|
||||||
|
@ -584,6 +585,7 @@ public class TransportRoutingHelper {
|
||||||
public void run() {
|
public void run() {
|
||||||
synchronized (TransportRoutingHelper.this) {
|
synchronized (TransportRoutingHelper.this) {
|
||||||
currentRunningJob = this;
|
currentRunningJob = this;
|
||||||
|
waitingNextJob = prevRunningJob != null;
|
||||||
}
|
}
|
||||||
if (prevRunningJob != null) {
|
if (prevRunningJob != null) {
|
||||||
while (prevRunningJob.isAlive()) {
|
while (prevRunningJob.isAlive()) {
|
||||||
|
@ -595,6 +597,7 @@ public class TransportRoutingHelper {
|
||||||
}
|
}
|
||||||
synchronized (TransportRoutingHelper.this) {
|
synchronized (TransportRoutingHelper.this) {
|
||||||
currentRunningJob = this;
|
currentRunningJob = this;
|
||||||
|
waitingNextJob = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,6 +73,7 @@ public class MapQuickActionLayer extends OsmandMapLayer implements QuickActionRe
|
||||||
private boolean isLayerOn;
|
private boolean isLayerOn;
|
||||||
|
|
||||||
private boolean nightMode;
|
private boolean nightMode;
|
||||||
|
private boolean currentWidgetState;
|
||||||
|
|
||||||
public MapQuickActionLayer(MapActivity activity, ContextMenuLayer contextMenuLayer) {
|
public MapQuickActionLayer(MapActivity activity, ContextMenuLayer contextMenuLayer) {
|
||||||
this.mapActivity = activity;
|
this.mapActivity = activity;
|
||||||
|
@ -199,35 +200,36 @@ public class MapQuickActionLayer extends OsmandMapLayer implements QuickActionRe
|
||||||
return quickActionsWidget.getVisibility() == View.VISIBLE;
|
return quickActionsWidget.getVisibility() == View.VISIBLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param showWidget
|
* @param showWidget
|
||||||
* @return true, if state was changed
|
* @return true, if state was changed
|
||||||
*/
|
*/
|
||||||
public boolean setLayerState(boolean showWidget) {
|
public boolean setLayerState(boolean showWidget) {
|
||||||
if (isWidgetVisible() == showWidget) // check if state change is needed
|
currentWidgetState = showWidget;
|
||||||
return false;
|
if (isWidgetVisible() == showWidget) // check if state change is needed
|
||||||
|
return false;
|
||||||
|
|
||||||
updateQuickActionButton(showWidget);
|
updateQuickActionButton(showWidget);
|
||||||
if (settings.DO_NOT_USE_ANIMATIONS.get()) {
|
if (settings.DO_NOT_USE_ANIMATIONS.get()) {
|
||||||
quickActionsWidget.setVisibility(!showWidget ? View.GONE : View.VISIBLE);
|
quickActionsWidget.setVisibility(!showWidget ? View.GONE : View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
animateWidget(showWidget);
|
animateWidget(showWidget);
|
||||||
}
|
}
|
||||||
mapActivity.updateStatusBarColor();
|
mapActivity.updateStatusBarColor();
|
||||||
|
|
||||||
if (!showWidget) {
|
if (!showWidget) {
|
||||||
quitMovingMarker();
|
quitMovingMarker();
|
||||||
quickActionRegistry.setUpdatesListener(null);
|
quickActionRegistry.setUpdatesListener(null);
|
||||||
quickActionsWidget.setSelectionListener(null);
|
quickActionsWidget.setSelectionListener(null);
|
||||||
} else {
|
} else {
|
||||||
enterMovingMode(mapActivity.getMapView().getCurrentRotatedTileBox());
|
enterMovingMode(mapActivity.getMapView().getCurrentRotatedTileBox());
|
||||||
quickActionsWidget.setActions(quickActionRegistry.getFilteredQuickActions());
|
quickActionsWidget.setActions(quickActionRegistry.getFilteredQuickActions());
|
||||||
quickActionRegistry.setUpdatesListener(MapQuickActionLayer.this);
|
quickActionRegistry.setUpdatesListener(MapQuickActionLayer.this);
|
||||||
quickActionsWidget.setSelectionListener(MapQuickActionLayer.this);
|
quickActionsWidget.setSelectionListener(MapQuickActionLayer.this);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void animateWidget(final boolean show) {
|
private void animateWidget(final boolean show) {
|
||||||
AnimatorSet set = new AnimatorSet();
|
AnimatorSet set = new AnimatorSet();
|
||||||
|
@ -370,19 +372,19 @@ public class MapQuickActionLayer extends OsmandMapLayer implements QuickActionRe
|
||||||
return py <= quickActionsWidget.getHeight();
|
return py <= quickActionsWidget.getHeight();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDraw(Canvas canvas, RotatedTileBox box, DrawSettings settings) {
|
public void onDraw(Canvas canvas, RotatedTileBox box, DrawSettings settings) {
|
||||||
boolean nightMode = settings != null && settings.isNightMode();
|
boolean nightMode = app.getDaynightHelper().isNightModeForMapControls();
|
||||||
if (isInMovingMarkerMode()) {
|
if (isInMovingMarkerMode()) {
|
||||||
canvas.translate(box.getCenterPixelX() - contextMarker.getWidth() / 2, box.getCenterPixelY() - contextMarker.getHeight());
|
canvas.translate(box.getCenterPixelX() - contextMarker.getWidth() / 2, box.getCenterPixelY() - contextMarker.getHeight());
|
||||||
contextMarker.draw(canvas);
|
contextMarker.draw(canvas);
|
||||||
}
|
}
|
||||||
if (this.nightMode != nightMode) {
|
if (this.nightMode != nightMode) {
|
||||||
this.nightMode = nightMode;
|
this.nightMode = nightMode;
|
||||||
updateQuickActionButton(isWidgetVisible());
|
updateQuickActionButton(currentWidgetState);
|
||||||
}
|
}
|
||||||
setupQuickActionBtnVisibility();
|
setupQuickActionBtnVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupQuickActionBtnVisibility() {
|
private void setupQuickActionBtnVisibility() {
|
||||||
MapContextMenu contextMenu = mapActivity.getContextMenu();
|
MapContextMenu contextMenu = mapActivity.getContextMenu();
|
||||||
|
|
|
@ -681,7 +681,7 @@ public class RouteInfoWidgetsFactory {
|
||||||
if (degreesChanged(cachedDegrees, b) || modeChanged) {
|
if (degreesChanged(cachedDegrees, b) || modeChanged) {
|
||||||
cachedDegrees = b;
|
cachedDegrees = b;
|
||||||
if (b != -1000) {
|
if (b != -1000) {
|
||||||
setText(String.valueOf(b) + "°" + (relative ? "" : " M"), null);
|
setText(OsmAndFormatter.getFormattedAzimuth(b, getOsmandApplication()) + (relative ? "" : " M"), null);
|
||||||
} else {
|
} else {
|
||||||
setText(null, null);
|
setText(null, null);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue