aboutsummaryrefslogtreecommitdiff
path: root/androidApp/src/main/res/layout/unit_item.xml
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
commit0c8576a60e59f9d7a2fb2044752d10e564237a4f (patch)
treea9e17d52c644693c88f66ee8f926d48ac3eabe6d /androidApp/src/main/res/layout/unit_item.xml
parent0db6ce4a48a64a29001395b9aa27de006c139707 (diff)
downloadetbsa-trackermap-mobile-0c8576a60e59f9d7a2fb2044752d10e564237a4f.tar.gz
etbsa-trackermap-mobile-0c8576a60e59f9d7a2fb2044752d10e564237a4f.tar.bz2
etbsa-trackermap-mobile-0c8576a60e59f9d7a2fb2044752d10e564237a4f.zip
Implemented SwipeLayout using Zerobranch's library
Diffstat (limited to 'androidApp/src/main/res/layout/unit_item.xml')
-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 f7ace03..8b6b667 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="1000 Emerald Pools, CA" />
-
- <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="1000 Emerald Pools, CA" />
+
+ <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