aboutsummaryrefslogtreecommitdiff
path: root/androidApp/src/main
diff options
context:
space:
mode:
authorIván Ávalos <avalos@disroot.org>2022-01-11 20:05:03 -0600
committerIván Ávalos <avalos@disroot.org>2022-01-11 20:05:03 -0600
commitee9e673695e221e115758b1ac32a6b63683ae7c9 (patch)
treeea175b800416bf82662538b9df0426bf5f8e4d8b /androidApp/src/main
parent7baad408f97d7d4ab512b822bdc0799469e2d496 (diff)
downloadetbsa-trackermap-mobile-ee9e673695e221e115758b1ac32a6b63683ae7c9.tar.gz
etbsa-trackermap-mobile-ee9e673695e221e115758b1ac32a6b63683ae7c9.tar.bz2
etbsa-trackermap-mobile-ee9e673695e221e115758b1ac32a6b63683ae7c9.zip
unit_item.xml data fields are generated programmatically, and DevicesAdapter code was refactored into UnitRenderData to be shared with UnitMapFragment.
Diffstat (limited to 'androidApp/src/main')
-rw-r--r--androidApp/src/main/java/mx/trackermap/TrackerMap/android/devices/DevicesAdapter.kt83
-rw-r--r--androidApp/src/main/java/mx/trackermap/TrackerMap/android/devices/UnitRenderData.kt193
-rw-r--r--androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/MapFragment.kt2
-rw-r--r--androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/UnitMapFragment.kt61
-rw-r--r--androidApp/src/main/res/drawable/device_locked.xml2
-rw-r--r--androidApp/src/main/res/drawable/device_unlocked.xml2
-rw-r--r--androidApp/src/main/res/layout/unit_item.xml136
-rw-r--r--androidApp/src/main/res/layout/unit_map_fragment.xml89
-rw-r--r--androidApp/src/main/res/values/colors.xml3
9 files changed, 266 insertions, 305 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 56b114d..e1ccd0a 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
@@ -1,10 +1,19 @@
package mx.trackermap.TrackerMap.android.devices
import android.graphics.Color
+import android.util.Size
+import android.util.TypedValue
+import android.view.Gravity
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
+import android.widget.GridLayout
+import android.widget.ImageView
+import android.widget.LinearLayout
+import android.widget.TextView
+import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.RecyclerView
+import com.mousebird.maply.ImageLoaderInterpreter
import mx.trackermap.TrackerMap.android.R
import mx.trackermap.TrackerMap.android.databinding.UnitItemBinding
import mx.trackermap.TrackerMap.utils.Formatter
@@ -15,8 +24,6 @@ enum class Action {
CLICK, DETAILS, REPORTS, COMMANDS
}
-typealias ActionCallback = (unit: UnitInformation, action: Action) -> Unit
-
class DevicesAdapter(
private val units: List<UnitInformation>,
private val actionCallback: ActionCallback?
@@ -32,65 +39,19 @@ class DevicesAdapter(
val unit = units[position]
val context = holder.itemView.context
holder.binding.apply {
-
- unit.position?.let { position ->
- /* Status icon */
- position.speed?.let { speed ->
- if (speed >= 2) {
- statusIcon.setColorFilter(Color.GREEN)
- } else {
- statusIcon.setColorFilter(Color.RED)
- }
- } ?: run {
- statusIcon.setColorFilter(Color.GRAY)
- }
-
- /* Engine stop */
- val attributes = position.attributes
- if (attributes["out1"].toString() == "null") {
- engineStopIcon.visibility = View.GONE
- } else {
- engineStopIcon.visibility = View.VISIBLE
- engineStopIcon.setImageResource(
- when (attributes["out1"].toString()) {
- "true" -> R.drawable.device_unlocked
- "false" -> R.drawable.device_locked
- else -> R.drawable.device_locked
- }
- )
- engineStopIcon.contentDescription = when (attributes["out1"].toString()) {
- "true" -> context.getString(R.string.unit_lock_on)
- "false" -> context.getString(R.string.unit_lock_off)
- else -> context.getString(R.string.unit_lock_on)
- }
- }
- }
-
- unitName.text = unit.device.name
- driverName.text = unit.device.contact
- unitSpeed.text = Formatter.formatSpeed(unit.position?.speed ?: 0.0, SpeedUnit.KMH)
- lastAddress.text = unit.position?.address
- unit.position?.fixTime?.let {
- lastDate.text = Formatter.formatDate(it)
- }
- actionCallback?.let { callback ->
- unitCard.setOnClickListener {
- swipeLayout.close()
- callback(unit, Action.CLICK)
- }
- detailsButton.setOnClickListener {
- swipeLayout.close()
- callback(unit, Action.DETAILS)
- }
- reportsButton.setOnClickListener {
- swipeLayout.close()
- callback(unit, Action.REPORTS)
- }
- commandsButton.setOnClickListener {
- swipeLayout.close()
- callback(unit, Action.COMMANDS)
- }
- }
+ UnitRenderData.render(
+ UnitRenderData.UnitRenderViewHolder(
+ unitName = unitName,
+ statusIcon = statusIcon,
+ engineStopIcon = engineStopIcon,
+ gridLayout = gridLayout,
+ detailsButton = detailsButton,
+ reportsButton = reportsButton,
+ commandsButton = commandsButton,
+ unitCard = unitCard,
+ swipeLayout = swipeLayout
+ ), context, unit, actionCallback
+ )
}
}
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
new file mode 100644
index 0000000..1b23ba0
--- /dev/null
+++ b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/devices/UnitRenderData.kt
@@ -0,0 +1,193 @@
+package mx.trackermap.TrackerMap.android.devices
+
+import android.content.Context
+import android.graphics.Color
+import android.util.TypedValue
+import android.view.Gravity
+import android.view.View
+import android.widget.Button
+import android.widget.GridLayout
+import android.widget.ImageView
+import android.widget.TextView
+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.client.models.UnitInformation
+import mx.trackermap.TrackerMap.utils.Formatter
+import mx.trackermap.TrackerMap.utils.SpeedUnit
+
+typealias ActionCallback = (unit: UnitInformation, action: Action) -> Unit
+
+class UnitRenderData {
+ data class UnitRenderViewHolder(
+ val unitName: TextView,
+ val statusIcon: ImageView,
+ val engineStopIcon: ImageView,
+ val gridLayout: GridLayout,
+ val detailsButton: Button,
+ val reportsButton: Button,
+ val commandsButton: Button,
+ val unitCard: CardView? = null,
+ val swipeLayout: SwipeLayout? = null
+ )
+
+ companion object {
+ fun render(
+ viewHolder: UnitRenderViewHolder,
+ context: Context,
+ unit: UnitInformation,
+ actionCallback: ActionCallback?
+ ) {
+ viewHolder.apply {
+ val details: MutableList<Triple<Int, String, String>> = mutableListOf()
+
+ /* Device name */
+ unitName.text = unit.device.name
+
+ /* Contact */
+ unit.device.contact?.let { contact ->
+ if (contact.isNotEmpty()) {
+ details.add(
+ Triple(
+ R.drawable.device_contact,
+ contact,
+ context.getString(R.string.unit_driver_name)
+ )
+ )
+ }
+ }
+
+ statusIcon.visibility = View.GONE
+ engineStopIcon.visibility = View.GONE
+
+ unit.position?.let { position ->
+ /* Status icon */
+ statusIcon.visibility = View.VISIBLE
+ position.speed?.let { speed ->
+ if (speed >= 2) {
+ statusIcon.setColorFilter(
+ ContextCompat.getColor(context, R.color.colorOnline)
+ )
+ } else {
+ statusIcon.setColorFilter(
+ ContextCompat.getColor(context, R.color.colorOffline)
+ )
+ }
+ } ?: run {
+ statusIcon.setColorFilter(Color.GRAY)
+ }
+
+ /* Engine stop */
+ val attributes = position.attributes
+ if (attributes["out1"].toString() != "null") {
+ engineStopIcon.visibility = View.VISIBLE
+ engineStopIcon.setImageResource(
+ when (attributes["out1"].toString()) {
+ "true" -> R.drawable.device_unlocked
+ "false" -> R.drawable.device_locked
+ else -> R.drawable.device_locked
+ }
+ )
+ engineStopIcon.contentDescription = when (attributes["out1"].toString()) {
+ "true" -> context.getString(R.string.unit_lock_on)
+ "false" -> context.getString(R.string.unit_lock_off)
+ else -> context.getString(R.string.unit_lock_on)
+ }
+ }
+
+ /* Speed */
+ position.speed?.let { speed ->
+ details.add(
+ Triple(
+ R.drawable.position_speed,
+ Formatter.formatSpeed(speed, SpeedUnit.KMH),
+ context.getString(R.string.unit_speed)
+ )
+ )
+ }
+
+ /* Address */
+ position.address?.let { address ->
+ details.add(
+ Triple(
+ R.drawable.position_address,
+ address,
+ context.getString(R.string.unit_last_address)
+ )
+ )
+ }
+
+ /* Date time */
+ position.fixTime?.let { fixTime ->
+ details.add(
+ Triple(
+ R.drawable.position_datetime,
+ Formatter.formatDate(fixTime),
+ context.getString(R.string.unit_last_date)
+ )
+ )
+ }
+ }
+
+ gridLayout.removeAllViewsInLayout()
+ val metrics = context.resources.displayMetrics
+ details.forEachIndexed { i, detail ->
+ /* Property icon */
+ val imageView = ImageView(gridLayout.context)
+ imageView.setImageResource(detail.first)
+ imageView.contentDescription = detail.third
+ imageView.setColorFilter(
+ ContextCompat.getColor(
+ context,
+ androidx.appcompat.R.color.secondary_text_default_material_light
+ )
+ )
+
+ val imageLayout = GridLayout.LayoutParams()
+ imageLayout.width = GridLayout.LayoutParams.WRAP_CONTENT
+ imageLayout.height = GridLayout.LayoutParams.WRAP_CONTENT
+ imageLayout.setGravity(Gravity.CENTER_VERTICAL)
+ imageLayout.marginEnd =
+ TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 6f, metrics).toInt()
+ imageLayout.rowSpec = GridLayout.spec(i)
+ imageLayout.columnSpec = GridLayout.spec(0)
+ imageView.layoutParams = imageLayout
+
+ /* Property ext */
+ val textView = TextView(gridLayout.context)
+ textView.text = detail.second
+
+ val textLayout = GridLayout.LayoutParams()
+ textLayout.width = 0
+ textLayout.height = GridLayout.LayoutParams.MATCH_PARENT
+ textLayout.rowSpec = GridLayout.spec(i)
+ textLayout.columnSpec = GridLayout.spec(1, 1, 5f)
+ textView.layoutParams = textLayout
+
+ gridLayout.addView(imageView)
+ gridLayout.addView(textView)
+ }
+
+ actionCallback?.let { callback ->
+ unitCard?.setOnClickListener {
+ swipeLayout?.close()
+ callback(unit, Action.CLICK)
+ }
+ detailsButton.setOnClickListener {
+ swipeLayout?.close()
+ callback(unit, Action.DETAILS)
+ }
+ reportsButton.setOnClickListener {
+ swipeLayout?.close()
+ callback(unit, Action.REPORTS)
+ }
+ commandsButton.setOnClickListener {
+ swipeLayout?.close()
+ callback(unit, Action.COMMANDS)
+ }
+ }
+ }
+ }
+ }
+} \ No newline at end of file
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 39312a8..9bda9d4 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
@@ -260,7 +260,7 @@ class MapFragment : GlobeMapFragment() {
val lat = latitude * Math.PI / 180
val lon = longitude * Math.PI / 180
if (animated) {
- mapControl.animatePositionGeo(lon, lat, zoom, 0.5)
+ mapControl.animatePositionGeo(lon, lat, zoom, 0.2)
} else {
mapControl.setPositionGeo(lon, lat, zoom)
}
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 4f98a96..fc417a0 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
@@ -13,6 +13,7 @@ import mx.trackermap.TrackerMap.android.R
import mx.trackermap.TrackerMap.android.databinding.UnitMapFragmentBinding
import mx.trackermap.TrackerMap.android.details.DetailsActivity
import mx.trackermap.TrackerMap.android.devices.Action
+import mx.trackermap.TrackerMap.android.devices.UnitRenderData
import mx.trackermap.TrackerMap.android.units.UnitsViewModel
import mx.trackermap.TrackerMap.client.models.UnitInformation
import mx.trackermap.TrackerMap.utils.Formatter
@@ -71,55 +72,17 @@ class UnitMapFragment : Fragment() {
return@let
}
- binding.apply {
- context?.let { context ->
- unit.position?.let { position ->
- /* Status icon */
- position.speed?.let { speed ->
- if (speed >= 2) {
- statusIcon.setColorFilter(Color.GREEN)
- } else {
- statusIcon.setColorFilter(Color.RED)
- }
- } ?: run {
- statusIcon.setColorFilter(Color.GRAY)
- }
-
- /* Engine stop */
- val attributes = position.attributes
- if (attributes["out1"].toString() == "null") {
- engineStopIcon.visibility = View.GONE
- } else {
- engineStopIcon.visibility = View.VISIBLE
- engineStopIcon.setImageResource(
- when (attributes["out1"].toString()) {
- "true" -> R.drawable.device_unlocked
- "false" -> R.drawable.device_locked
- else -> R.drawable.device_locked
- }
- )
- engineStopIcon.contentDescription =
- when (attributes["out1"].toString()) {
- "true" -> context.getString(R.string.unit_lock_on)
- "false" -> context.getString(R.string.unit_lock_off)
- else -> context.getString(R.string.unit_lock_on)
- }
- }
- }
-
- unitName.text = unit.device.name
- driverName.text = unit.device.contact
- unitSpeed.text =
- Formatter.formatSpeed(unit.position?.speed ?: 0.0, SpeedUnit.KMH)
- lastAddress.text = unit.position?.address
- unit.position?.fixTime?.let {
- lastDate.text = Formatter.formatDate(it)
- }
- detailsButton.setOnClickListener { itemAction(unit, Action.DETAILS) }
- reportsButton.setOnClickListener { itemAction(unit, Action.REPORTS) }
- commandsButton.setOnClickListener { itemAction(unit, Action.COMMANDS) }
- }
- }
+ UnitRenderData.render(
+ UnitRenderData.UnitRenderViewHolder(
+ unitName = binding.unitName,
+ statusIcon = binding.statusIcon,
+ engineStopIcon = binding.engineStopIcon,
+ gridLayout = binding.gridLayout,
+ detailsButton = binding.detailsButton,
+ reportsButton = binding.reportsButton,
+ commandsButton = binding.commandsButton
+ ), binding.mapUnitCard.context, unit, this::itemAction
+ )
unitsMapFragment.focusOn(unit.position!!.latitude!!, unit.position!!.longitude!!)
}
diff --git a/androidApp/src/main/res/drawable/device_locked.xml b/androidApp/src/main/res/drawable/device_locked.xml
index 1fe62c8..0a69232 100644
--- a/androidApp/src/main/res/drawable/device_locked.xml
+++ b/androidApp/src/main/res/drawable/device_locked.xml
@@ -1,4 +1,4 @@
-<vector android:height="14sp" android:tint="#1B5E20"
+<vector android:height="14sp" android:tint="@color/colorOnline"
android:viewportHeight="24" android:viewportWidth="24"
android:width="14sp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M12,17c1.1,0 2,-0.9 2,-2s-0.9,-2 -2,-2 -2,0.9 -2,2 0.9,2 2,2zM18,8h-1L17,6c0,-2.76 -2.24,-5 -5,-5S7,3.24 7,6h1.9c0,-1.71 1.39,-3.1 3.1,-3.1 1.71,0 3.1,1.39 3.1,3.1v2L6,8c-1.1,0 -2,0.9 -2,2v10c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2L20,10c0,-1.1 -0.9,-2 -2,-2zM18,20L6,20L6,10h12v10z"/>
diff --git a/androidApp/src/main/res/drawable/device_unlocked.xml b/androidApp/src/main/res/drawable/device_unlocked.xml
index ed352bf..3c6d329 100644
--- a/androidApp/src/main/res/drawable/device_unlocked.xml
+++ b/androidApp/src/main/res/drawable/device_unlocked.xml
@@ -1,4 +1,4 @@
-<vector android:height="14sp" android:tint="#B71C1C"
+<vector android:height="14sp" android:tint="@color/colorOffline"
android:viewportHeight="24" android:viewportWidth="24"
android:width="14sp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M18,8h-1L17,6c0,-2.76 -2.24,-5 -5,-5S7,3.24 7,6v2L6,8c-1.1,0 -2,0.9 -2,2v10c0,1.1 0.9,2 2,2h12c1.1,0 2,-0.9 2,-2L20,10c0,-1.1 -0.9,-2 -2,-2zM12,17c-1.1,0 -2,-0.9 -2,-2s0.9,-2 2,-2 2,0.9 2,2 -0.9,2 -2,2zM15.1,8L8.9,8L8.9,6c0,-1.71 1.39,-3.1 3.1,-3.1 1.71,0 3.1,1.39 3.1,3.1v2z"/>
diff --git a/androidApp/src/main/res/layout/unit_item.xml b/androidApp/src/main/res/layout/unit_item.xml
index d9432ba..d46e7a1 100644
--- a/androidApp/src/main/res/layout/unit_item.xml
+++ b/androidApp/src/main/res/layout/unit_item.xml
@@ -15,9 +15,7 @@
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="end"
- android:paddingTop="@dimen/card_padding"
- android:paddingBottom="@dimen/card_padding"
- android:paddingHorizontal="@dimen/card_padding"
+ android:padding="@dimen/card_padding"
android:gravity="center"
android:orientation="horizontal"
android:visibility="visible">
@@ -31,18 +29,17 @@
android:text="@string/unit_details"
android:textColor="@color/colorAccent"
android:textSize="@dimen/card_action_text"
- style="?borderlessButtonStyle"/>
+ style="?android:borderlessButtonStyle"/>
<com.google.android.material.button.MaterialButton
android:id="@+id/reportsButton"
android:layout_width="wrap_content"
android:layout_height="match_parent"
- android:layout_marginHorizontal="8dp"
android:layout_weight="1"
android:text="@string/unit_reports"
android:textColor="@color/colorAccent"
android:textSize="@dimen/card_action_text"
- style="?borderlessButtonStyle" />
+ style="?android:borderlessButtonStyle"/>
<com.google.android.material.button.MaterialButton
android:id="@+id/commandsButton"
@@ -52,7 +49,7 @@
android:text="@string/unit_commands"
android:textColor="@color/colorAccent"
android:textSize="@dimen/card_action_text"
- style="?borderlessButtonStyle" />
+ style="?android:borderlessButtonStyle" />
</LinearLayout>
@@ -70,127 +67,52 @@
android:clickable="true"
android:focusable="true">
- <RelativeLayout
+ <LinearLayout
android:id="@+id/mainContent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:animateLayoutChanges="true">
+ android:orientation="vertical">
- <ImageView
- android:id="@+id/statusIcon"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginEnd="5dp"
- android:src="@drawable/device_status"
- app:tint="?android:textColorPrimary"
- tools:ignore="ContentDescription" />
-
- <ImageView
- android:id="@+id/engineStopIcon"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_toEndOf="@id/statusIcon"
- android:visibility="gone"
- android:layout_marginEnd="5dp"
- android:src="@drawable/device_unlocked"
- tools:ignore="ContentDescription" />
-
- <TextView
- android:id="@+id/unitName"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_toEndOf="@id/engineStopIcon"
- style="@style/TextAppearance.AppCompat.Body2"
- tools:text="1AAUTO" />
-
- <GridLayout
- android:id="@+id/gridLayout"
+ <LinearLayout
+ android:id="@+id/titleLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_below="@id/unitName">
-
- <ImageView
- android:id="@+id/driverNameIcon"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginEnd="6dp"
- android:layout_column="0"
- android:layout_row="1"
- android:contentDescription="@string/unit_driver_name"
- android:src="@drawable/device_contact"
- app:tint="?android:textColorSecondary" />
-
- <TextView
- android:id="@+id/driverName"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_column="1"
- android:layout_row="1"
- style="@style/TextAppearance.AppCompat.Caption"
- tools:text="Javier Zavala" />
+ android:gravity="center_vertical"
+ android:orientation="horizontal">
<ImageView
- android:id="@+id/unitSpeedIcon"
+ android:id="@+id/statusIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_column="0"
- android:layout_row="2"
- style="@style/TextAppearance.MaterialComponents.Caption"
- android:contentDescription="@string/unit_speed"
- android:src="@drawable/position_speed"
- app:tint="?android:textColorSecondary" />
-
- <TextView
- android:id="@+id/unitSpeed"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_column="1"
- android:layout_row="2"
- style="@style/TextAppearance.AppCompat.Caption"
- tools:text="0 Km/h - Stopped" />
+ android:layout_marginEnd="5dp"
+ android:src="@drawable/device_status"
+ app:tint="?android:textColorPrimary"
+ tools:ignore="ContentDescription" />
<ImageView
- android:id="@+id/lastAddressIcon"
+ android:id="@+id/engineStopIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_column="0"
- android:layout_row="3"
- android:contentDescription="@string/unit_last_address"
- android:src="@drawable/position_address"
- app:tint="?android:textColorSecondary" />
+ android:visibility="gone"
+ android:layout_marginEnd="5dp"
+ android:src="@drawable/device_unlocked"
+ tools:ignore="ContentDescription" />
<TextView
- android:id="@+id/lastAddress"
+ android:id="@+id/unitName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_column="1"
- android:layout_row="3"
- style="@style/TextAppearance.AppCompat.Caption"
- tools:text="404 Av. Arboledas, Celaya, Gto." />
-
- <ImageView
- android:id="@+id/lastDateIcon"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_column="0"
- android:layout_row="4"
- android:contentDescription="@string/unit_last_date"
- android:src="@drawable/position_datetime"
- app:tint="?android:textColorSecondary" />
+ style="@style/TextAppearance.AppCompat.Body2"
+ tools:text="1AAUTO" />
+ </LinearLayout>
- <TextView
- android:id="@+id/lastDate"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_column="1"
- android:layout_row="4"
- style="@style/TextAppearance.AppCompat.Caption"
- tools:text="4 de Diciembre de 2021, 7:00 PM" />
-
- </GridLayout>
+ <GridLayout
+ android:id="@+id/gridLayout"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content" />
- </RelativeLayout>
+ </LinearLayout>
</com.google.android.material.card.MaterialCardView>
diff --git a/androidApp/src/main/res/layout/unit_map_fragment.xml b/androidApp/src/main/res/layout/unit_map_fragment.xml
index 213d33d..a920b14 100644
--- a/androidApp/src/main/res/layout/unit_map_fragment.xml
+++ b/androidApp/src/main/res/layout/unit_map_fragment.xml
@@ -68,87 +68,7 @@
android:id="@+id/gridLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_below="@id/unitName">
-
- <ImageView
- android:id="@+id/driverNameIcon"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginEnd="6dp"
- android:layout_column="0"
- android:layout_row="1"
- android:contentDescription="@string/unit_driver_name"
- android:src="@drawable/device_contact"
- app:tint="?android:textColorSecondary" />
-
- <TextView
- android:id="@+id/driverName"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_column="1"
- android:layout_row="1"
- style="@style/TextAppearance.AppCompat.Caption"
- tools:text="Javier Zavala" />
-
- <ImageView
- android:id="@+id/unitSpeedIcon"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_column="0"
- android:layout_row="2"
- style="@style/TextAppearance.MaterialComponents.Caption"
- android:contentDescription="@string/unit_speed"
- android:src="@drawable/position_speed"
- app:tint="?android:textColorSecondary" />
-
- <TextView
- android:id="@+id/unitSpeed"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_column="1"
- android:layout_row="2"
- style="@style/TextAppearance.AppCompat.Caption"
- tools:text="0 Km/h - Stopped" />
-
- <ImageView
- android:id="@+id/lastAddressIcon"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_column="0"
- android:layout_row="3"
- android:contentDescription="@string/unit_last_address"
- android:src="@drawable/position_address"
- app:tint="?android:textColorSecondary" />
-
- <TextView
- android:id="@+id/lastAddress"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_column="1"
- android:layout_row="3"
- style="@style/TextAppearance.AppCompat.Caption"
- tools:text="404 Av. Arboledas, Celaya, Gto." />
-
- <ImageView
- android:id="@+id/lastDateIcon"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_column="0"
- android:layout_row="4"
- android:contentDescription="@string/unit_last_date"
- android:src="@drawable/position_datetime"
- app:tint="?android:textColorSecondary" />
-
- <TextView
- android:id="@+id/lastDate"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_column="1"
- android:layout_row="4"
- style="@style/TextAppearance.AppCompat.Caption"
- tools:text="4 de Diciembre de 2021, 7:00 PM" />
-
- </GridLayout>
+ android:layout_below="@id/unitName" />
<LinearLayout
android:id="@+id/itemOptions"
@@ -168,18 +88,17 @@
android:text="@string/unit_details"
android:textColor="@color/colorAccent"
android:textSize="@dimen/card_action_text"
- style="?borderlessButtonStyle" />
+ style="?android:borderlessButtonStyle" />
<com.google.android.material.button.MaterialButton
android:id="@+id/reportsButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_marginHorizontal="8dp"
android:layout_weight="1"
android:text="@string/unit_reports"
android:textColor="@color/colorAccent"
android:textSize="@dimen/card_action_text"
- style="?borderlessButtonStyle" />
+ style="?android:borderlessButtonStyle" />
<com.google.android.material.button.MaterialButton
android:id="@+id/commandsButton"
@@ -189,7 +108,7 @@
android:text="@string/unit_commands"
android:textColor="@color/colorAccent"
android:textSize="@dimen/card_action_text"
- style="?borderlessButtonStyle" />
+ style="?android:borderlessButtonStyle" />
</LinearLayout>
diff --git a/androidApp/src/main/res/values/colors.xml b/androidApp/src/main/res/values/colors.xml
index 8f96260..0ebcff7 100644
--- a/androidApp/src/main/res/values/colors.xml
+++ b/androidApp/src/main/res/values/colors.xml
@@ -5,4 +5,7 @@
<color name="colorAccent">#EB473E</color>
<color name="background">#FDFDFD</color>
<color name="darkBackground">#ECEFF3</color>
+
+ <color name="colorOnline">#388E3C</color>
+ <color name="colorOffline">#D32F2F</color>
</resources> \ No newline at end of file