From 86b5601d7d9965bea7d57f04600b02f5432dc966 Mon Sep 17 00:00:00 2001 From: Iván Ávalos Date: Tue, 3 Jan 2023 19:49:37 -0600 Subject: [android] Changed way that online status is calculated, and added ignition icon --- .../mx/trackermap/TrackerMap/android/devices/DevicesAdapter.kt | 1 + .../java/mx/trackermap/TrackerMap/android/map/UnitMapFragment.kt | 1 + .../mx/trackermap/TrackerMap/android/shared/UnitRenderData.kt | 9 ++++++++- androidApp/src/main/res/drawable/device_ignition.xml | 5 +++++ androidApp/src/main/res/layout/unit_item.xml | 8 ++++++++ androidApp/src/main/res/layout/unit_map_fragment.xml | 8 ++++++++ androidApp/src/main/res/values-es-rMX/strings.xml | 1 + androidApp/src/main/res/values/strings.xml | 1 + 8 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 androidApp/src/main/res/drawable/device_ignition.xml (limited to 'androidApp/src/main') 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 0fbf597..326fe79 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 @@ -63,6 +63,7 @@ class DevicesAdapter( unitName = unitName, unitIcon = unitIcon, statusIcon = statusIcon, + ignitionIcon = ignitionIcon, engineStopIcon = engineStopIcon, gridLayout = gridLayout, detailsButton = detailsButton, diff --git a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/UnitMapFragment.kt b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/UnitMapFragment.kt index 5e2224b..2fbb25a 100644 --- a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/UnitMapFragment.kt +++ b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/UnitMapFragment.kt @@ -124,6 +124,7 @@ class UnitMapFragment : Fragment() { UnitRenderData.UnitRenderViewHolder( unitName = binding.unitName, statusIcon = binding.statusIcon, + ignitionIcon = binding.ignitionIcon, engineStopIcon = binding.engineStopIcon, gridLayout = binding.gridLayout, detailsButton = binding.detailsButton, diff --git a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/shared/UnitRenderData.kt b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/shared/UnitRenderData.kt index 9a9f85c..340371a 100644 --- a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/shared/UnitRenderData.kt +++ b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/shared/UnitRenderData.kt @@ -29,7 +29,6 @@ import android.widget.TextView import androidx.cardview.widget.CardView import androidx.core.content.ContextCompat import com.zerobranch.layout.SwipeLayout -import kotlinx.serialization.json.longOrNull import mx.trackermap.TrackerMap.android.R import mx.trackermap.TrackerMap.client.models.UnitInformation import mx.trackermap.TrackerMap.utils.Formatter @@ -42,6 +41,7 @@ class UnitRenderData { val unitName: TextView, val unitIcon: ImageView? = null, val statusIcon: ImageView, + val ignitionIcon: ImageView, val engineStopIcon: ImageView, val gridLayout: GridLayout, val detailsButton: Button? = null, @@ -106,6 +106,13 @@ class UnitRenderData { } } + /* Ignition icon */ + ignitionIcon.visibility = if (unit.getIgnition()) { + View.VISIBLE + } else { + View.GONE + } + /* Engine stop */ when(unit.getEngineStop()) { UnitInformation.EngineStop.ON -> { diff --git a/androidApp/src/main/res/drawable/device_ignition.xml b/androidApp/src/main/res/drawable/device_ignition.xml new file mode 100644 index 0000000..d2d8103 --- /dev/null +++ b/androidApp/src/main/res/drawable/device_ignition.xml @@ -0,0 +1,5 @@ + + + diff --git a/androidApp/src/main/res/layout/unit_item.xml b/androidApp/src/main/res/layout/unit_item.xml index 6946d1d..03bef15 100644 --- a/androidApp/src/main/res/layout/unit_item.xml +++ b/androidApp/src/main/res/layout/unit_item.xml @@ -112,6 +112,14 @@ app:tint="?android:textColorPrimary" tools:ignore="ContentDescription" /> + + + + Estatus encendido Estatus apagado + Ignición apagada Paro de motor encendido Paro de motor apagado Nombre del conductor diff --git a/androidApp/src/main/res/values/strings.xml b/androidApp/src/main/res/values/strings.xml index 93dd45f..57eaf66 100644 --- a/androidApp/src/main/res/values/strings.xml +++ b/androidApp/src/main/res/values/strings.xml @@ -47,6 +47,7 @@ Status on Status off + Ignition on Engine stop on Engine stop off Driver name -- cgit v1.2.3