Bimba.git

commit a2f7e965375b894e706b4c77af8b8eca7dd50fbf

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

show alert description on click in specific departure

 app/src/main/java/xyz/apiote/bimba/czwek/departures/Departures.kt | 13 
 app/src/main/java/xyz/apiote/bimba/czwek/repo/Departure.kt | 2 


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 e9e3f4f5959c248d1a2cd1014168a587f3a429f9..3e08a953ccea76e24a3a5454bd934d9a7a4af9ca 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
@@ -22,6 +22,7 @@ import androidx.recyclerview.widget.DiffUtil
 import androidx.recyclerview.widget.RecyclerView
 import com.google.android.material.bottomsheet.BottomSheetDialog
 import com.google.android.material.bottomsheet.BottomSheetDialogFragment
+import com.google.android.material.dialog.MaterialAlertDialogBuilder
 import com.google.android.material.textview.MaterialTextView
 import org.osmdroid.tileprovider.tilesource.TileSourceFactory
 import org.osmdroid.util.GeoPoint
@@ -300,7 +301,17 @@
 			if (departure.alerts.isNotEmpty()) {
 				findViewById<MaterialTextView>(R.id.alerts_text).text =
 					departure.alerts.joinToString(separator = "\n") { it.header }
-				findViewById<LinearLayout>(R.id.alerts).visibility = View.VISIBLE
+				findViewById<LinearLayout>(R.id.alerts).apply {
+					visibility = View.VISIBLE
+					setOnClickListener {
+						MaterialAlertDialogBuilder(context)
+							.setTitle("Alerts")
+							.setPositiveButton(R.string.ok) { _, _ -> }
+							.setMessage(departure.alerts.map { it.description }.filter { it != "" }
+								.joinToString(separator = "\n"))
+							.show()
+					}
+				}
 			}
 
 			findViewById<MapView>(R.id.map).let { map ->




diff --git a/app/src/main/java/xyz/apiote/bimba/czwek/repo/Departure.kt b/app/src/main/java/xyz/apiote/bimba/czwek/repo/Departure.kt
index 26bdd342b5a4b416f7f20748daf9387ff13c876a..358a7bbd7ed88d19af4e2e9fdb6a26ff7774cb6f 100644
--- a/app/src/main/java/xyz/apiote/bimba/czwek/repo/Departure.kt
+++ b/app/src/main/java/xyz/apiote/bimba/czwek/repo/Departure.kt
@@ -183,4 +183,4 @@ 			boarding.and(0b0011_0011u) == (0b0001_0001).toUByte() -> context.getString(R.string.boarding)
 			else -> context.getString(R.string.on_demand)
 		}
 	}
-}
\ No newline at end of file
+}