aboutsummaryrefslogtreecommitdiff
path: root/androidApp/src/main/res
diff options
context:
space:
mode:
authorIván Ávalos <avalos@disroot.org>2021-12-17 01:57:23 -0600
committerIván Ávalos <avalos@disroot.org>2021-12-17 01:57:23 -0600
commit090bcc911e569040ceeaef29f7ca8db82694d9b0 (patch)
tree00a4f17161cb3727b682f58d428f4db5df38566e /androidApp/src/main/res
parent11d65c96a409b07ef8270cea2984109fffd04a8d (diff)
downloadetbsa-trackermap-mobile-090bcc911e569040ceeaef29f7ca8db82694d9b0.tar.gz
etbsa-trackermap-mobile-090bcc911e569040ceeaef29f7ca8db82694d9b0.tar.bz2
etbsa-trackermap-mobile-090bcc911e569040ceeaef29f7ca8db82694d9b0.zip
Implemented SwipeLayout using Zerobranch's library
Diffstat (limited to 'androidApp/src/main/res')
-rw-r--r--androidApp/src/main/res/layout/unit_item.xml314
1 files changed, 168 insertions, 146 deletions
diff --git a/androidApp/src/main/res/layout/unit_item.xml b/androidApp/src/main/res/layout/unit_item.xml
index 0c4b34d..9296534 100644
--- a/androidApp/src/main/res/layout/unit_item.xml
+++ b/androidApp/src/main/res/layout/unit_item.xml
@@ -1,173 +1,195 @@
<?xml version="1.0" encoding="utf-8"?>
-<com.google.android.material.card.MaterialCardView
+<com.zerobranch.layout.SwipeLayout
+ android:id="@+id/swipeLayout"
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:id="@+id/unitCard"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- app:cardCornerRadius="@dimen/card_border_radius"
- app:cardElevation="0dp"
- app:cardUseCompatPadding="true"
- app:contentPadding="@dimen/card_padding">
-
- <RelativeLayout
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:animateLayoutChanges="true">
-
- <ImageView
- android:id="@+id/statusIcon"
+ app:draggedItem="@id/unitCard"
+ app:rightItem="@id/itemOptions"
+ app:swipeDirection="left">
+
+ <LinearLayout
+ android:id="@+id/itemOptions"
+ 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:paddingEnd="@dimen/card_padding"
+ android:gravity="center"
+ android:orientation="horizontal"
+ android:visibility="visible">
+
+ <com.google.android.material.button.MaterialButton
+ android:id="@+id/detailsButton"
android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginEnd="5dp"
- android:src="@drawable/ic_baseline_fiber_manual_record_24"
- app:tint="?android:textColorPrimary" />
-
- <ImageView
- android:id="@+id/engineStopIcon"
+ android:layout_height="match_parent"
+ android:layout_weight="1"
+ app:cardBackgroundColor="@color/colorAccent"
+ android:text="@string/unit_details"
+ android:textColor="@color/colorAccent"
+ android:textSize="12sp"
+ style="?borderlessButtonStyle" />
+
+ <com.google.android.material.button.MaterialButton
+ android:id="@+id/reportsButton"
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/ic_baseline_lock_24" />
+ android:layout_height="match_parent"
+ android:layout_marginHorizontal="8dp"
+ android:layout_weight="1"
+ android:text="@string/unit_reports"
+ android:textColor="@color/colorAccent"
+ android:textSize="12sp"
+ style="?borderlessButtonStyle" />
+
+ <com.google.android.material.button.MaterialButton
+ android:id="@+id/commandsButton"
+ android:layout_width="wrap_content"
+ android:layout_height="match_parent"
+ android:layout_weight="1"
+ android:text="@string/unit_commands"
+ android:textColor="@color/colorAccent"
+ android:textSize="12sp"
+ style="?borderlessButtonStyle" />
- <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" />
+ </LinearLayout>
- <GridLayout
- android:id="@+id/gridLayout"
+ <com.google.android.material.card.MaterialCardView
+ android:id="@+id/unitCard"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:visibility="visible"
+ android:foreground="?android:attr/selectableItemBackground"
+ app:cardCornerRadius="@dimen/card_border_radius"
+ app:cardElevation="0dp"
+ app:cardUseCompatPadding="true"
+ app:contentPadding="@dimen/card_padding"
+ app:cardBackgroundColor="@color/darkBackground"
+ android:clickable="true"
+ android:focusable="true">
+
+ <RelativeLayout
+ android:id="@+id/mainContent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
- android:layout_below="@id/unitName">
+ android:animateLayoutChanges="true">
<ImageView
- android:id="@+id/driverNameIcon"
+ android:id="@+id/statusIcon"
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/ic_baseline_person_24"
- 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/ic_baseline_speed_24"
- 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/ic_baseline_fiber_manual_record_24"
+ app:tint="?android:textColorPrimary" />
<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/ic_baseline_location_on_24"
- app:tint="?android:textColorSecondary" />
+ android:layout_toEndOf="@id/statusIcon"
+ android:visibility="gone"
+ android:layout_marginEnd="5dp"
+ android:src="@drawable/ic_baseline_lock_24" />
<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/ic_baseline_calendar_today_24"
- app:tint="?android:textColorSecondary" />
+ android:layout_toEndOf="@id/engineStopIcon"
+ style="@style/TextAppearance.AppCompat.Body2"
+ tools:text="1AAUTO" />
-
- <TextView
- android:id="@+id/lastDate"
+ <GridLayout
+ android:id="@+id/gridLayout"
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>
-
- <LinearLayout
- android:id="@+id/itemOptions"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_below="@id/gridLayout"
- android:layout_marginTop="@dimen/card_padding"
- android:gravity="center"
- android:orientation="horizontal"
- android:visibility="visible">
-
- <com.google.android.material.button.MaterialButton
- android:id="@+id/detailsButton"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:text="@string/unit_details"
- android:textColor="@color/colorAccent"
- style="?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"
- style="?borderlessButtonStyle" />
-
- <com.google.android.material.button.MaterialButton
- android:id="@+id/commandsButton"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:text="@string/unit_commands"
- android:textColor="@color/colorAccent"
- style="?borderlessButtonStyle" />
-
- </LinearLayout>
-
- </RelativeLayout>
-
-</com.google.android.material.card.MaterialCardView> \ No newline at end of file
+ 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/ic_baseline_person_24"
+ 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/ic_baseline_speed_24"
+ 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/ic_baseline_location_on_24"
+ 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/ic_baseline_calendar_today_24"
+ 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>
+
+ </RelativeLayout>
+
+ </com.google.android.material.card.MaterialCardView>
+
+</com.zerobranch.layout.SwipeLayout> \ No newline at end of file