Bimba.git

commit 4cb4f45d696585f3d02864102ff408e35784e8bf

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

tidying TODOs

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


diff --git a/.idea/misc.xml b/.idea/misc.xml
index ba7052b8197ddf8ba8756022d905d03055c7ad60..635999df1e86791ad3787e455b4524e4d8879b93 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -24,7 +24,7 @@         
       </value>
     </option>
   </component>
-  <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
+  <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
     <output url="file://$PROJECT_DIR$/build/classes" />
   </component>
   <component name="ProjectType">




diff --git a/app/src/main/java/ml/adamsprogs/bimba/activities/DashActivity.kt b/app/src/main/java/ml/adamsprogs/bimba/activities/DashActivity.kt
index 3278af11e13f5f7ab102f9f4d4cd557d6bca5cc1..0b7449ef86b932cab5ae027af8c017cd364a777f 100644
--- a/app/src/main/java/ml/adamsprogs/bimba/activities/DashActivity.kt
+++ b/app/src/main/java/ml/adamsprogs/bimba/activities/DashActivity.kt
@@ -150,7 +150,7 @@     }
 
     private fun getSuggestions() {
         timetable = Timetable.getTimetable(this)
-        suggestions = (timetable.getStopSuggestions(context) + timetable.getLineSuggestions()).sorted() //todo + bike stations, &c
+        suggestions = (timetable.getStopSuggestions(context) + timetable.getLineSuggestions()).sorted() //todo<p:v+1> + bike stations, &c
     }
 
     private fun prepareListeners() {




diff --git a/app/src/main/java/ml/adamsprogs/bimba/activities/StopActivity.kt b/app/src/main/java/ml/adamsprogs/bimba/activities/StopActivity.kt
index c6e9a118bfcd0d6ae14e5048e9884c5f35e56894..76890245ec5398ab355585494c2b088ec45fd84c 100644
--- a/app/src/main/java/ml/adamsprogs/bimba/activities/StopActivity.kt
+++ b/app/src/main/java/ml/adamsprogs/bimba/activities/StopActivity.kt
@@ -195,7 +195,7 @@         try {
             Snackbar.make(findViewById(R.id.drawer_layout), message, Snackbar.LENGTH_LONG).show()
         } catch (e: IllegalArgumentException) {
         }
-        //todo refresh
+        refreshAdapterFromStop()
     }
 
     private fun selectTodayPage() {




diff --git a/app/src/main/java/ml/adamsprogs/bimba/activities/StopSpecifyActivity.kt b/app/src/main/java/ml/adamsprogs/bimba/activities/StopSpecifyActivity.kt
index 1c74037fc464c9680a7f5b748a2af5c89e00c328..af2cc5348b570956ec639644686c79df79e8e54a 100644
--- a/app/src/main/java/ml/adamsprogs/bimba/activities/StopSpecifyActivity.kt
+++ b/app/src/main/java/ml/adamsprogs/bimba/activities/StopSpecifyActivity.kt
@@ -64,7 +64,7 @@                 context.startActivity(intent)
             }
             holder?.stopCode?.text = values.values.sortedBy { it.first }[position].first
             holder?.stopHeadlines?.text = values.values.sortedBy { it.first }[position].second
-                    .sortedBy { it } // fixme natural sort
+                    .sortedBy { it } // fixme<p:1> natural sort
                     .joinToString()
         }
 




diff --git a/app/src/main/java/ml/adamsprogs/bimba/datasources/VmClient.kt b/app/src/main/java/ml/adamsprogs/bimba/datasources/VmClient.kt
index 5fd92d1569833ad9b2ab4a035028c512757d4131..a6a5efe8c0ee0cb500afdd641bc0abccc13c3bc3 100644
--- a/app/src/main/java/ml/adamsprogs/bimba/datasources/VmClient.kt
+++ b/app/src/main/java/ml/adamsprogs/bimba/datasources/VmClient.kt
@@ -218,7 +218,7 @@         val departuresForPlate = HashMap>()
         departuresForPlate[timetable.getServiceForToday()] = departures
         val vm = vms[plateId.stop] ?: HashSet()
         try {
-            vm.remove(vm.filter { it.id == plateId }[0]) //fixme outOfBound when vm is still empty (1st time)
+            vm.remove(vm.filter { it.id == plateId }[0])
         } catch (e: IndexOutOfBoundsException) {
         }
         vm.add(Plate(plateId, departuresForPlate))




diff --git a/app/src/main/java/ml/adamsprogs/bimba/extensions.kt b/app/src/main/java/ml/adamsprogs/bimba/extensions.kt
index b2b0ef86114e2a778919fb717f06658e43fc48f5..cbfd948ff1eb54bffaccb8a4ba2cb1749d6f9ee8 100644
--- a/app/src/main/java/ml/adamsprogs/bimba/extensions.kt
+++ b/app/src/main/java/ml/adamsprogs/bimba/extensions.kt
@@ -8,19 +8,6 @@ import java.text.SimpleDateFormat
 import java.util.*
 import kotlin.collections.ArrayList
 
-internal fun String.toPascalCase(): String { //check
-    val builder = StringBuilder(this)
-    var isLastCharSeparator = true
-    builder.forEach {
-        isLastCharSeparator = if ((it in 'a'..'z' || it in 'A'..'Z') && isLastCharSeparator) {
-            it.toUpperCase()
-            false
-        } else
-            true
-    }
-    return builder.toString()
-}
-
 internal fun Calendar.rollTime(seconds: Int): Calendar {
     val hour = seconds / 3600
     val minute = (seconds % 3600) / 60




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 04c6d02d8918c85da101628c7e61308c1a96037d..0eb7397205931b86245248b00c12bde5eb2b3fa2 100644
--- a/app/src/main/java/ml/adamsprogs/bimba/models/Departure.kt
+++ b/app/src/main/java/ml/adamsprogs/bimba/models/Departure.kt
@@ -48,7 +48,7 @@
             return rollDepartures(departures)
         }
 
-        fun rollDepartures(departures: Map<AgencyAndId, List<Departure>>): Map<AgencyAndId, List<Departure>> { //todo it'd be nice to roll from tomorrow's real mode (Fri->Sat, Sat->Sun, Sun->Mon)
+        fun rollDepartures(departures: Map<AgencyAndId, List<Departure>>): Map<AgencyAndId, List<Departure>> { //todo<p:2> it'd be nice to roll from tomorrow's real mode (Fri->Sat, Sat->Sun, Sun->Mon)
             val rolledDepartures = HashMap<AgencyAndId, List<Departure>>()
             departures.keys.forEach {
                 val (filtered, isFull) = filterDepartures(departures[it]!!)




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 6317687b892755457d3b245a21d8890f7f93e0d3..cbe2a96fbfe7eab93b3d26dbc52929d91843414d 100644
--- a/app/src/main/java/ml/adamsprogs/bimba/models/DeparturesAdapter.kt
+++ b/app/src/main/java/ml/adamsprogs/bimba/models/DeparturesAdapter.kt
@@ -59,8 +59,7 @@         val departureIn = (departureTime.timeInMillis - now.timeInMillis) / (1000 * 60)
         val timeString: String
 
         timeString = if (departureIn > 60 || departureIn < 0 || !relativeTime)
-        //todo shall we pad hour too?
-            context.getString(R.string.departure_at, "${departureTime.get(Calendar.HOUR_OF_DAY)}:${String.format("%02d", departureTime.get(Calendar.MINUTE))}")
+            context.getString(R.string.departure_at, "${String.format("%02d", departureTime.get(Calendar.HOUR_OF_DAY))}:${String.format("%02d", departureTime.get(Calendar.MINUTE))}")
         else if (departureIn > 0 && !departure.onStop)
             context.getString(Declinator.decline(departureIn), departureIn.toString())
         else




diff --git a/app/src/main/java/ml/adamsprogs/bimba/models/Favourite.kt b/app/src/main/java/ml/adamsprogs/bimba/models/Favourite.kt
index 39e57b475e9ac11356b7b488a2e27219edf3288b..c0b449335f8183356dce641f4aa616632b550b04 100644
--- a/app/src/main/java/ml/adamsprogs/bimba/models/Favourite.kt
+++ b/app/src/main/java/ml/adamsprogs/bimba/models/Favourite.kt
@@ -167,7 +167,7 @@         tomorrowDepartures.forEach { twoDayDepartures.add(it) }
         return twoDayDepartures
     }
 
-    fun allDepartures(): Map<AgencyAndId, List<Departure>> { // fixme departures through vm not the other way around
+    fun allDepartures(): Map<AgencyAndId, List<Departure>> { // fixme<c:optimisation> departures through vm not the other way around
         val departures = timetable.getStopDepartures(timetables) as HashMap<AgencyAndId, ArrayList<Departure>>
 
         if (vmDepartures.isNotEmpty()) {




diff --git a/app/src/main/java/ml/adamsprogs/bimba/models/Timetable.kt b/app/src/main/java/ml/adamsprogs/bimba/models/Timetable.kt
index 9f86876f52865b6f649e12114a1c62485e8872d6..748fc1ee4cd3fbed00bdaa7f49db09b015a6eac3 100644
--- a/app/src/main/java/ml/adamsprogs/bimba/models/Timetable.kt
+++ b/app/src/main/java/ml/adamsprogs/bimba/models/Timetable.kt
@@ -232,7 +232,7 @@
         return plates.map { getStopDeparturesByPlate(it, trips) }.toSet()
     }
 
-    private fun getStopDeparturesByPlate(plate: Plate, trips: Map<String, Trip>): Plate { //fixme takes too long
+    private fun getStopDeparturesByPlate(plate: Plate, trips: Map<String, Trip>): Plate { //fixme<c:optimisation> takes too long
         println("getStopDeparturesByPlate: ${JCalendar.getInstance().timeInMillis}")
         val resultPlate = Plate(Plate.ID(plate.id), HashMap())
         val stopTimes = HashMap<String, Map<String, Any>>()
@@ -302,7 +302,7 @@         mapReader.close()
         throw IllegalArgumentException("Service $serviceId not in store")
     }
 
-    private fun explainModification(trip: Trip, stopSequence: Int): List<String> { //todo "kurs obsługiwany taborem niskopodłogowym" -> ignore
+    private fun explainModification(trip: Trip, stopSequence: Int): List<String> { //todo<p:1> "kurs obsługiwany taborem niskopodłogowym" -> ignore
         val route = getRouteForTrip(trip)
         val definitions = route.modifications