diff --git a/OsmAnd-java/src/main/java/net/osmand/router/GeneralRouter.java b/OsmAnd-java/src/main/java/net/osmand/router/GeneralRouter.java index fad98d466d..be5bba2f5f 100644 --- a/OsmAnd-java/src/main/java/net/osmand/router/GeneralRouter.java +++ b/OsmAnd-java/src/main/java/net/osmand/router/GeneralRouter.java @@ -620,9 +620,7 @@ public class GeneralRouter implements VehicleRouter { public double calculateTurnTime(RouteSegment segment, int segmentEnd, RouteSegment prev, int prevSegmentEnd) { float ts = getPenaltyTransition(segment.getRoad()); float prevTs = getPenaltyTransition(prev.getRoad()); - float totalPenalty = 0; - if (prevTs != ts) { totalPenalty += Math.abs(ts - prevTs) / 2; } @@ -638,7 +636,9 @@ public class GeneralRouter implements VehicleRouter { // } // } // } - + if (shortestRoute) { + return totalPenalty; + } if(segment.getRoad().roundabout() && !prev.getRoad().roundabout()) { double rt = getRoundaboutTurn(); if(rt > 0) { diff --git a/OsmAnd-telegram/src/net/osmand/telegram/TelegramLocationProvider.kt b/OsmAnd-telegram/src/net/osmand/telegram/TelegramLocationProvider.kt index 719e21b886..3b2ddc572a 100644 --- a/OsmAnd-telegram/src/net/osmand/telegram/TelegramLocationProvider.kt +++ b/OsmAnd-telegram/src/net/osmand/telegram/TelegramLocationProvider.kt @@ -4,7 +4,7 @@ import android.annotation.SuppressLint import android.content.Context import android.hardware.* import android.location.Location -import android.os.Looper +import android.os.HandlerThread import android.util.Log import com.google.android.gms.location.* import net.osmand.PlatformUtil @@ -43,11 +43,12 @@ class TelegramLocationProvider(private val app: TelegramApplication) : SensorEve var lastKnownLocation: net.osmand.Location? = null private set + private val locationUpdateHandlerThread = HandlerThread("LocationProviderUpdateHandlerThread") private var fusedLocationProviderClient: FusedLocationProviderClient? = null private val locationRequest = LocationRequest().apply { interval = 1000 - fastestInterval = 500 - maxWaitTime = 2000 + //fastestInterval = 500 + maxWaitTime = 0 priority = LocationRequest.PRIORITY_HIGH_ACCURACY } private val locationCallback = object : LocationCallback() { @@ -81,6 +82,10 @@ class TelegramLocationProvider(private val app: TelegramApplication) : SensorEve fun updateCompassValue(value: Float) } + init { + locationUpdateHandlerThread.start() + } + @SuppressLint("MissingPermission") fun resumeAllUpdates() { if (AndroidUtils.isLocationPermissionAvailable(app) && fusedLocationProviderClient == null) { @@ -89,7 +94,7 @@ class TelegramLocationProvider(private val app: TelegramApplication) : SensorEve try { fusedLocationProviderClient?.requestLocationUpdates( - locationRequest, locationCallback, Looper.myLooper()) + locationRequest, locationCallback, locationUpdateHandlerThread.looper) } catch (unlikely: SecurityException) { Log.d(PlatformUtil.TAG, "Lost location permissions. Couldn't request updates. $unlikely") } diff --git a/OsmAnd-telegram/src/net/osmand/telegram/TelegramService.kt b/OsmAnd-telegram/src/net/osmand/telegram/TelegramService.kt index 2d85e971b0..bc0773b7e4 100644 --- a/OsmAnd-telegram/src/net/osmand/telegram/TelegramService.kt +++ b/OsmAnd-telegram/src/net/osmand/telegram/TelegramService.kt @@ -38,6 +38,7 @@ class TelegramService : Service(), TelegramIncomingMessagesListener, private var updateWidgetHandler: Handler? = null private var updateWidgetThread = HandlerThread("WidgetUpdateServiceThread") + private var locationUpdateHandlerThread = HandlerThread("LocationUpdateServiceThread") // FusedLocationProviderClient - Main class for receiving location updates. private lateinit var fusedLocationProviderClient: FusedLocationProviderClient @@ -62,6 +63,7 @@ class TelegramService : Service(), TelegramIncomingMessagesListener, mHandlerThread.start() tracksHandlerThread.start() updateWidgetThread.start() + locationUpdateHandlerThread.start() updateShareInfoHandler = Handler(mHandlerThread.looper) updateTracksHandler = Handler(tracksHandlerThread.looper) updateWidgetHandler = Handler(updateWidgetThread.looper) @@ -82,11 +84,11 @@ class TelegramService : Service(), TelegramIncomingMessagesListener, // Sets the fastest rate for active location updates. This interval is exact, and your // application will never receive updates more frequently than this value. - fastestInterval = 500 + //fastestInterval = 500 // Sets the maximum time when batched location updates are delivered. Updates may be // delivered sooner than this interval. - maxWaitTime = 2000 + maxWaitTime = 0 priority = LocationRequest.PRIORITY_HIGH_ACCURACY } @@ -166,6 +168,7 @@ class TelegramService : Service(), TelegramIncomingMessagesListener, tracksHandlerThread.quit() mHandlerThread.quit() updateWidgetThread.quit() + locationUpdateHandlerThread.quit() app().showLocationHelper.addOrUpdateStatusWidget(-1, false) usedBy = 0 @@ -198,7 +201,7 @@ class TelegramService : Service(), TelegramIncomingMessagesListener, // request location updates try { fusedLocationProviderClient.requestLocationUpdates( - locationRequest, locationCallback, Looper.myLooper()) + locationRequest, locationCallback, locationUpdateHandlerThread.looper) } catch (unlikely: SecurityException) { Toast.makeText(this, R.string.no_location_permission, Toast.LENGTH_LONG).show() Log.d(PlatformUtil.TAG, "Lost location permissions. Couldn't request updates. $unlikely") diff --git a/OsmAnd/assets/Default_wikivoyage.travel.obf b/OsmAnd/assets/Default_wikivoyage.travel.obf new file mode 100644 index 0000000000..d1ddc30bcf Binary files /dev/null and b/OsmAnd/assets/Default_wikivoyage.travel.obf differ diff --git a/OsmAnd/assets/bundled_assets.xml b/OsmAnd/assets/bundled_assets.xml index d5626ac886..132bf2d6ef 100644 --- a/OsmAnd/assets/bundled_assets.xml +++ b/OsmAnd/assets/bundled_assets.xml @@ -109,4 +109,5 @@ + diff --git a/OsmAnd/build.gradle b/OsmAnd/build.gradle index eb23647924..274135904f 100644 --- a/OsmAnd/build.gradle +++ b/OsmAnd/build.gradle @@ -36,9 +36,9 @@ android { defaultConfig { minSdkVersion System.getenv("MIN_SDK_VERSION") ? System.getenv("MIN_SDK_VERSION").toInteger() : 15 - versionCode 400 + versionCode 390 versionCode System.getenv("APK_NUMBER_VERSION") ? System.getenv("APK_NUMBER_VERSION").toInteger() : versionCode - versionName "4.0.0" + versionName "3.9.0" versionName System.getenv("APK_VERSION")? System.getenv("APK_VERSION").toString(): versionName versionName System.getenv("APK_VERSION_SUFFIX")? versionName + System.getenv("APK_VERSION_SUFFIX").toString(): versionName } diff --git a/OsmAnd/res/layout/bottom_sheet_button_with_icon.xml b/OsmAnd/res/layout/bottom_sheet_button_with_icon.xml index b184a3bea7..7c56093fbc 100644 --- a/OsmAnd/res/layout/bottom_sheet_button_with_icon.xml +++ b/OsmAnd/res/layout/bottom_sheet_button_with_icon.xml @@ -12,6 +12,7 @@ android:clickable="true" android:focusable="true" android:gravity="center_vertical" + android:minHeight="@dimen/bottom_sheet_list_item_height" android:orientation="horizontal" android:paddingStart="@dimen/content_padding_small" android:paddingLeft="@dimen/content_padding_small" @@ -34,7 +35,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:duplicateParentState="true" - android:letterSpacing="@dimen/description_letter_spacing" + android:letterSpacing="@dimen/text_button_letter_spacing" android:textSize="@dimen/default_desc_text_size" osmand:typeface="@string/font_roboto_medium" tools:text="Title" @@ -45,7 +46,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:duplicateParentState="true" - android:letterSpacing="@dimen/description_letter_spacing" + android:letterSpacing="@dimen/text_button_letter_spacing" android:textSize="@dimen/default_desc_text_size" android:visibility="gone" osmand:typeface="@string/font_roboto_medium" diff --git a/OsmAnd/res/layout/travel_needed_map_item.xml b/OsmAnd/res/layout/travel_needed_map_item.xml index 23099784fe..e103901a02 100644 --- a/OsmAnd/res/layout/travel_needed_map_item.xml +++ b/OsmAnd/res/layout/travel_needed_map_item.xml @@ -78,20 +78,20 @@