aboutsummaryrefslogtreecommitdiff
path: root/androidApp/src
diff options
context:
space:
mode:
authorIván Ávalos <avalos@disroot.org>2023-01-03 19:49:37 -0600
committerIván Ávalos <avalos@disroot.org>2023-01-03 19:49:37 -0600
commit86b5601d7d9965bea7d57f04600b02f5432dc966 (patch)
treea90194abf3278520ce7553fdb9bfd7bcdbc7b5d2 /androidApp/src
parent808fc8d4a121e7658821fc2956bf0c540cbc113f (diff)
downloadetbsa-trackermap-mobile-86b5601d7d9965bea7d57f04600b02f5432dc966.tar.gz
etbsa-trackermap-mobile-86b5601d7d9965bea7d57f04600b02f5432dc966.tar.bz2
etbsa-trackermap-mobile-86b5601d7d9965bea7d57f04600b02f5432dc966.zip
[android] Changed way that online status is calculated, and added ignition icon
Diffstat (limited to 'androidApp/src')
-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/map/UnitMapFragment.kt1
-rw-r--r--androidApp/src/main/java/mx/trackermap/TrackerMap/android/shared/UnitRenderData.kt9
-rw-r--r--androidApp/src/main/res/drawable/device_ignition.xml5
-rw-r--r--androidApp/src/main/res/layout/unit_item.xml8
-rw-r--r--androidApp/src/main/res/layout/unit_map_fragment.xml8
-rw-r--r--androidApp/src/main/res/values-es-rMX/strings.xml1
-rw-r--r--androidApp/src/main/res/values/strings.xml1
8 files changed, 33 insertions, 1 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 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 @@
+<vector android:height="14dp" android:tint="#FFAB00"
+ android:viewportHeight="24" android:viewportWidth="24"
+ android:width="14dp" xmlns:android="http://schemas.android.com/apk/res/android">
+ <path android:fillColor="@android:color/white" android:pathData="M21,10h-8.35C11.83,7.67 9.61,6 7,6c-3.31,0 -6,2.69 -6,6s2.69,6 6,6c2.61,0 4.83,-1.67 5.65,-4H13l2,2l2,-2l2,2l4,-4.04L21,10zM7,15c-1.65,0 -3,-1.35 -3,-3c0,-1.65 1.35,-3 3,-3s3,1.35 3,3C10,13.65 8.65,15 7,15z"/>
+</vector>
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
@@ -113,6 +113,14 @@
tools:ignore="ContentDescription" />
<ImageView
+ android:id="@+id/ignitionIcon"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginEnd="5dp"
+ android:src="@drawable/device_ignition"
+ android:contentDescription="@string/unit_ignition_on" />
+
+ <ImageView
android:id="@+id/engineStopIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
diff --git a/androidApp/src/main/res/layout/unit_map_fragment.xml b/androidApp/src/main/res/layout/unit_map_fragment.xml
index f168662..b33b946 100644
--- a/androidApp/src/main/res/layout/unit_map_fragment.xml
+++ b/androidApp/src/main/res/layout/unit_map_fragment.xml
@@ -59,6 +59,14 @@
tools:ignore="ContentDescription" />
<ImageView
+ android:id="@+id/ignitionIcon"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_marginEnd="5dp"
+ android:src="@drawable/device_ignition"
+ tools:ignore="ContentDescription" />
+
+ <ImageView
android:id="@+id/engineStopIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
diff --git a/androidApp/src/main/res/values-es-rMX/strings.xml b/androidApp/src/main/res/values-es-rMX/strings.xml
index f3fecb2..8737f44 100644
--- a/androidApp/src/main/res/values-es-rMX/strings.xml
+++ b/androidApp/src/main/res/values-es-rMX/strings.xml
@@ -33,6 +33,7 @@
<!-- Unit Item -->
<string name="unit_status_on">Estatus encendido</string>
<string name="unit_status_off">Estatus apagado</string>
+ <string name="unit_ignition_on">Ignición apagada</string>
<string name="unit_lock_on">Paro de motor encendido</string>
<string name="unit_lock_off">Paro de motor apagado</string>
<string name="unit_driver_name">Nombre del conductor</string>
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 @@
<!-- Unit Item -->
<string name="unit_status_on">Status on</string>
<string name="unit_status_off">Status off</string>
+ <string name="unit_ignition_on">Ignition on</string>
<string name="unit_lock_on">Engine stop on</string>
<string name="unit_lock_off">Engine stop off</string>
<string name="unit_driver_name">Driver name</string>