mark end of a track with a flag icon (see #95)

master
y20k 2021-03-04 21:03:12 +01:00
parent dd3a96e350
commit 3f9dd74797
No known key found for this signature in database
GPG Key ID: 824D4259F41FAFF6
9 changed files with 52 additions and 25 deletions

View File

@ -1,6 +1,6 @@
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'kotlin-parcelize'
apply plugin: 'androidx.navigation.safeargs.kotlin'
android {
@ -51,26 +51,24 @@ android {
dependencies {
// Kotlin
def coroutinesVersion = "1.4.1"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.9'
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9'
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutinesVersion"
// AndroidX
def navigationVersion = "2.3.3"
implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
implementation 'androidx.core:core-ktx:1.3.2'
implementation "androidx.navigation:navigation-fragment-ktx:$navigation_version"
implementation "androidx.navigation:navigation-ui-ktx:$navigation_version"
implementation "androidx.navigation:navigation-fragment-ktx:$navigationVersion"
implementation "androidx.navigation:navigation-ui-ktx:$navigationVersion"
implementation 'androidx.preference:preference-ktx:1.1.1'
implementation 'com.google.android.material:material:1.2.1'
implementation 'com.google.android.material:material:1.3.0'
// Gson
implementation 'com.google.code.gson:gson:2.8.6'
// OpenStreetMap
implementation 'org.osmdroid:osmdroid-android:6.1.8'
}
androidExtensions {
experimental = true
implementation 'org.osmdroid:osmdroid-android:6.1.10'
}

View File

@ -21,7 +21,7 @@ import android.content.Context
import android.os.Parcelable
import androidx.annotation.Keep
import com.google.gson.annotations.Expose
import kotlinx.android.parcel.Parcelize
import kotlinx.parcelize.Parcelize
import org.y20k.trackbook.Keys
import org.y20k.trackbook.helpers.DateTimeHelper
import java.util.*
@ -75,4 +75,4 @@ data class Track (@Expose var trackFormatVersion: Int = Keys.CURRENT_TRACK_FORMA
}
}
}

View File

@ -20,7 +20,7 @@ package org.y20k.trackbook.core
import android.os.Parcelable
import androidx.annotation.Keep
import com.google.gson.annotations.Expose
import kotlinx.android.parcel.Parcelize
import kotlinx.parcelize.Parcelize
import org.y20k.trackbook.Keys
import org.y20k.trackbook.helpers.TrackHelper
import java.util.*
@ -50,4 +50,4 @@ data class Tracklist (@Expose val tracklistFormatVersion: Int = Keys.CURRENT_TRA
return Tracklist(tracklistFormatVersion, mutableListOf<TracklistElement>().apply { addAll(tracklistElements) }, modificationDate)
}
}
}

View File

@ -20,7 +20,7 @@ package org.y20k.trackbook.core
import android.os.Parcelable
import androidx.annotation.Keep
import com.google.gson.annotations.Expose
import kotlinx.android.parcel.Parcelize
import kotlinx.parcelize.Parcelize
import java.util.*
@ -43,4 +43,4 @@ data class TracklistElement(@Expose var name: String,
return date.time
}
}
}

View File

@ -21,7 +21,7 @@ import android.location.Location
import android.os.Parcelable
import androidx.annotation.Keep
import com.google.gson.annotations.Expose
import kotlinx.android.parcel.Parcelize
import kotlinx.parcelize.Parcelize
/*
@ -52,4 +52,4 @@ data class WayPoint(@Expose val provider: String,
return location
}
}
}

View File

@ -92,8 +92,9 @@ class MapOverlayHelper (private var markerListener: MarkerListener) {
val overlayItems: ArrayList<OverlayItem> = ArrayList<OverlayItem>()
val wayPoints: MutableList<WayPoint> = track.wayPoints
val maxIndex: Int = wayPoints.size - 1
wayPoints.forEach { wayPoint ->
wayPoints.forEachIndexed { index: Int, wayPoint: WayPoint ->
// create marker
val newMarker: Drawable
@ -111,7 +112,14 @@ class MapOverlayHelper (private var markerListener: MarkerListener) {
}
// CASE: Recording is paused/stopped
else -> {
if (wayPoint.starred) {
if (index == maxIndex) {
if (wayPoint.starred) {
newMarker = ContextCompat.getDrawable(context, R.drawable.ic_marker_track_end_starred_blue_36dp)!!
} else {
newMarker = ContextCompat.getDrawable(context, R.drawable.ic_marker_track_end_blue_36dp)!!
}
}
else if (wayPoint.starred) {
newMarker = ContextCompat.getDrawable(context, R.drawable.ic_star_blue_24dp)!!
} else if (wayPoint.isStopOver) {
newMarker = ContextCompat.getDrawable(context, R.drawable.ic_marker_track_location_grey_24dp)!!
@ -159,4 +167,4 @@ class MapOverlayHelper (private var markerListener: MarkerListener) {
})
}
}
}

View File

@ -0,0 +1,14 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="36dp"
android:height="36dp"
android:viewportWidth="144"
android:viewportHeight="144">
<path
android:pathData="M72,72m-24,0a24,24 0,1 1,48 0a24,24 0,1 1,-48 0"
android:fillColor="#3c98db"
/>
<path
android:pathData="m107.715,8.24 l-1.694,-8.471L67.903,-0.23L67.903,71.77L76.374,71.77L76.374,42.123h23.718l1.694,8.471h29.647L131.433,8.24Z"
android:strokeWidth="4.23529"
android:fillColor="#3c98db"/>
</vector>

View File

@ -0,0 +1,7 @@
<vector android:height="36dp" android:viewportHeight="144"
android:viewportWidth="144" android:width="36dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="#3c98db"
android:pathData="M72,95.08 L96.72,110 90.16,81.88 112,62.96 83.24,60.52 72,34 60.76,60.52 32,62.96 53.84,81.88 47.28,110Z" android:strokeWidth="16.9412"/>
<path android:fillColor="#3c98db"
android:pathData="m107.715,8.24 l-1.694,-8.471L67.903,-0.23L67.903,71.77L76.374,71.77L76.374,42.123h23.718l1.694,8.471h29.647L131.433,8.24Z" android:strokeWidth="4.23529"/>
</vector>

View File

@ -2,15 +2,15 @@
buildscript {
ext {
kotlin_version = '1.4.21'
navigation_version = '2.3.2'
kotlin_version = '1.4.31'
navigation_version = '2.3.3'
}
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:4.1.1'
classpath 'com.android.tools.build:gradle:4.1.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$navigation_version"