aboutsummaryrefslogtreecommitdiff
path: root/androidApp/src
diff options
context:
space:
mode:
authorIsidro Henoch <imhenoch@protonmail.com>2021-12-16 02:38:42 -0600
committerIsidro Henoch <imhenoch@protonmail.com>2021-12-16 02:38:42 -0600
commit69a4d373262ed9cb83db41df4d5465612ed402c3 (patch)
tree435218b98cfb9ad88a28134a05e97414aa480061 /androidApp/src
parentbab8bb576cd741ebd928d55539286580dad07db1 (diff)
downloadetbsa-trackermap-mobile-69a4d373262ed9cb83db41df4d5465612ed402c3.tar.gz
etbsa-trackermap-mobile-69a4d373262ed9cb83db41df4d5465612ed402c3.tar.bz2
etbsa-trackermap-mobile-69a4d373262ed9cb83db41df4d5465612ed402c3.zip
Adds a very basic UI to display details
Diffstat (limited to 'androidApp/src')
-rw-r--r--androidApp/src/main/java/mx/trackermap/TrackerMap/android/details/information/UnitInformationFragment.kt9
-rw-r--r--androidApp/src/main/res/layout/unit_details_information.xml89
2 files changed, 86 insertions, 12 deletions
diff --git a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/details/information/UnitInformationFragment.kt b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/details/information/UnitInformationFragment.kt
index 7a0ed16..1af8ec3 100644
--- a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/details/information/UnitInformationFragment.kt
+++ b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/details/information/UnitInformationFragment.kt
@@ -41,6 +41,15 @@ class UnitInformationFragment : Fragment() {
private fun setupObservers() {
unitInformationViewModel.unit.observe(this) { unitInformation ->
Log.d("UnitInformationFragment", "Unit Information Fetched - $unitInformation")
+ unitInformation?.let {
+ binding.deviceName.text = it.device.name
+ binding.driverDetail.text = it.device.contact
+ binding.speedDetail.text = "${it.position?.speed?.times(1.852) ?: "--"} Km/h"
+ binding.addressDetail.text = it.position?.address ?: "Unknown location"
+ binding.latitudeDetail.text = it.position?.latitude.toString()
+ binding.longitudeDetail.text = it.position?.longitude.toString()
+ binding.protocolDetail.text = it.position?.protocol ?: "--"
+ }
}
}
diff --git a/androidApp/src/main/res/layout/unit_details_information.xml b/androidApp/src/main/res/layout/unit_details_information.xml
index 1e88af8..bf8b44c 100644
--- a/androidApp/src/main/res/layout/unit_details_information.xml
+++ b/androidApp/src/main/res/layout/unit_details_information.xml
@@ -1,19 +1,84 @@
<?xml version="1.0" encoding="utf-8"?>
-<androidx.constraintlayout.widget.ConstraintLayout
+<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:app="http://schemas.android.com/apk/res-auto"
+ xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
- xmlns:app="http://schemas.android.com/apk/res-auto"
- xmlns:tools="http://schemas.android.com/tools">
+ android:orientation="vertical"
+ android:scrollbars="vertical">
- <TextView
- android:id="@+id/unitInformationText"
- android:layout_width="wrap_content"
+ <com.google.android.material.card.MaterialCardView
+ android:layout_width="match_parent"
android:layout_height="wrap_content"
- app:layout_constraintTop_toTopOf="parent"
- app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintEnd_toEndOf="parent"
- app:layout_constraintBottom_toBottomOf="parent"
- tools:text="INFORMATION"/>
+ app:cardCornerRadius="@dimen/card_border_radius"
+ app:cardElevation="@dimen/card_elevation"
+ app:cardUseCompatPadding="true"
+ app:contentPadding="@dimen/card_padding">
+
+ <LinearLayout
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:orientation="vertical">
+
+ <TextView
+ android:id="@+id/deviceName"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:textColor="@color/colorPrimaryDark"
+ android:textSize="26dp"
+ tools:text="1AAUTO" />
+
+ <TextView
+ android:id="@+id/driverDetail"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:textColor="@color/colorPrimaryDark"
+ android:textSize="18dp"
+ tools:text="Javier Zavala" />
+
+ <TextView
+ android:id="@+id/speedDetail"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:textColor="@color/colorPrimaryDark"
+ android:textSize="18dp"
+ tools:text="0Km/h - Stopped" />
+
+ <TextView
+ android:id="@+id/addressDetail"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:textColor="@color/colorPrimaryDark"
+ android:textSize="18dp"
+ tools:text="1000 Emerald Pools, CA" />
+
+ <TextView
+ android:id="@+id/latitudeDetail"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:textColor="@color/colorPrimaryDark"
+ android:textSize="18dp"
+ tools:text="20.32958356" />
+
+ <TextView
+ android:id="@+id/longitudeDetail"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:textColor="@color/colorPrimaryDark"
+ android:textSize="18dp"
+ tools:text="-101.38659274" />
+
+ <TextView
+ android:id="@+id/protocolDetail"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:textColor="@color/colorPrimaryDark"
+ android:textSize="18dp"
+ tools:text="osmand" />
+
+ </LinearLayout>
+
+ </com.google.android.material.card.MaterialCardView>
-</androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file
+</LinearLayout> \ No newline at end of file