Merge branch 'r3.0' of ssh://github.com/osmandapp/Osmand into WikivoyageSharingLinks
This commit is contained in:
commit
fff98d810d
8 changed files with 94 additions and 109 deletions
|
@ -193,38 +193,6 @@
|
||||||
android:src="@drawable/headliner_close"/>
|
android:src="@drawable/headliner_close"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<!-- CONTEXT MENU -->
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/map_context_menu_layout"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="bottom"
|
|
||||||
android:background="@drawable/btn_flat"
|
|
||||||
android:visibility="gone">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="fill_parent"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:ellipsize="end"
|
|
||||||
android:gravity="center">
|
|
||||||
</TextView>
|
|
||||||
|
|
||||||
<ImageButton
|
|
||||||
android:layout_width="@dimen/map_address_height"
|
|
||||||
android:layout_height="@dimen/map_address_height"
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:background="@drawable/btn_circle_transparent"
|
|
||||||
tools:src="@drawable/ic_action_test_light"/>
|
|
||||||
|
|
||||||
<ImageButton
|
|
||||||
android:layout_width="@dimen/map_address_height"
|
|
||||||
android:layout_height="@dimen/map_address_height"
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:background="@drawable/btn_circle_transparent"
|
|
||||||
tools:src="@drawable/ic_action_test_light"/>
|
|
||||||
</LinearLayout>
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
<!-- RIGHT BUTTONS -->
|
<!-- RIGHT BUTTONS -->
|
||||||
|
@ -274,6 +242,17 @@
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
<ProgressBar
|
||||||
|
android:id="@+id/map_horizontal_progress"
|
||||||
|
style="?android:attr/progressBarStyleHorizontal"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:max="100"
|
||||||
|
android:minHeight="0dp"
|
||||||
|
android:visibility="gone"
|
||||||
|
tools:progress="60"
|
||||||
|
tools:visibility="visible" />
|
||||||
|
|
||||||
<include
|
<include
|
||||||
layout="@layout/move_marker_bottom_sheet"
|
layout="@layout/move_marker_bottom_sheet"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
|
@ -603,16 +603,6 @@
|
||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
<ProgressBar
|
|
||||||
android:id="@+id/map_horizontal_progress"
|
|
||||||
style="?android:attr/progressBarStyleHorizontal"
|
|
||||||
android:layout_width="@dimen/map_routing_progress_width"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginLeft="@dimen/map_button_margin"
|
|
||||||
android:layout_marginRight="@dimen/map_button_margin"
|
|
||||||
android:max="100"
|
|
||||||
android:progress="60"
|
|
||||||
android:visibility="gone"/>
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
|
@ -233,7 +233,18 @@
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
<FrameLayout
|
<ProgressBar
|
||||||
|
android:id="@+id/map_horizontal_progress"
|
||||||
|
style="?android:attr/progressBarStyleHorizontal"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:max="100"
|
||||||
|
android:minHeight="0dp"
|
||||||
|
android:visibility="gone"
|
||||||
|
tools:progress="60"
|
||||||
|
tools:visibility="visible" />
|
||||||
|
|
||||||
|
<FrameLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
@ -251,36 +262,6 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"/>
|
android:layout_height="match_parent"/>
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/map_context_menu_layout"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="bottom"
|
|
||||||
android:background="@drawable/btn_flat"
|
|
||||||
android:visibility="gone">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="fill_parent"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:ellipsize="end"
|
|
||||||
android:gravity="center">
|
|
||||||
</TextView>
|
|
||||||
|
|
||||||
<ImageButton
|
|
||||||
android:layout_width="@dimen/map_address_height"
|
|
||||||
android:layout_height="@dimen/map_address_height"
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:background="@drawable/btn_circle_transparent"
|
|
||||||
tools:src="@drawable/ic_action_test_light"/>
|
|
||||||
|
|
||||||
<ImageButton
|
|
||||||
android:layout_width="@dimen/map_address_height"
|
|
||||||
android:layout_height="@dimen/map_address_height"
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:background="@drawable/btn_circle_transparent"
|
|
||||||
tools:src="@drawable/ic_action_test_light"/>
|
|
||||||
</LinearLayout>
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
|
@ -647,16 +647,6 @@
|
||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
<ProgressBar
|
|
||||||
android:id="@+id/map_horizontal_progress"
|
|
||||||
style="?android:attr/progressBarStyleHorizontal"
|
|
||||||
android:layout_width="@dimen/map_routing_progress_width"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginLeft="@dimen/map_button_margin"
|
|
||||||
android:layout_marginRight="@dimen/map_button_margin"
|
|
||||||
android:max="100"
|
|
||||||
android:progress="60"
|
|
||||||
android:visibility="gone"/>
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
|
|
|
@ -907,27 +907,26 @@ public class AudioVideoNotesPlugin extends OsmandPlugin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void recordVideo(final double lat, final double lon, final MapActivity mapActivity, final boolean forceExternal) {
|
public void recordVideo(final double lat, final double lon, final MapActivity mapActivity,
|
||||||
if (AV_EXTERNAL_RECORDER.get() || forceExternal) {
|
final boolean forceExternal) {
|
||||||
captureVideoExternal(lat, lon, mapActivity);
|
if (ActivityCompat.checkSelfPermission(mapActivity, Manifest.permission.CAMERA) == PackageManager.PERMISSION_GRANTED
|
||||||
} else {
|
&& ActivityCompat.checkSelfPermission(mapActivity, Manifest.permission.RECORD_AUDIO) == PackageManager.PERMISSION_GRANTED) {
|
||||||
if (ActivityCompat.checkSelfPermission(mapActivity, Manifest.permission.CAMERA)
|
if (AV_EXTERNAL_RECORDER.get() || forceExternal) {
|
||||||
== PackageManager.PERMISSION_GRANTED
|
captureVideoExternal(lat, lon, mapActivity);
|
||||||
&& ActivityCompat.checkSelfPermission(mapActivity, Manifest.permission.RECORD_AUDIO)
|
} else {
|
||||||
== PackageManager.PERMISSION_GRANTED) {
|
|
||||||
openCamera();
|
openCamera();
|
||||||
if (cam != null) {
|
if (cam != null) {
|
||||||
initRecMenu(AVActionType.REC_VIDEO, lat, lon);
|
initRecMenu(AVActionType.REC_VIDEO, lat, lon);
|
||||||
recordVideoCamera(lat, lon, mapActivity);
|
recordVideoCamera(lat, lon, mapActivity);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
actionLat = lat;
|
|
||||||
actionLon = lon;
|
|
||||||
ActivityCompat.requestPermissions(mapActivity,
|
|
||||||
new String[]{Manifest.permission.CAMERA, Manifest.permission.RECORD_AUDIO},
|
|
||||||
CAMERA_FOR_VIDEO_REQUEST_CODE);
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
actionLat = lat;
|
||||||
|
actionLon = lon;
|
||||||
|
ActivityCompat.requestPermissions(mapActivity, new String[] { Manifest.permission.CAMERA,
|
||||||
|
Manifest.permission.RECORD_AUDIO }, CAMERA_FOR_VIDEO_REQUEST_CODE);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void recordVideoCamera(final double lat, final double lon, final MapActivity mapActivity) {
|
public void recordVideoCamera(final double lat, final double lon, final MapActivity mapActivity) {
|
||||||
|
|
|
@ -381,7 +381,7 @@ public class GpxUiHelper {
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
|
|
||||||
int position = selectedPosition[0];
|
int position = selectedPosition[0];
|
||||||
if (position != -1) {
|
if (position != -1 && position < list.size()) {
|
||||||
if (showCurrentGpx && position == 0) {
|
if (showCurrentGpx && position == 0) {
|
||||||
callbackWithObject.processResult(null);
|
callbackWithObject.processResult(null);
|
||||||
app.getSettings().LAST_SELECTED_GPX_TRACK_FOR_NEW_POINT.set(null);
|
app.getSettings().LAST_SELECTED_GPX_TRACK_FOR_NEW_POINT.set(null);
|
||||||
|
|
|
@ -5,6 +5,7 @@ import android.content.Context;
|
||||||
import net.osmand.Location;
|
import net.osmand.Location;
|
||||||
import net.osmand.binary.BinaryMapRouteReaderAdapter.RouteRegion;
|
import net.osmand.binary.BinaryMapRouteReaderAdapter.RouteRegion;
|
||||||
import net.osmand.binary.BinaryMapRouteReaderAdapter.RouteTypeRule;
|
import net.osmand.binary.BinaryMapRouteReaderAdapter.RouteTypeRule;
|
||||||
|
import net.osmand.binary.RouteDataObject;
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
import net.osmand.data.LocationPoint;
|
import net.osmand.data.LocationPoint;
|
||||||
import net.osmand.plus.ApplicationMode;
|
import net.osmand.plus.ApplicationMode;
|
||||||
|
@ -13,6 +14,7 @@ import net.osmand.plus.R;
|
||||||
import net.osmand.plus.routing.AlarmInfo.AlarmInfoType;
|
import net.osmand.plus.routing.AlarmInfo.AlarmInfoType;
|
||||||
import net.osmand.router.RouteSegmentResult;
|
import net.osmand.router.RouteSegmentResult;
|
||||||
import net.osmand.router.TurnType;
|
import net.osmand.router.TurnType;
|
||||||
|
import net.osmand.util.Algorithms;
|
||||||
import net.osmand.util.MapUtils;
|
import net.osmand.util.MapUtils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -74,7 +76,7 @@ public class RouteCalculationResult {
|
||||||
addMissingTurnsToRoute(locations, localDirections, params.start,params.end,
|
addMissingTurnsToRoute(locations, localDirections, params.start,params.end,
|
||||||
params.mode, params.ctx, params.leftSide);
|
params.mode, params.ctx, params.leftSide);
|
||||||
// if there is no closest points to start - add it
|
// if there is no closest points to start - add it
|
||||||
introduceFirstPointAndLastPoint(locations, localDirections, null, params.start, params.end);
|
introduceFirstPointAndLastPoint(locations, localDirections, null, params.start, params.end, params.ctx);
|
||||||
}
|
}
|
||||||
this.appMode = params.mode;
|
this.appMode = params.mode;
|
||||||
this.locations = Collections.unmodifiableList(locations);
|
this.locations = Collections.unmodifiableList(locations);
|
||||||
|
@ -99,7 +101,7 @@ public class RouteCalculationResult {
|
||||||
List<Location> locations = new ArrayList<Location>();
|
List<Location> locations = new ArrayList<Location>();
|
||||||
ArrayList<AlarmInfo> alarms = new ArrayList<AlarmInfo>();
|
ArrayList<AlarmInfo> alarms = new ArrayList<AlarmInfo>();
|
||||||
List<RouteSegmentResult> segments = convertVectorResult(computeDirections, locations, list, alarms, ctx);
|
List<RouteSegmentResult> segments = convertVectorResult(computeDirections, locations, list, alarms, ctx);
|
||||||
introduceFirstPointAndLastPoint(locations, computeDirections, segments, start, end);
|
introduceFirstPointAndLastPoint(locations, computeDirections, segments, start, end, ctx);
|
||||||
|
|
||||||
this.locations = Collections.unmodifiableList(locations);
|
this.locations = Collections.unmodifiableList(locations);
|
||||||
this.segments = Collections.unmodifiableList(segments);
|
this.segments = Collections.unmodifiableList(segments);
|
||||||
|
@ -584,8 +586,9 @@ public class RouteCalculationResult {
|
||||||
* If beginning is too far from start point, then introduce GO Ahead
|
* If beginning is too far from start point, then introduce GO Ahead
|
||||||
* @param end
|
* @param end
|
||||||
*/
|
*/
|
||||||
private static void introduceFirstPointAndLastPoint(List<Location> locations, List<RouteDirectionInfo> directions, List<RouteSegmentResult> segs, Location start,
|
private static void introduceFirstPointAndLastPoint(List<Location> locations, List<RouteDirectionInfo> directions,
|
||||||
LatLon end) {
|
List<RouteSegmentResult> segs, Location start, LatLon end,
|
||||||
|
OsmandApplication ctx) {
|
||||||
if (!locations.isEmpty() && locations.get(0).distanceTo(start) > 50) {
|
if (!locations.isEmpty() && locations.get(0).distanceTo(start) > 50) {
|
||||||
// add start point
|
// add start point
|
||||||
locations.add(0, start);
|
locations.add(0, start);
|
||||||
|
@ -619,6 +622,16 @@ public class RouteCalculationResult {
|
||||||
}
|
}
|
||||||
// Wrong AvgSpeed for the last turn can cause significantly wrong total travel time if calculated route ends on a GPX route segment (then last turn is where GPX is joined again)
|
// Wrong AvgSpeed for the last turn can cause significantly wrong total travel time if calculated route ends on a GPX route segment (then last turn is where GPX is joined again)
|
||||||
RouteDirectionInfo info = new RouteDirectionInfo(lastDirInf != null ? lastDirInf.getAverageSpeed() : 1, TurnType.valueOf(type, false));
|
RouteDirectionInfo info = new RouteDirectionInfo(lastDirInf != null ? lastDirInf.getAverageSpeed() : 1, TurnType.valueOf(type, false));
|
||||||
|
if (segs != null) {
|
||||||
|
RouteSegmentResult lastSegmentResult = segs.get(segs.size() - 1);
|
||||||
|
RouteDataObject routeDataObject = lastSegmentResult.getObject();
|
||||||
|
info.setRef(routeDataObject.getRef(ctx.getSettings().MAP_PREFERRED_LOCALE.get(),
|
||||||
|
ctx.getSettings().MAP_TRANSLITERATE_NAMES.get(), lastSegmentResult.isForwardDirection()));
|
||||||
|
info.setStreetName(routeDataObject.getName(ctx.getSettings().MAP_PREFERRED_LOCALE.get(),
|
||||||
|
ctx.getSettings().MAP_TRANSLITERATE_NAMES.get()));
|
||||||
|
info.setDestinationName(routeDataObject.getDestinationName(ctx.getSettings().MAP_PREFERRED_LOCALE.get(),
|
||||||
|
ctx.getSettings().MAP_TRANSLITERATE_NAMES.get(), lastSegmentResult.isForwardDirection()));
|
||||||
|
}
|
||||||
info.distance = 0;
|
info.distance = 0;
|
||||||
info.afterLeftTime = 0;
|
info.afterLeftTime = 0;
|
||||||
info.routePointOffset = locations.size() - 1;
|
info.routePointOffset = locations.size() - 1;
|
||||||
|
@ -689,6 +702,18 @@ public class RouteCalculationResult {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public RouteSegmentResult getNextStreetSegmentResult() {
|
||||||
|
int cs = currentRoute > 0 ? currentRoute - 1 : 0;
|
||||||
|
while(cs < segments.size()) {
|
||||||
|
RouteSegmentResult segmentResult = segments.get(cs);
|
||||||
|
if (!Algorithms.isEmpty(segmentResult.getObject().getName())) {
|
||||||
|
return segmentResult;
|
||||||
|
}
|
||||||
|
cs++;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public List<RouteSegmentResult> getUpcomingTunnel(float distToStart) {
|
public List<RouteSegmentResult> getUpcomingTunnel(float distToStart) {
|
||||||
int cs = currentRoute > 0 ? currentRoute - 1 : 0;
|
int cs = currentRoute > 0 ? currentRoute - 1 : 0;
|
||||||
if(cs < segments.size()) {
|
if(cs < segments.size()) {
|
||||||
|
|
|
@ -783,19 +783,40 @@ public class RoutingHelper {
|
||||||
}
|
}
|
||||||
RouteSegmentResult rs = getCurrentSegmentResult();
|
RouteSegmentResult rs = getCurrentSegmentResult();
|
||||||
if(rs != null) {
|
if(rs != null) {
|
||||||
String nm = rs.getObject().getName(settings.MAP_PREFERRED_LOCALE.get(), settings.MAP_TRANSLITERATE_NAMES.get());
|
String name = getRouteSegmentStreetName(rs);
|
||||||
String rf = rs.getObject().getRef(settings.MAP_PREFERRED_LOCALE.get(), settings.MAP_TRANSLITERATE_NAMES.get(), rs.isForwardDirection());
|
if (!Algorithms.isEmpty(name)) {
|
||||||
String dn = rs.getObject().getDestinationName(settings.MAP_PREFERRED_LOCALE.get(),
|
return name;
|
||||||
settings.MAP_TRANSLITERATE_NAMES.get(), rs.isForwardDirection());
|
}
|
||||||
return formatStreetName(nm, rf, dn, "»");
|
}
|
||||||
|
rs = getNextStreetSegmentResult();
|
||||||
|
if(rs != null) {
|
||||||
|
String name = getRouteSegmentStreetName(rs);
|
||||||
|
if (!Algorithms.isEmpty(name)) {
|
||||||
|
if(next != null) {
|
||||||
|
next[0] = TurnType.valueOf(TurnType.C, false);
|
||||||
|
}
|
||||||
|
return name;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public RouteSegmentResult getCurrentSegmentResult() {
|
private String getRouteSegmentStreetName(RouteSegmentResult rs) {
|
||||||
|
String nm = rs.getObject().getName(settings.MAP_PREFERRED_LOCALE.get(), settings.MAP_TRANSLITERATE_NAMES.get());
|
||||||
|
String rf = rs.getObject().getRef(settings.MAP_PREFERRED_LOCALE.get(), settings.MAP_TRANSLITERATE_NAMES.get(), rs.isForwardDirection());
|
||||||
|
String dn = rs.getObject().getDestinationName(settings.MAP_PREFERRED_LOCALE.get(),
|
||||||
|
settings.MAP_TRANSLITERATE_NAMES.get(), rs.isForwardDirection());
|
||||||
|
return formatStreetName(nm, rf, dn, "»");
|
||||||
|
}
|
||||||
|
|
||||||
|
public RouteSegmentResult getCurrentSegmentResult() {
|
||||||
return route.getCurrentSegmentResult();
|
return route.getCurrentSegmentResult();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public RouteSegmentResult getNextStreetSegmentResult() {
|
||||||
|
return route.getNextStreetSegmentResult();
|
||||||
|
}
|
||||||
|
|
||||||
public List<RouteSegmentResult> getUpcomingTunnel(float distToStart) {
|
public List<RouteSegmentResult> getUpcomingTunnel(float distToStart) {
|
||||||
return route.getUpcomingTunnel(distToStart);
|
return route.getUpcomingTunnel(distToStart);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue