diff options
Diffstat (limited to 'androidApp/src/main')
-rw-r--r-- | androidApp/src/main/java/mx/trackermap/TrackerMap/android/details/information/UnitInformationFragment.kt | 9 | ||||
-rw-r--r-- | androidApp/src/main/res/layout/unit_details_information.xml | 89 |
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..dae2056 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="404 Av. Arboledas, Celaya, Gto." /> + + <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 |