mark end of a track with a flag icon (see #95)
This commit is contained in:
parent
dd3a96e350
commit
3f9dd74797
9 changed files with 52 additions and 25 deletions
|
@ -1,6 +1,6 @@
|
||||||
apply plugin: 'com.android.application'
|
apply plugin: 'com.android.application'
|
||||||
apply plugin: 'kotlin-android'
|
apply plugin: 'kotlin-android'
|
||||||
apply plugin: 'kotlin-android-extensions'
|
apply plugin: 'kotlin-parcelize'
|
||||||
apply plugin: 'androidx.navigation.safeargs.kotlin'
|
apply plugin: 'androidx.navigation.safeargs.kotlin'
|
||||||
|
|
||||||
android {
|
android {
|
||||||
|
@ -51,26 +51,24 @@ android {
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
// Kotlin
|
// Kotlin
|
||||||
|
def coroutinesVersion = "1.4.1"
|
||||||
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
|
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:$coroutinesVersion"
|
||||||
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.9'
|
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$coroutinesVersion"
|
||||||
|
|
||||||
// AndroidX
|
// AndroidX
|
||||||
|
def navigationVersion = "2.3.3"
|
||||||
implementation 'androidx.appcompat:appcompat:1.2.0'
|
implementation 'androidx.appcompat:appcompat:1.2.0'
|
||||||
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
|
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
|
||||||
implementation 'androidx.core:core-ktx:1.3.2'
|
implementation 'androidx.core:core-ktx:1.3.2'
|
||||||
implementation "androidx.navigation:navigation-fragment-ktx:$navigation_version"
|
implementation "androidx.navigation:navigation-fragment-ktx:$navigationVersion"
|
||||||
implementation "androidx.navigation:navigation-ui-ktx:$navigation_version"
|
implementation "androidx.navigation:navigation-ui-ktx:$navigationVersion"
|
||||||
implementation 'androidx.preference:preference-ktx:1.1.1'
|
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
|
// Gson
|
||||||
implementation 'com.google.code.gson:gson:2.8.6'
|
implementation 'com.google.code.gson:gson:2.8.6'
|
||||||
|
|
||||||
// OpenStreetMap
|
// OpenStreetMap
|
||||||
implementation 'org.osmdroid:osmdroid-android:6.1.8'
|
implementation 'org.osmdroid:osmdroid-android:6.1.10'
|
||||||
}
|
|
||||||
|
|
||||||
androidExtensions {
|
|
||||||
experimental = true
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ import android.content.Context
|
||||||
import android.os.Parcelable
|
import android.os.Parcelable
|
||||||
import androidx.annotation.Keep
|
import androidx.annotation.Keep
|
||||||
import com.google.gson.annotations.Expose
|
import com.google.gson.annotations.Expose
|
||||||
import kotlinx.android.parcel.Parcelize
|
import kotlinx.parcelize.Parcelize
|
||||||
import org.y20k.trackbook.Keys
|
import org.y20k.trackbook.Keys
|
||||||
import org.y20k.trackbook.helpers.DateTimeHelper
|
import org.y20k.trackbook.helpers.DateTimeHelper
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
@ -75,4 +75,4 @@ data class Track (@Expose var trackFormatVersion: Int = Keys.CURRENT_TRACK_FORMA
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ package org.y20k.trackbook.core
|
||||||
import android.os.Parcelable
|
import android.os.Parcelable
|
||||||
import androidx.annotation.Keep
|
import androidx.annotation.Keep
|
||||||
import com.google.gson.annotations.Expose
|
import com.google.gson.annotations.Expose
|
||||||
import kotlinx.android.parcel.Parcelize
|
import kotlinx.parcelize.Parcelize
|
||||||
import org.y20k.trackbook.Keys
|
import org.y20k.trackbook.Keys
|
||||||
import org.y20k.trackbook.helpers.TrackHelper
|
import org.y20k.trackbook.helpers.TrackHelper
|
||||||
import java.util.*
|
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)
|
return Tracklist(tracklistFormatVersion, mutableListOf<TracklistElement>().apply { addAll(tracklistElements) }, modificationDate)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ package org.y20k.trackbook.core
|
||||||
import android.os.Parcelable
|
import android.os.Parcelable
|
||||||
import androidx.annotation.Keep
|
import androidx.annotation.Keep
|
||||||
import com.google.gson.annotations.Expose
|
import com.google.gson.annotations.Expose
|
||||||
import kotlinx.android.parcel.Parcelize
|
import kotlinx.parcelize.Parcelize
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
|
|
||||||
|
@ -43,4 +43,4 @@ data class TracklistElement(@Expose var name: String,
|
||||||
return date.time
|
return date.time
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ import android.location.Location
|
||||||
import android.os.Parcelable
|
import android.os.Parcelable
|
||||||
import androidx.annotation.Keep
|
import androidx.annotation.Keep
|
||||||
import com.google.gson.annotations.Expose
|
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
|
return location
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,8 +92,9 @@ class MapOverlayHelper (private var markerListener: MarkerListener) {
|
||||||
|
|
||||||
val overlayItems: ArrayList<OverlayItem> = ArrayList<OverlayItem>()
|
val overlayItems: ArrayList<OverlayItem> = ArrayList<OverlayItem>()
|
||||||
val wayPoints: MutableList<WayPoint> = track.wayPoints
|
val wayPoints: MutableList<WayPoint> = track.wayPoints
|
||||||
|
val maxIndex: Int = wayPoints.size - 1
|
||||||
|
|
||||||
wayPoints.forEach { wayPoint ->
|
wayPoints.forEachIndexed { index: Int, wayPoint: WayPoint ->
|
||||||
// create marker
|
// create marker
|
||||||
val newMarker: Drawable
|
val newMarker: Drawable
|
||||||
|
|
||||||
|
@ -111,7 +112,14 @@ class MapOverlayHelper (private var markerListener: MarkerListener) {
|
||||||
}
|
}
|
||||||
// CASE: Recording is paused/stopped
|
// CASE: Recording is paused/stopped
|
||||||
else -> {
|
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)!!
|
newMarker = ContextCompat.getDrawable(context, R.drawable.ic_star_blue_24dp)!!
|
||||||
} else if (wayPoint.isStopOver) {
|
} else if (wayPoint.isStopOver) {
|
||||||
newMarker = ContextCompat.getDrawable(context, R.drawable.ic_marker_track_location_grey_24dp)!!
|
newMarker = ContextCompat.getDrawable(context, R.drawable.ic_marker_track_location_grey_24dp)!!
|
||||||
|
@ -159,4 +167,4 @@ class MapOverlayHelper (private var markerListener: MarkerListener) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
14
app/src/main/res/drawable/ic_marker_track_end_blue_36dp.xml
Normal file
14
app/src/main/res/drawable/ic_marker_track_end_blue_36dp.xml
Normal 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>
|
|
@ -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>
|
|
@ -2,15 +2,15 @@
|
||||||
|
|
||||||
buildscript {
|
buildscript {
|
||||||
ext {
|
ext {
|
||||||
kotlin_version = '1.4.21'
|
kotlin_version = '1.4.31'
|
||||||
navigation_version = '2.3.2'
|
navigation_version = '2.3.3'
|
||||||
}
|
}
|
||||||
repositories {
|
repositories {
|
||||||
google()
|
google()
|
||||||
jcenter()
|
jcenter()
|
||||||
}
|
}
|
||||||
dependencies {
|
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 "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$navigation_version"
|
classpath "androidx.navigation:navigation-safe-args-gradle-plugin:$navigation_version"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue