Bimba.git

commit 22b098bd9ced71e72f8430722118c5d1d355ff5b

Author: Adam Evyčędo <git@apiote.xyz>

add icon to alerts and fix layouts

 app/src/main/java/xyz/apiote/bimba/czwek/departures/Departures.kt | 7 
 app/src/main/res/layout/activity_departures.xml | 29 
 app/src/main/res/layout/departure_bottom_sheet.xml | 41 


diff --git a/app/src/main/java/xyz/apiote/bimba/czwek/departures/Departures.kt b/app/src/main/java/xyz/apiote/bimba/czwek/departures/Departures.kt
index 12adcbe6a474d8079c86e88c428786522a125a66..e9e3f4f5959c248d1a2cd1014168a587f3a429f9 100644
--- a/app/src/main/java/xyz/apiote/bimba/czwek/departures/Departures.kt
+++ b/app/src/main/java/xyz/apiote/bimba/czwek/departures/Departures.kt
@@ -298,10 +298,9 @@ 					}
 			}
 
 			if (departure.alerts.isNotEmpty()) {
-				findViewById<MaterialTextView>(R.id.alerts).let { alertsView ->
-					alertsView.text = departure.alerts.joinToString(separator = "\n") { it.header }
-					alertsView.visibility = View.VISIBLE
-				}
+				findViewById<MaterialTextView>(R.id.alerts_text).text =
+					departure.alerts.joinToString(separator = "\n") { it.header }
+				findViewById<LinearLayout>(R.id.alerts).visibility = View.VISIBLE
 			}
 
 			findViewById<MapView>(R.id.map).let { map ->




diff --git a/app/src/main/res/layout/activity_departures.xml b/app/src/main/res/layout/activity_departures.xml
index 6dcbe613b9299466942966ea78addb1a2d5dd644..4744dc352f27edaf2b35495e8d89e7775388ef95 100644
--- a/app/src/main/res/layout/activity_departures.xml
+++ b/app/src/main/res/layout/activity_departures.xml
@@ -27,33 +27,44 @@ 		android:id="@+id/alerts"
 		android:layout_width="match_parent"
 		android:layout_height="100dp"
 		android:backgroundTint="@color/safety"
-		app:layout_anchor="@id/app_bar_layout"
 		android:visibility="gone"
+		app:layout_anchor="@id/app_bar_layout"
 		app:layout_anchorGravity="bottom">
 
 		<androidx.constraintlayout.widget.ConstraintLayout
 			android:layout_width="match_parent"
 			android:layout_height="match_parent">
+
+			<ImageView
+				android:id="@+id/imageView"
+				android:layout_width="wrap_content"
+				android:layout_height="wrap_content"
+				android:layout_marginStart="8dp"
+				android:importantForAccessibility="no"
+				android:src="@drawable/warning"
+				app:layout_constraintStart_toStartOf="parent"
+				app:layout_constraintTop_toTopOf="@+id/alerts_text"
+				app:tint="@color/black" />
 
 			<com.google.android.material.textview.MaterialTextView
 				android:id="@+id/alerts_text"
 				android:layout_width="0dp"
+				android:layout_height="0dp"
 				android:layout_marginStart="8dp"
-				android:layout_marginEnd="8dp"
-				android:layout_height="0dp"
 				android:layout_marginTop="58dp"
+				android:layout_marginEnd="8dp"
 				android:ellipsize="end"
 				android:maxLines="2"
 				android:textColor="@color/black"
-				tool:text="Warning: Serious blockade on Piastowska towards Wojska Polskiego. Lines 5, 14, 163 diverted. Change for other means of transport, e.g. lines \n\naaaaa"
 				app:layout_constraintBottom_toBottomOf="parent"
 				app:layout_constraintEnd_toStartOf="@+id/more_button"
-				app:layout_constraintStart_toStartOf="parent"
-				app:layout_constraintTop_toTopOf="parent" />
+				app:layout_constraintStart_toEndOf="@+id/imageView"
+				app:layout_constraintTop_toTopOf="parent"
+				tool:text="Warning: Serious blockade on Piastowska towards Wojska Polskiego. Lines 5, 14, 163 diverted. Change for other means of transport, e.g. lines \n\naaaaa" />
 
 			<com.google.android.material.button.MaterialButton
+				android:id="@+id/more_button"
 				style="@style/Widget.Material3.Button.TextButton"
-				android:id="@+id/more_button"
 				android:layout_width="wrap_content"
 				android:layout_height="wrap_content"
 				android:text="@string/more"
@@ -125,8 +136,8 @@ 				android:id="@+id/departures_app_bar"
 				android:layout_width="match_parent"
 				android:layout_height="?attr/actionBarSize"
 				android:elevation="0dp"
-				app:menu="@menu/departures_menu"
-				app:layout_collapseMode="pin" />
+				app:layout_collapseMode="pin"
+				app:menu="@menu/departures_menu" />
 
 		</com.google.android.material.appbar.CollapsingToolbarLayout>
 




diff --git a/app/src/main/res/layout/departure_bottom_sheet.xml b/app/src/main/res/layout/departure_bottom_sheet.xml
index aff2ace0c5751d220569ca16d751fe4f1502e399..5d5c7b3acb6ae7a0b5a21c7c50f67771ed7fc176 100644
--- a/app/src/main/res/layout/departure_bottom_sheet.xml
+++ b/app/src/main/res/layout/departure_bottom_sheet.xml
@@ -94,7 +94,8 @@
 	<LinearLayout
 		android:id="@+id/boarding"
 		android:layout_width="wrap_content"
-		android:layout_height="wrap_content">
+		android:layout_height="wrap_content"
+		android:gravity="center_vertical">
 
 		<ImageView
 			android:id="@+id/boarding_icon"
@@ -116,7 +117,8 @@
 	<LinearLayout
 		android:id="@+id/speed"
 		android:layout_width="wrap_content"
-		android:layout_height="wrap_content">
+		android:layout_height="wrap_content"
+		android:gravity="center_vertical">
 
 		<ImageView
 			android:id="@+id/speed_icon"
@@ -138,7 +140,8 @@
 	<LinearLayout
 		android:id="@+id/congestion"
 		android:layout_width="wrap_content"
-		android:layout_height="wrap_content">
+		android:layout_height="wrap_content"
+		android:gravity="center_vertical">
 
 		<ImageView
 			android:id="@+id/congestion_icon"
@@ -160,7 +163,8 @@
 	<LinearLayout
 		android:id="@+id/occupancy"
 		android:layout_width="wrap_content"
-		android:layout_height="wrap_content">
+		android:layout_height="wrap_content"
+		android:gravity="center_vertical">
 
 		<ImageView
 			android:id="@+id/occupancy_icon"
@@ -235,16 +239,33 @@ 		android:contentDescription="@string/usb_charging_content_description"
 		app:srcCompat="@drawable/usb"
 		tool:ignore="MissingConstraints" />
 
-	<com.google.android.material.textview.MaterialTextView
+	<LinearLayout
+		android:layout_marginTop="8dp"
 		android:id="@+id/alerts"
 		android:layout_width="match_parent"
 		android:layout_height="wrap_content"
-		android:layout_margin="16dp"
+		android:gravity="center_vertical"
+		android:visibility="gone"
 		android:background="@color/safety"
-		android:textColor="@color/black"
-		android:visibility="gone"
-		app:layout_constraintTop_toBottomOf="@+id/capabilities"
-		tool:text="Severe stops on Metropolitan line towards Tower Hill through Victoria" />
+		app:layout_constraintTop_toBottomOf="@+id/capabilities">
+
+		<ImageView
+			android:layout_marginStart="8dp"
+			android:layout_width="wrap_content"
+			android:layout_height="wrap_content"
+			app:tint="@color/black"
+			android:importantForAccessibility="no"
+			android:src="@drawable/warning" />
+
+		<com.google.android.material.textview.MaterialTextView
+			android:id="@+id/alerts_text"
+			android:layout_width="match_parent"
+			android:layout_height="wrap_content"
+			android:layout_margin="8dp"
+			android:padding="8dp"
+			android:textColor="@color/black"
+			tool:text="Severe stops on Metropolitan line towards Tower Hill through Victoria" />
+	</LinearLayout>
 
 	<org.osmdroid.views.MapView
 		android:id="@+id/map"