diff options
author | Iván Ávalos <avalos@disroot.org> | 2022-01-29 22:33:13 -0600 |
---|---|---|
committer | Iván Ávalos <avalos@disroot.org> | 2022-01-29 22:33:13 -0600 |
commit | 3f4400be135ee50b9da9c9aa7e709b04b26f80ac (patch) | |
tree | bb858c409a22d2176aecbe8f7774043d92723916 /androidApp/src/main/java/mx/trackermap/TrackerMap | |
parent | 4ff1b200f12fc335abd1f0f6117649f50b3968ce (diff) | |
download | etbsa-trackermap-mobile-3f4400be135ee50b9da9c9aa7e709b04b26f80ac.tar.gz etbsa-trackermap-mobile-3f4400be135ee50b9da9c9aa7e709b04b26f80ac.tar.bz2 etbsa-trackermap-mobile-3f4400be135ee50b9da9c9aa7e709b04b26f80ac.zip |
Moved MarkerType to Marker.Type in shared module
Diffstat (limited to 'androidApp/src/main/java/mx/trackermap/TrackerMap')
-rw-r--r-- | androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/MapFragment.kt | 9 | ||||
-rw-r--r-- | androidApp/src/main/java/mx/trackermap/TrackerMap/android/shared/MarkerTransformations.kt | 95 |
2 files changed, 51 insertions, 53 deletions
diff --git a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/MapFragment.kt b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/MapFragment.kt index a07f054..b04bfbc 100644 --- a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/MapFragment.kt +++ b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/MapFragment.kt @@ -40,7 +40,6 @@ import mx.trackermap.TrackerMap.client.models.Geofence import mx.trackermap.TrackerMap.client.models.MapLayer import mx.trackermap.TrackerMap.client.models.Marker import mx.trackermap.TrackerMap.utils.MapCalculus -import mx.trackermap.TrackerMap.utils.MarkerType typealias SetupCallback = () -> Unit typealias MarkerCallback = (Int?) -> Unit @@ -203,9 +202,9 @@ open class MapFragment : GlobeMapFragment() { screenMarker.image = if (isReport) { // For reports, position, start and end, icons must be different when (i) { - 0 -> getIcon(MarkerType.REPORT_START) - markers.size - 1 -> getIcon(MarkerType.REPORT_END) - else -> getIcon(MarkerType.REPORT_POSITION) + 0 -> getIcon(Marker.Type.REPORT_START) + markers.size - 1 -> getIcon(Marker.Type.REPORT_END) + else -> getIcon(Marker.Type.REPORT_POSITION) } } else getIcon(marker.type) screenMarker.size = if (isReport) { @@ -421,7 +420,7 @@ open class MapFragment : GlobeMapFragment() { } } - private fun getIcon(markerType: MarkerType): Bitmap { + private fun getIcon(markerType: Marker.Type): Bitmap { return ResourcesCompat.getDrawable( requireActivity().resources, MarkerTransformations.markerTypeToResourceId(markerType), diff --git a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/shared/MarkerTransformations.kt b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/shared/MarkerTransformations.kt index aacf414..2c395c8 100644 --- a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/shared/MarkerTransformations.kt +++ b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/shared/MarkerTransformations.kt @@ -19,62 +19,61 @@ package mx.trackermap.TrackerMap.android.shared import mx.trackermap.TrackerMap.android.R import mx.trackermap.TrackerMap.client.models.Marker -import mx.trackermap.TrackerMap.utils.MarkerType object MarkerTransformations { - fun markerTypeToResourceId(markerType: MarkerType): Int { + fun markerTypeToResourceId(markerType: Marker.Type): Int { return when (markerType) { - MarkerType.ANIMAL -> R.drawable.map_animal - MarkerType.BICYCLE -> R.drawable.map_bicycle - MarkerType.BOAT -> R.drawable.map_boat - MarkerType.BUS -> R.drawable.map_bus - MarkerType.CAR -> R.drawable.map_car - MarkerType.CRANE -> R.drawable.map_crane - MarkerType.DEFAULT -> R.drawable.map_default - MarkerType.HELICOPTER -> R.drawable.map_helicopter - MarkerType.MOTORCYCLE -> R.drawable.map_motorcycle - MarkerType.OFFROAD -> R.drawable.map_offroad - MarkerType.PERSON -> R.drawable.map_person - MarkerType.PICKUP -> R.drawable.map_pickup - MarkerType.PLANE -> R.drawable.map_plane - MarkerType.SCOOTER -> R.drawable.map_scooter - MarkerType.SHIP -> R.drawable.map_ship - MarkerType.TRACTOR -> R.drawable.map_tractor - MarkerType.TRAIN -> R.drawable.map_train - MarkerType.TRAM -> R.drawable.map_tram - MarkerType.TROLLEYBUS -> R.drawable.map_trolleybus - MarkerType.TRUCK -> R.drawable.map_truck - MarkerType.VAN -> R.drawable.map_van + Marker.Type.ANIMAL -> R.drawable.map_animal + Marker.Type.BICYCLE -> R.drawable.map_bicycle + Marker.Type.BOAT -> R.drawable.map_boat + Marker.Type.BUS -> R.drawable.map_bus + Marker.Type.CAR -> R.drawable.map_car + Marker.Type.CRANE -> R.drawable.map_crane + Marker.Type.DEFAULT -> R.drawable.map_default + Marker.Type.HELICOPTER -> R.drawable.map_helicopter + Marker.Type.MOTORCYCLE -> R.drawable.map_motorcycle + Marker.Type.OFFROAD -> R.drawable.map_offroad + Marker.Type.PERSON -> R.drawable.map_person + Marker.Type.PICKUP -> R.drawable.map_pickup + Marker.Type.PLANE -> R.drawable.map_plane + Marker.Type.SCOOTER -> R.drawable.map_scooter + Marker.Type.SHIP -> R.drawable.map_ship + Marker.Type.TRACTOR -> R.drawable.map_tractor + Marker.Type.TRAIN -> R.drawable.map_train + Marker.Type.TRAM -> R.drawable.map_tram + Marker.Type.TROLLEYBUS -> R.drawable.map_trolleybus + Marker.Type.TRUCK -> R.drawable.map_truck + Marker.Type.VAN -> R.drawable.map_van - MarkerType.REPORT_POSITION -> R.drawable.map_report_position - MarkerType.REPORT_START -> R.drawable.map_report_start - MarkerType.REPORT_END -> R.drawable.map_report_end + Marker.Type.REPORT_POSITION -> R.drawable.map_report_position + Marker.Type.REPORT_START -> R.drawable.map_report_start + Marker.Type.REPORT_END -> R.drawable.map_report_end } } - fun markerTypeToStringId(markerType: MarkerType): Int { + fun markerTypeToStringId(markerType: Marker.Type): Int { return when (markerType) { - MarkerType.ANIMAL -> R.string.unit_category_animal - MarkerType.BICYCLE -> R.string.unit_category_bicycle - MarkerType.BOAT -> R.string.unit_category_boat - MarkerType.BUS -> R.string.unit_category_bus - MarkerType.CAR -> R.string.unit_category_car - MarkerType.CRANE -> R.string.unit_category_crane - MarkerType.DEFAULT -> R.string.unit_category_default - MarkerType.HELICOPTER -> R.string.unit_category_helicopter - MarkerType.MOTORCYCLE -> R.string.unit_category_motorcycle - MarkerType.OFFROAD -> R.string.unit_category_offroad - MarkerType.PERSON -> R.string.unit_category_person - MarkerType.PICKUP -> R.string.unit_category_pickup - MarkerType.PLANE -> R.string.unit_category_plane - MarkerType.SCOOTER -> R.string.unit_category_scooter - MarkerType.SHIP -> R.string.unit_category_ship - MarkerType.TRACTOR -> R.string.unit_category_tractor - MarkerType.TRAIN -> R.string.unit_category_train - MarkerType.TRAM -> R.string.unit_category_tram - MarkerType.TROLLEYBUS -> R.string.unit_category_trolleybus - MarkerType.TRUCK -> R.string.unit_category_truck - MarkerType.VAN -> R.string.unit_category_van + Marker.Type.ANIMAL -> R.string.unit_category_animal + Marker.Type.BICYCLE -> R.string.unit_category_bicycle + Marker.Type.BOAT -> R.string.unit_category_boat + Marker.Type.BUS -> R.string.unit_category_bus + Marker.Type.CAR -> R.string.unit_category_car + Marker.Type.CRANE -> R.string.unit_category_crane + Marker.Type.DEFAULT -> R.string.unit_category_default + Marker.Type.HELICOPTER -> R.string.unit_category_helicopter + Marker.Type.MOTORCYCLE -> R.string.unit_category_motorcycle + Marker.Type.OFFROAD -> R.string.unit_category_offroad + Marker.Type.PERSON -> R.string.unit_category_person + Marker.Type.PICKUP -> R.string.unit_category_pickup + Marker.Type.PLANE -> R.string.unit_category_plane + Marker.Type.SCOOTER -> R.string.unit_category_scooter + Marker.Type.SHIP -> R.string.unit_category_ship + Marker.Type.TRACTOR -> R.string.unit_category_tractor + Marker.Type.TRAIN -> R.string.unit_category_train + Marker.Type.TRAM -> R.string.unit_category_tram + Marker.Type.TROLLEYBUS -> R.string.unit_category_trolleybus + Marker.Type.TRUCK -> R.string.unit_category_truck + Marker.Type.VAN -> R.string.unit_category_van else -> R.string.unit_category_default } } |