Skip to content
This repository has been archived by the owner on Feb 1, 2025. It is now read-only.

Commit

Permalink
updated libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
y20k committed Jul 28, 2020
1 parent d1ba6a0 commit 89f4edf
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 17 deletions.
2 changes: 2 additions & 0 deletions AUTHORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Trackbook is designed, developed and maintained by: [y20k](https://github.com/y2
### Translations
Chinese version: [yzqzss](https://github.com/yzqzss) | [weblate version history](https://hosted.weblate.org/changes/?lang=zh_HANS-CN&project=trackbook)

Croatian version: [milotype](https://github.com/milotype) | [weblate version history](https://hosted.weblate.org/changes/?lang=hr&project=trackbook)

Danish version: [alexanderlhc](https://github.com/alexanderlhc) | [weblate version history](https://hosted.weblate.org/changes/?lang=da&project=trackbook)

Dutch version: [Heimen Stoffels](https://github.com/Vistaus), [hypothermic](https://github.com/hypothermic) | [weblate version history](https://hosted.weblate.org/changes/?lang=nl&project=trackbook)
Expand Down
14 changes: 7 additions & 7 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ android {
applicationId 'org.y20k.trackbook'
minSdkVersion 25
targetSdkVersion 27
versionCode 41
versionName '2.0.4'
resConfigs "en", "da", "de", "fr", "id", "it", "ja", "nb-rNO", "nl", "sv", "zh-rCN"
versionCode 42
versionName '2.0.5'
resConfigs "en", "da", "de", "fr", "hr", "id", "it", "ja", "nb-rNO", "nl", "sv", "zh-rCN"
}

kotlinOptions {
Expand Down Expand Up @@ -64,11 +64,11 @@ dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])

implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.0"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.0"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.4"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.4"

implementation 'androidx.appcompat:appcompat:1.1.0'
implementation "androidx.core:core-ktx:1.3.0"
implementation "androidx.core:core-ktx:1.3.1"
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0'
implementation 'androidx.coordinatorlayout:coordinatorlayout:1.1.0'
Expand All @@ -81,7 +81,7 @@ dependencies {
implementation "com.google.android.material:material:1.2.0-beta01"
implementation "com.google.code.gson:gson:2.8.6"

implementation "org.osmdroid:osmdroid-android:6.1.6"
implementation "org.osmdroid:osmdroid-android:6.1.8"
}

androidExtensions {
Expand Down
22 changes: 15 additions & 7 deletions app/src/main/java/org/y20k/trackbook/helpers/LengthUnitHelper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,24 @@ object LengthUnitHelper {

/* Converts for the given unit System distance and duration values to a readable velocity string */
fun convertToVelocityString(trackDuration: Long, trackRecordingPause: Long, trackLength: Float, useImperialUnits: Boolean = false) : String {
var speed: String = "0"

// duration minus pause in seconds
val duration: Long = (trackDuration - trackRecordingPause) / 1000L
// speed in km/h / mph
val velocity: Double = convertMetersPerSecond((trackLength / duration), useImperialUnits)
// create readable speed string
var bd: BigDecimal = BigDecimal.valueOf(velocity)
bd = bd.setScale(1, RoundingMode.HALF_UP)

if (duration > 0L) {
// speed in km/h / mph
val velocity: Double = convertMetersPerSecond((trackLength / duration), useImperialUnits)
// create readable speed string
LogHelper.e("TAG", "duration = $duration velocity = $velocity")
var bd: BigDecimal = BigDecimal.valueOf(velocity)
bd = bd.setScale(1, RoundingMode.HALF_UP)
speed = bd.toPlainString()
}

when (useImperialUnits) {
true -> return "${bd.toPlainString()} mph"
false -> return "${bd.toPlainString()} km/h"
true -> return "$speed mph"
false -> return "$speed km/h"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ data class MapFragmentLayoutHolder(var context: Context, var inflater: LayoutInf
// basic map setup
controller = mapView.controller
mapView.isTilesScaledToDpi = true
mapView.setTilesScaledToDpi(true)
mapView.setTileSource(TileSourceFactory.MAPNIK)
mapView.setMultiTouchControls(true)
mapView.zoomController.setVisibility(org.osmdroid.views.CustomZoomButtonsController.Visibility.NEVER)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ data class TrackFragmentLayoutHolder(var context: Context, var inflater: LayoutI

// basic map setup
controller = mapView.controller
mapView.setTilesScaledToDpi(true)
mapView.isTilesScaledToDpi = true
mapView.setTileSource(TileSourceFactory.MAPNIK)
mapView.setMultiTouchControls(true)
mapView.zoomController.setVisibility(org.osmdroid.views.CustomZoomButtonsController.Visibility.NEVER)
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ buildscript {

}
dependencies {
classpath 'com.android.tools.build:gradle:4.0.0'
classpath 'com.android.tools.build:gradle:4.0.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:2.3.0"
// NOTE: Do not place your application dependencies here; they belong
Expand Down

0 comments on commit 89f4edf

Please sign in to comment.