Bimba.git

commit 0d0fd114673cd6655cbcac5d4a51c8cd537f55c1

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

no ‘null’ modification in VM

 app/src/main/java/ml/adamsprogs/bimba/models/Departure.kt | 7 
 app/src/main/java/ml/adamsprogs/bimba/models/DeparturesAdapter.kt | 2 


diff --git a/app/src/main/java/ml/adamsprogs/bimba/models/Departure.kt b/app/src/main/java/ml/adamsprogs/bimba/models/Departure.kt
index aeb84a374901e524f2a24bb439ba52ac2b56393e..036976a39cdee66aee5c8027fc688a3cb1592813 100644
--- a/app/src/main/java/ml/adamsprogs/bimba/models/Departure.kt
+++ b/app/src/main/java/ml/adamsprogs/bimba/models/Departure.kt
@@ -7,6 +7,11 @@ data class Departure(val line: String, private val mode: String, val time: String, val lowFloor: Boolean,
                      val modification: String?, val direction: String, val vm: Boolean = false,
                      var tomorrow: Boolean = false, val onStop: Boolean = false) {
 
+    val isModified: Boolean
+        get() {
+            return modification != null && modification != "" && modification != "null"
+        }
+
     override fun toString(): String {
         return "$line|$mode|$time|$lowFloor|$modification|$direction|$vm|$tomorrow|$onStop"
     }
@@ -35,7 +40,7 @@         fun createDepartures(stopId: String): HashMap> {
             val timetable = Timetable.getTimetable()
             val departures = timetable.getStopDepartures(stopId)
             val moreDepartures = HashMap<String, ArrayList<Departure>>()
-            for ((k,v) in departures) {
+            for ((k, v) in departures) {
                 moreDepartures[k] = ArrayList()
                 for (departure in v)
                     moreDepartures[k]!!.add(departure.copy())




diff --git a/app/src/main/java/ml/adamsprogs/bimba/models/DeparturesAdapter.kt b/app/src/main/java/ml/adamsprogs/bimba/models/DeparturesAdapter.kt
index 027cfb3f305598b2af2940c29a2ec28edb8238c7..45561679123a7d51e4db7779c659345e8afaac68 100644
--- a/app/src/main/java/ml/adamsprogs/bimba/models/DeparturesAdapter.kt
+++ b/app/src/main/java/ml/adamsprogs/bimba/models/DeparturesAdapter.kt
@@ -72,7 +72,7 @@             icon?.setImageDrawable(ResourcesCompat.getDrawable(context.resources, R.drawable.ic_departure_timetable, context.theme))
 
         if (departure.lowFloor)
             holder?.floorIcon?.visibility = View.VISIBLE
-        if (departure.modification != "") {
+        if (departure.isModified) {
             holder?.infoIcon?.visibility = View.VISIBLE
             holder?.root?.setOnClickListener {
                 AlertDialog.Builder(context)