Bimba.git

commit 39f47ca66882cb8d82cf3b5e183c51c6711eff86

Author: Adam Pioterek <adam.pioterek@protonmail.ch>

show departure time on departure click

%!v(PANIC=String method: strings: negative Repeat count)


diff --git a/app/src/main/java/ml/adamsprogs/bimba/models/adapters/DeparturesAdapter.kt b/app/src/main/java/ml/adamsprogs/bimba/models/adapters/DeparturesAdapter.kt
index d9b1c1d14fdedf06307fcc8ef23a54ff6a58c478..13a2f5765c5ec92fd13aa9ec8f05681c5f3ce0ed 100644
--- a/app/src/main/java/ml/adamsprogs/bimba/models/adapters/DeparturesAdapter.kt
+++ b/app/src/main/java/ml/adamsprogs/bimba/models/adapters/DeparturesAdapter.kt
@@ -16,7 +16,6 @@ import ml.adamsprogs.bimba.models.Departure
 import ml.adamsprogs.bimba.rollTime
 import java.util.*
 
-//todo<p:1> on click show time (HH:MM)
 class DeparturesAdapter(val context: Context, private val departures: List<Departure>?, private val relativeTime: Boolean) :
         RecyclerView.Adapter<DeparturesAdapter.ViewHolder>() {
 
@@ -25,12 +24,6 @@         const val VIEW_TYPE_LOADING: Int = 0
         const val VIEW_TYPE_CONTENT: Int = 1
         const val VIEW_TYPE_EMPTY: Int = 2
     }
-
-//    init {
-//        departures?.forEach {
-//            println("${it.line} -> ${it.headsign} @${it.time} (${if (it.isModified) it.modification[0] else{} })")
-//        }
-//    }
 
     override fun getItemCount(): Int {
         if (departures == null || departures.isEmpty())
@@ -86,14 +79,21 @@         if (departure.lowFloor)
             holder.floorIcon.visibility = View.VISIBLE
         if (departure.isModified) {
             holder.infoIcon.visibility = View.VISIBLE
-            holder.root.setOnClickListener {
-                AlertDialog.Builder(context)
-                        .setPositiveButton(context.getText(android.R.string.ok),
-                                { dialog: DialogInterface, _: Int -> dialog.cancel() })
-                        .setCancelable(true)
-                        .setMessage(departure.modification.joinToString("; "))
-                        .create().show()
-            }
+        }
+        holder.root.setOnClickListener {
+            AlertDialog.Builder(context)
+                    .setPositiveButton(context.getText(android.R.string.ok)
+                    ) { dialog: DialogInterface, _: Int -> dialog.cancel() }
+                    .setCancelable(true)
+                    .setMessage(
+                            context.getString(R.string.departure_at,
+                                    "${String.format("%02d",
+                                            departureTime.get(Calendar.HOUR_OF_DAY))}:${String.format("%02d",
+                                            departureTime.get(Calendar.MINUTE))}")
+                                    + if (departure.isModified)
+                                " " + departure.modification.joinToString("; ", "(", ")")
+                            else "")
+                    .create().show()
         }
     }
 




diff --git a/build.gradle b/build.gradle
index 0668dc9970d10f9ac7d1a60344647da1ad8b46ef..abd71c41b0e3809a905d7e36ce37c4c9b60fb0b2 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,7 +1,7 @@
 // Top-level build file where you can add configuration options common to all sub-projects/modules.
 
 buildscript {
-    ext.kotlin_version = '1.2.50'
+    ext.kotlin_version = '1.2.51'
     repositories {
         jcenter()
         maven { url 'https://maven.google.com' }