aboutsummaryrefslogtreecommitdiff
path: root/androidApp/src/main/res
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/res
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/res')
-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
5 files changed, 38 insertions, 194 deletions
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