aboutsummaryrefslogtreecommitdiff
path: root/androidApp/src/main/java/mx/trackermap/TrackerMap/android/devices
diff options
context:
space:
mode:
authorIván Ávalos <avalos@disroot.org>2022-01-13 04:18:54 -0600
committerIván Ávalos <avalos@disroot.org>2022-01-13 04:18:54 -0600
commit5096d7306d48e03a5b096f1b190b089abce16fe5 (patch)
tree28b4e3f62bc8e707572e9710675e92f741fc3113 /androidApp/src/main/java/mx/trackermap/TrackerMap/android/devices
parentd795427406c7f6763e9dd58f29507de3ee7d298f (diff)
downloadetbsa-trackermap-mobile-5096d7306d48e03a5b096f1b190b089abce16fe5.tar.gz
etbsa-trackermap-mobile-5096d7306d48e03a5b096f1b190b089abce16fe5.tar.bz2
etbsa-trackermap-mobile-5096d7306d48e03a5b096f1b190b089abce16fe5.zip
Added device icon to unit_item.xml (+ a11y) and moved category logic to MarkerTransformations
Diffstat (limited to 'androidApp/src/main/java/mx/trackermap/TrackerMap/android/devices')
-rw-r--r--androidApp/src/main/java/mx/trackermap/TrackerMap/android/devices/DevicesAdapter.kt1
-rw-r--r--androidApp/src/main/java/mx/trackermap/TrackerMap/android/devices/UnitRenderData.kt10
2 files changed, 11 insertions, 0 deletions
diff --git a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/devices/DevicesAdapter.kt b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/devices/DevicesAdapter.kt
index d42a8aa..175e908 100644
--- a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/devices/DevicesAdapter.kt
+++ b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/devices/DevicesAdapter.kt
@@ -28,6 +28,7 @@ class DevicesAdapter(
UnitRenderData.render(
UnitRenderData.UnitRenderViewHolder(
unitName = unitName,
+ unitIcon = unitIcon,
statusIcon = statusIcon,
engineStopIcon = engineStopIcon,
gridLayout = gridLayout,
diff --git a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/devices/UnitRenderData.kt b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/devices/UnitRenderData.kt
index 39ef472..beeba6f 100644
--- a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/devices/UnitRenderData.kt
+++ b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/devices/UnitRenderData.kt
@@ -13,6 +13,7 @@ import androidx.cardview.widget.CardView
import androidx.core.content.ContextCompat
import com.zerobranch.layout.SwipeLayout
import mx.trackermap.TrackerMap.android.R
+import mx.trackermap.TrackerMap.android.map.MarkerTransformations
import mx.trackermap.TrackerMap.client.models.UnitInformation
import mx.trackermap.TrackerMap.utils.Formatter
import mx.trackermap.TrackerMap.utils.SpeedUnit
@@ -22,6 +23,7 @@ typealias ActionCallback = (unit: UnitInformation, action: Action) -> Unit
class UnitRenderData {
data class UnitRenderViewHolder(
val unitName: TextView,
+ val unitIcon: ImageView? = null,
val statusIcon: ImageView,
val engineStopIcon: ImageView,
val gridLayout: GridLayout,
@@ -45,6 +47,14 @@ class UnitRenderData {
/* Device name */
unitName.text = unit.device.name
+ /* Device icon */
+ unitIcon?.setImageResource(
+ MarkerTransformations.categoryToResourceId(unit.device.category)
+ )
+ unitIcon?.contentDescription = context.getString(
+ MarkerTransformations.categoryToStringId(unit.device.category)
+ )
+
/* Contact */
unit.device.contact?.let { contact ->
if (contact.isNotEmpty()) {