diff options
author | Iván Ávalos <avalos@disroot.org> | 2022-01-13 04:18:54 -0600 |
---|---|---|
committer | Iván Ávalos <avalos@disroot.org> | 2022-01-13 04:18:54 -0600 |
commit | 5096d7306d48e03a5b096f1b190b089abce16fe5 (patch) | |
tree | 28b4e3f62bc8e707572e9710675e92f741fc3113 /androidApp/src/main/java/mx/trackermap/TrackerMap/android/devices | |
parent | d795427406c7f6763e9dd58f29507de3ee7d298f (diff) | |
download | etbsa-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.kt | 1 | ||||
-rw-r--r-- | androidApp/src/main/java/mx/trackermap/TrackerMap/android/devices/UnitRenderData.kt | 10 |
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()) { |