Bimba.git

commit 75997bba18482bf38cc8388d9b40432d8119ccf5

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

kotlin stable corutines

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


diff --git a/app/src/androidTest/java/ml/adamsprogs/bimba/ExampleInstrumentedTest.java b/app/src/androidTest/java/ml/adamsprogs/bimba/ExampleInstrumentedTest.java
deleted file mode 100644
index cef03f892c551316d036664d501ddd0933ba8383..0000000000000000000000000000000000000000
--- a/app/src/androidTest/java/ml/adamsprogs/bimba/ExampleInstrumentedTest.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package ml.adamsprogs.bimba;
-
-import android.content.Context;
-import androidx.test.InstrumentationRegistry;
-import androidx.test.runner.AndroidJUnit4;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-import static org.junit.Assert.*;
-
-/**
- * Instrumentation test, which will execute on an Android device.
- *
- * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
- */
-@RunWith(AndroidJUnit4.class)
-public class ExampleInstrumentedTest {
-    @Test
-    public void useAppContext() throws Exception {
-        // Context of the app under test.
-        Context appContext = InstrumentationRegistry.getTargetContext();
-
-        assertEquals("ml.adamsprogs.bimba", appContext.getPackageName());
-    }
-}




diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index e0b120550519b6a66af16dd4c18b7fe0c5606fcc..25e36bf5433aefd3a374503d0e5d22067650e1ad 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -1,5 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
     package="ml.adamsprogs.bimba"
     android:installLocation="auto">
 
@@ -7,12 +8,12 @@     
     <uses-permission android:name="android.permission.INTERNET" />
 
     <application
-        android:allowBackup="true"
         android:icon="@mipmap/ic_launcher"
+        android:label="@string/app_name"
         android:roundIcon="@mipmap/ic_launcher_round"
-        android:label="@string/app_name"
         android:supportsRtl="true"
-        android:theme="@style/AppTheme">
+        android:theme="@style/AppTheme"
+        tools:ignore="GoogleAppIndexingWarning">
         <activity android:name=".activities.DashActivity" />
 
         <service
@@ -33,15 +34,11 @@                      android:name=".activities.SettingsActivity"
             android:label="@string/title_activity_settings"
             android:parentActivityName=".activities.DashActivity"
-            android:theme="@style/AppTheme" >
+            android:theme="@style/AppTheme">
             <meta-data
                 android:name="android.support.PARENT_ACTIVITY"
                 android:value="ml.adamsprogs.bimba.activities.DashActivity" />
         </activity>
-        <activity
-            android:name=".activities.HelpActivity"
-            android:label="@string/title_activity_help"
-            android:theme="@style/AppTheme" />
 
         <service
             android:name=".datasources.VmService"




diff --git a/app/src/main/java/ml/adamsprogs/bimba/NetworkStateReceiver.kt b/app/src/main/java/ml/adamsprogs/bimba/NetworkStateReceiver.kt
index 2acd1e1eb9dbb95db986e6907c6e07db549c9792..770ba13101e61f4ccd213248bb2af9aadc0f4874 100644
--- a/app/src/main/java/ml/adamsprogs/bimba/NetworkStateReceiver.kt
+++ b/app/src/main/java/ml/adamsprogs/bimba/NetworkStateReceiver.kt
@@ -24,14 +24,6 @@             }
         }
     }
 
-    fun addOnConnectivityChangeListener(listener: OnConnectivityChangeListener) {
-        onConnectivityChangeListeners.add(listener)
-    }
-
-    fun removeOnConnectivityChangeListener(listener: OnConnectivityChangeListener) {
-        onConnectivityChangeListeners.remove(listener)
-    }
-
     interface OnConnectivityChangeListener {
         fun onConnectivityChange(connected: Boolean)
     }




diff --git a/app/src/main/java/ml/adamsprogs/bimba/NotificationChannels.kt b/app/src/main/java/ml/adamsprogs/bimba/NotificationChannels.kt
index 009de4ed616680e7e1b7cc6c91aa152330e3cb75..738003153a01f7d7753f888009f26268299a5f78 100644
--- a/app/src/main/java/ml/adamsprogs/bimba/NotificationChannels.kt
+++ b/app/src/main/java/ml/adamsprogs/bimba/NotificationChannels.kt
@@ -8,7 +8,7 @@
 
 class NotificationChannels {
     companion object {
-        val CHANNEL_UPDATES = "updates"
+        const val CHANNEL_UPDATES = "updates"
 
         @RequiresApi(Build.VERSION_CODES.O)
         fun makeChannel(id: String, name: String, manager: NotificationManager) {




diff --git a/app/src/main/java/ml/adamsprogs/bimba/ProviderProxy.kt b/app/src/main/java/ml/adamsprogs/bimba/ProviderProxy.kt
index cb45d2c150fc033ecc5e182c06d5a0db0a967280..59fb99a4f9c56b6927f3996146904d74b070883e 100644
--- a/app/src/main/java/ml/adamsprogs/bimba/ProviderProxy.kt
+++ b/app/src/main/java/ml/adamsprogs/bimba/ProviderProxy.kt
@@ -1,11 +1,17 @@
 package ml.adamsprogs.bimba
 
-import android.content.*
+import android.content.Context
+import android.content.Intent
 import kotlinx.coroutines.*
 import kotlinx.coroutines.android.Main
-import ml.adamsprogs.bimba.datasources.*
-import ml.adamsprogs.bimba.models.*
-import ml.adamsprogs.bimba.models.suggestions.*
+import ml.adamsprogs.bimba.datasources.VmClient
+import ml.adamsprogs.bimba.datasources.VmService
+import ml.adamsprogs.bimba.models.Departure
+import ml.adamsprogs.bimba.models.Plate
+import ml.adamsprogs.bimba.models.StopSegment
+import ml.adamsprogs.bimba.models.Timetable
+import ml.adamsprogs.bimba.models.suggestions.GtfsSuggestion
+import ml.adamsprogs.bimba.models.suggestions.StopSuggestion
 import java.util.*
 import kotlin.collections.HashMap
 
@@ -24,13 +30,13 @@         const val MODE_VM = "mode_vm"
     }
 
     fun getSuggestions(query: String = "", callback: (List<GtfsSuggestion>) -> Unit) {
-        launch(Dispatchers.Main, CoroutineStart.DEFAULT, null, {
-            val filtered = withContext(Dispatchers.Default) {
-                suggestions = getStopSuggestions(query) //+ getLineSuggestions(query) //todo<p:v+1> + bike stations, train stations, &c
-                filterSuggestions(query)
+        GlobalScope.launch {
+            suggestions = getStopSuggestions(query) //+ getLineSuggestions(query) //todo<p:v+1> + bike stations, train stations, &c
+            val filtered = filterSuggestions(query)
+            launch(Dispatchers.Main) {
+                callback(filtered)
             }
-            callback(filtered)
-        })
+        }
     }
 
     private suspend fun getStopSuggestions(query: String): List<StopSuggestion> {
@@ -65,18 +71,18 @@         return result
     }
 
     fun getSheds(name: String, callback: (Map<String, Set<String>>) -> Unit) {
-        launch(Dispatchers.Main) {
-            val sheds = withContext(Dispatchers.Default) {
-                val vmSheds = vmClient.getSheds(name)
+        GlobalScope.launch {
+            val vmSheds = vmClient.getSheds(name)
 
-                if (vmSheds.isEmpty() and !timetable.isEmpty()) {
-                    timetable.getHeadlinesForStop(name)
-                } else {
-                    vmSheds
-                }
+            val sheds = if (vmSheds.isEmpty() and !timetable.isEmpty()) {
+                timetable.getHeadlinesForStop(name)
+            } else {
+                vmSheds
             }
 
-            callback(sheds)
+            launch(Dispatchers.Main) {
+                callback(sheds)
+            }
         }
     }
 
@@ -104,13 +110,13 @@         return uuid
     }
 
     private fun constructSegmentDepartures(stopSegments: Set<StopSegment>): Deferred<Map<String, List<Departure>>> {
-        return GlobalScope.async(Dispatchers.Default, CoroutineStart.DEFAULT, null, {
+        return GlobalScope.async {
             if (timetable.isEmpty())
                 emptyMap()
             else {
                 timetable.getStopDeparturesBySegments(stopSegments)
             }
-        })
+        }
     }
 
     private fun filterDepartures(departures: Map<String, List<Departure>>): List<Departure> {
@@ -161,10 +167,8 @@
     }
 
     fun fillStopSegment(stopSegment: StopSegment, callback: (StopSegment?) -> Unit) {
-        launch(Dispatchers.Main) {
-            withContext(Dispatchers.Default) {
-                callback(fillStopSegment(stopSegment))
-            }
+        GlobalScope.launch {
+            callback(fillStopSegment(stopSegment))
         }
     }
 
@@ -179,10 +183,8 @@             timetable.getHeadlinesForStopCode(stopSegment.stop)
     }
 
     fun getStopName(stopCode: String, callback: (String?) -> Unit) {
-        launch(Dispatchers.Main) {
-            withContext(Dispatchers.Default) {
-                callback(getStopName(stopCode))
-            }
+        GlobalScope.launch {
+            callback(getStopName(stopCode))
         }
     }
 
@@ -216,13 +218,13 @@         private var cache: Deferred>>? = null
 
         init {
             receiver.addOnVmListener(this@Request)
-            launch(Dispatchers.Main) {
+            GlobalScope.launch {
                 cache = constructSegmentDepartures(segments)
             }
         }
 
         override fun onVm(vmDepartures: Set<Departure>?, plateId: Plate.ID?, stopCode: String, code: Int) {
-            launch(Dispatchers.Main) {
+            GlobalScope.launch(Dispatchers.Main) {
                 if ((plateId == null || vmDepartures == null) and (timetable.isEmpty())) {
                     listener.onDeparturesReady(emptyList(), null, code)
                     return@launch




diff --git a/app/src/main/java/ml/adamsprogs/bimba/activities/AppCompatPreferenceActivity.java b/app/src/main/java/ml/adamsprogs/bimba/activities/AppCompatPreferenceActivity.java
index 7b03da3605836238efd3510809d1b1771fd01aa5..d276164afc8be57b1d2a6d4c629670704dd536cf 100644
--- a/app/src/main/java/ml/adamsprogs/bimba/activities/AppCompatPreferenceActivity.java
+++ b/app/src/main/java/ml/adamsprogs/bimba/activities/AppCompatPreferenceActivity.java
@@ -1,16 +1,17 @@
 package ml.adamsprogs.bimba.activities;
 
 import android.content.res.Configuration;
-        import android.os.Bundle;
-        import android.preference.PreferenceActivity;
-        import androidx.annotation.LayoutRes;
-        import androidx.annotation.Nullable;
-        import androidx.appcompat.app.ActionBar;
-        import androidx.appcompat.app.AppCompatDelegate;
-        import androidx.appcompat.widget.Toolbar;
-        import android.view.MenuInflater;
-        import android.view.View;
-        import android.view.ViewGroup;
+import android.os.Bundle;
+import android.preference.PreferenceActivity;
+import android.view.MenuInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+import androidx.annotation.LayoutRes;
+import androidx.annotation.Nullable;
+import androidx.appcompat.app.ActionBar;
+import androidx.appcompat.app.AppCompatDelegate;
+import androidx.appcompat.widget.Toolbar;
 
 /**
  * A {@link android.preference.PreferenceActivity} which implements and proxies the necessary calls




diff --git a/app/src/main/java/ml/adamsprogs/bimba/activities/EditFavouriteActivity.kt b/app/src/main/java/ml/adamsprogs/bimba/activities/EditFavouriteActivity.kt
index 88b5ed22c741af9af23e41bc8816907bdeec6300..c372b185980e24b33d0c621529557d547276aa91 100644
--- a/app/src/main/java/ml/adamsprogs/bimba/activities/EditFavouriteActivity.kt
+++ b/app/src/main/java/ml/adamsprogs/bimba/activities/EditFavouriteActivity.kt
@@ -1,18 +1,15 @@
 package ml.adamsprogs.bimba.activities
 
-import androidx.appcompat.app.AppCompatActivity
+import android.app.Activity
+import android.content.Intent
 import android.os.Bundle
-import androidx.recyclerview.widget.DividerItemDecoration
-import androidx.recyclerview.widget.LinearLayoutManager
 import android.widget.EditText
+import androidx.appcompat.app.AppCompatActivity
+import kotlinx.android.synthetic.main.activity_edit_favourite.*
 import ml.adamsprogs.bimba.R
+import ml.adamsprogs.bimba.collections.FavouriteStorage
 import ml.adamsprogs.bimba.models.Favourite
 import ml.adamsprogs.bimba.models.adapters.FavouriteEditRowAdapter
-import ml.adamsprogs.bimba.collections.FavouriteStorage
-import kotlinx.android.synthetic.main.activity_edit_favourite.*
-import android.app.Activity
-import android.content.Intent
-
 
 
 class EditFavouriteActivity : AppCompatActivity() {




diff --git a/app/src/main/java/ml/adamsprogs/bimba/activities/HelpActivity.kt b/app/src/main/java/ml/adamsprogs/bimba/activities/HelpActivity.kt
deleted file mode 100644
index 026039082090bb96f13adec31ba24e988b0af75a..0000000000000000000000000000000000000000
--- a/app/src/main/java/ml/adamsprogs/bimba/activities/HelpActivity.kt
+++ /dev/null
@@ -1,15 +0,0 @@
-package ml.adamsprogs.bimba.activities
-
-import android.os.Bundle
-import androidx.appcompat.app.AppCompatActivity
-import kotlinx.android.synthetic.main.activity_help.*
-import ml.adamsprogs.bimba.R
-
-class HelpActivity : AppCompatActivity() {
-
-    override fun onCreate(savedInstanceState: Bundle?) {
-        super.onCreate(savedInstanceState)
-        setContentView(R.layout.activity_help)
-        setSupportActionBar(toolbar)
-    }
-}




diff --git a/app/src/main/java/ml/adamsprogs/bimba/activities/LineSpecifyActivity.kt b/app/src/main/java/ml/adamsprogs/bimba/activities/LineSpecifyActivity.kt
index 7984531efabc4948541fa1a8dd45ed62771faddd..79f7b0e63feb2b36c529c64ba63418a83a215ff6 100644
--- a/app/src/main/java/ml/adamsprogs/bimba/activities/LineSpecifyActivity.kt
+++ b/app/src/main/java/ml/adamsprogs/bimba/activities/LineSpecifyActivity.kt
@@ -1,17 +1,15 @@
 package ml.adamsprogs.bimba.activities
 
-import com.google.android.material.tabs.TabLayout
-import androidx.appcompat.app.AppCompatActivity
-
-import androidx.core.app.*
 import android.os.Bundle
-import android.view.*
-
+import android.view.LayoutInflater
+import android.view.View
+import android.view.ViewGroup
+import androidx.appcompat.app.AppCompatActivity
+import com.google.android.material.tabs.TabLayout
 import kotlinx.android.synthetic.main.activity_line_specify.*
 import kotlinx.android.synthetic.main.fragment_line_specify.view.*
 import ml.adamsprogs.bimba.R
 import ml.adamsprogs.bimba.models.Timetable
-import ml.adamsprogs.bimba.models.gtfs.*
 
 class LineSpecifyActivity : AppCompatActivity() {
     companion object {




diff --git a/app/src/main/java/ml/adamsprogs/bimba/activities/SplashActivity.kt b/app/src/main/java/ml/adamsprogs/bimba/activities/SplashActivity.kt
index e7d4d932546602262ee4d6c4d6cc4880d0bae41d..ff18b865168fce18b51c8abb639f0b194051a12d 100644
--- a/app/src/main/java/ml/adamsprogs/bimba/activities/SplashActivity.kt
+++ b/app/src/main/java/ml/adamsprogs/bimba/activities/SplashActivity.kt
@@ -1,12 +1,9 @@
 package ml.adamsprogs.bimba.activities
 
-import androidx.appcompat.app.AppCompatActivity
-import android.os.Bundle
 import android.content.Intent
-import android.database.sqlite.SQLiteCantOpenDatabaseException
+import android.os.Bundle
+import androidx.appcompat.app.AppCompatActivity
 import androidx.appcompat.app.AppCompatDelegate
-import ml.adamsprogs.bimba.models.Timetable
-import java.io.FileNotFoundException
 
 
 class SplashActivity : AppCompatActivity() {




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 02a19af457e6b15c8bed7cf496e301e52c90386f..1a526976df5df7f157d702d84ca19966c4d23328 100644
--- a/app/src/main/java/ml/adamsprogs/bimba/activities/StopActivity.kt
+++ b/app/src/main/java/ml/adamsprogs/bimba/activities/StopActivity.kt
@@ -1,21 +1,30 @@
 package ml.adamsprogs.bimba.activities
 
-import android.content.*
+import android.content.Intent
+import android.content.IntentFilter
 import android.os.Bundle
-import android.view.*
+import android.view.Menu
+import android.view.MenuItem
+import android.view.View
+import android.widget.AdapterView
+import androidx.appcompat.app.AppCompatActivity
 import androidx.core.content.res.ResourcesCompat
-import androidx.appcompat.app.AppCompatActivity
-import android.widget.AdapterView
 import com.google.android.material.snackbar.Snackbar
-
-import java.util.Calendar
 import kotlinx.android.synthetic.main.activity_stop.*
 import ml.adamsprogs.bimba.*
 import ml.adamsprogs.bimba.collections.FavouriteStorage
-import ml.adamsprogs.bimba.datasources.*
-import ml.adamsprogs.bimba.models.*
+import ml.adamsprogs.bimba.datasources.TimetableDownloader
+import ml.adamsprogs.bimba.datasources.VmService
+import ml.adamsprogs.bimba.models.Departure
+import ml.adamsprogs.bimba.models.Favourite
+import ml.adamsprogs.bimba.models.Plate
+import ml.adamsprogs.bimba.models.StopSegment
 import ml.adamsprogs.bimba.models.adapters.DeparturesAdapter
 import ml.adamsprogs.bimba.models.adapters.ServiceAdapter
+import java.util.Calendar
+import kotlin.collections.HashMap
+import kotlin.collections.HashSet
+import kotlin.collections.set
 
 class StopActivity : AppCompatActivity(), MessageReceiver.OnTimetableDownloadListener, ProviderProxy.OnDeparturesReadyListener {
     companion object {
@@ -25,10 +34,6 @@         const val EXTRA_FAVOURITE = "favourite"
         const val SOURCE_TYPE = "sourceType"
         const val SOURCE_TYPE_STOP = "stop"
         const val SOURCE_TYPE_FAV = "favourite"
-
-        const val MODE_WORKDAYS = 0
-        const val MODE_SATURDAYS = 1
-        const val MODE_SUNDAYS = 2
 
         const val TIMETABLE_TYPE_DEPARTURE = "timetable_type_departure"
         const val TIMETABLE_TYPE_FULL = "timetable_type_full"




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 ad39c572570f1a4b1113b164eac10e01b61bab31..53e6669764c27a98c3e6ec5500734ec1e31c68c7 100644
--- a/app/src/main/java/ml/adamsprogs/bimba/activities/StopSpecifyActivity.kt
+++ b/app/src/main/java/ml/adamsprogs/bimba/activities/StopSpecifyActivity.kt
@@ -1,18 +1,16 @@
 package ml.adamsprogs.bimba.activities
 
+import android.content.Context
 import android.content.Intent
-import androidx.appcompat.app.AppCompatActivity
 import android.os.Bundle
+import android.view.LayoutInflater
 import android.view.View
 import android.view.ViewGroup
-import kotlinx.android.synthetic.main.activity_stop_specify.*
-import ml.adamsprogs.bimba.R
-import android.content.Context
 import android.widget.TextView
-import androidx.recyclerview.widget.LinearLayoutManager
-import androidx.recyclerview.widget.RecyclerView
-import android.view.LayoutInflater
+import androidx.appcompat.app.AppCompatActivity
+import kotlinx.android.synthetic.main.activity_stop_specify.*
 import ml.adamsprogs.bimba.ProviderProxy
+import ml.adamsprogs.bimba.R
 
 class StopSpecifyActivity : AppCompatActivity() {
 




diff --git a/app/src/main/java/ml/adamsprogs/bimba/collections/FavouriteStorage.kt b/app/src/main/java/ml/adamsprogs/bimba/collections/FavouriteStorage.kt
index b7d96b89b3fd738796ade8db57b8539e794ba59e..38292650494637faefb6a23f1b8b6b6050752dbb 100644
--- a/app/src/main/java/ml/adamsprogs/bimba/collections/FavouriteStorage.kt
+++ b/app/src/main/java/ml/adamsprogs/bimba/collections/FavouriteStorage.kt
@@ -1,10 +1,20 @@
 package ml.adamsprogs.bimba.collections
 
-import android.content.*
+import android.content.Context
+import android.content.SharedPreferences
 import com.google.gson.*
-import ml.adamsprogs.bimba.*
-import ml.adamsprogs.bimba.models.*
+import ml.adamsprogs.bimba.models.Departure
+import ml.adamsprogs.bimba.models.Favourite
+import ml.adamsprogs.bimba.models.Plate
+import ml.adamsprogs.bimba.models.StopSegment
+import ml.adamsprogs.bimba.secondsAfterMidnight
 import java.util.Calendar
+import kotlin.collections.ArrayList
+import kotlin.collections.HashMap
+import kotlin.collections.HashSet
+import kotlin.collections.component1
+import kotlin.collections.component2
+import kotlin.collections.set
 
 
 class FavouriteStorage private constructor(context: Context) : Iterable<Favourite> {
@@ -31,13 +41,13 @@     init {
         val favouritesString = preferences.getString("favourites", "{}")
         JsonParser().parse(favouritesString).asJsonObject.entrySet().forEach { (name, timetables) ->
             timetables.asJsonArray.map {
-                val plates = it.asJsonObject["plates"].let {
-                    if (it == null || it.isJsonNull)
+                val plates = it.asJsonObject["plates"].let { element ->
+                    if (element == null || element.isJsonNull)
                         null
                     else {
-                        it.asJsonArray.map {
-                            it.asJsonObject.let {
-                                Plate.ID(it["line"].asString, it["stop"].asString, it["headsign"].asString)
+                        element.asJsonArray.map { it ->
+                            it.asJsonObject.let { id ->
+                                Plate.ID(id["line"].asString, id["stop"].asString, id["headsign"].asString)
                             }
                         }.toHashSet()
                     }
@@ -123,16 +133,16 @@         if (names.size < 2)
             return
 
         val newCache = HashMap<String, ArrayList<Departure>>()
-        names.forEach {
-            favourites[it]!!.fullTimetable().forEach {
+        names.forEach { name ->
+            favourites[name]!!.fullTimetable().forEach {
                 if (newCache[it.key] == null)
                     newCache[it.key] = ArrayList()
                 newCache[it.key]!!.addAll(it.value)
             }
         }
         val now = Calendar.getInstance().secondsAfterMidnight()
-        newCache.forEach {
-            it.value.sortBy { it.timeTill(now) }
+        newCache.forEach { entry ->
+            entry.value.sortBy { it.timeTill(now) }
         }
         val newFavourite = Favourite(names[0], HashSet(), newCache, context)
         for (name in names) {




diff --git a/app/src/main/java/ml/adamsprogs/bimba/datasources/TimetableDownloader.kt b/app/src/main/java/ml/adamsprogs/bimba/datasources/TimetableDownloader.kt
index 3bf5794808a0b9799c49c31f6aa4d77ca99f0b32..8eb2b34377ea9f1abf1093d2c3928a5cff204f9d 100644
--- a/app/src/main/java/ml/adamsprogs/bimba/datasources/TimetableDownloader.kt
+++ b/app/src/main/java/ml/adamsprogs/bimba/datasources/TimetableDownloader.kt
@@ -1,21 +1,29 @@
 package ml.adamsprogs.bimba.datasources
 
 import android.annotation.TargetApi
-import android.app.*
-import android.content.*
-import androidx.core.app.NotificationCompat
-import java.io.*
+import android.app.IntentService
+import android.app.Notification
+import android.app.NotificationManager
+import android.content.Context
+import android.content.Intent
 import android.os.Build
 import android.preference.PreferenceManager.getDefaultSharedPreferences
+import androidx.core.app.NotificationCompat
 import ml.adamsprogs.bimba.*
-import java.net.*
+import java.io.EOFException
+import java.io.File
+import java.io.FileOutputStream
+import java.io.IOException
+import java.net.ConnectException
+import java.net.HttpURLConnection
+import java.net.URL
 import java.util.zip.GZIPInputStream
-import javax.net.ssl.*
+import javax.net.ssl.HttpsURLConnection
+import javax.net.ssl.SSLException
 
 class TimetableDownloader : IntentService("TimetableDownloader") {
     companion object {
         const val ACTION_DOWNLOADED = "ml.adamsprogs.bimba.timetableDownloaded"
-        const val EXTRA_FORCE = "force"
         const val EXTRA_RESULT = "result"
         const val RESULT_NO_CONNECTIVITY = "no connectivity"
         const val RESULT_UP_TO_DATE = "up-to-date"




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 1d1822c12af3f1d0e49668514cbab09dbe1e2d5a..0eafd504f6eb3869d774306310a0e7e6b22c6330 100644
--- a/app/src/main/java/ml/adamsprogs/bimba/datasources/VmClient.kt
+++ b/app/src/main/java/ml/adamsprogs/bimba/datasources/VmClient.kt
@@ -1,12 +1,17 @@
 package ml.adamsprogs.bimba.datasources
 
-import com.google.gson.*
-import kotlinx.coroutines.*
+import com.google.gson.Gson
+import com.google.gson.JsonObject
+import com.google.gson.JsonSyntaxException
+import kotlinx.coroutines.Dispatchers
+import kotlinx.coroutines.withContext
 import ml.adamsprogs.bimba.NetworkStateReceiver
 import ml.adamsprogs.bimba.models.Plate
 import ml.adamsprogs.bimba.models.StopSegment
-import ml.adamsprogs.bimba.models.suggestions.*
-import okhttp3.*
+import ml.adamsprogs.bimba.models.suggestions.StopSuggestion
+import okhttp3.MediaType
+import okhttp3.OkHttpClient
+import okhttp3.RequestBody
 import java.io.IOException
 import java.util.*
 import kotlin.collections.HashMap
@@ -29,9 +34,9 @@         if (!response.has("success"))
             return emptyMap()
         val rootObject = response["success"].asJsonObject["bollards"].asJsonArray
         val result = HashMap<String, Set<String>>()
-        rootObject.forEach {
-            val code = it.asJsonObject["bollard"].asJsonObject["tag"].asString
-            result[code] = it.asJsonObject["directions"].asJsonArray.map {
+        rootObject.forEach { element ->
+            val code = element.asJsonObject["bollard"].asJsonObject["tag"].asString
+            result[code] = element.asJsonObject["directions"].asJsonArray.map {
                 """${it.asJsonObject["lineName"].asString} → ${it.asJsonObject["direction"].asString}"""
             }.toSet()
         }
@@ -71,7 +76,7 @@             val name = it["name"].asString
             names.add(name)
         }
 
-        return names.map { StopSuggestion(it, "", "") }
+        return names.map { StopSuggestion(it, "") }
     }
 
     suspend fun makeRequest(method: String, data: String): Pair<Int, JsonObject> {




diff --git a/app/src/main/java/ml/adamsprogs/bimba/datasources/VmService.kt b/app/src/main/java/ml/adamsprogs/bimba/datasources/VmService.kt
index a3ab71c0781a4c662f29ac9eb8cbc7e4fa218350..3d117be561411588acc1dd3864a7087648ac30f2 100644
--- a/app/src/main/java/ml/adamsprogs/bimba/datasources/VmService.kt
+++ b/app/src/main/java/ml/adamsprogs/bimba/datasources/VmService.kt
@@ -2,14 +2,18 @@ package ml.adamsprogs.bimba.datasources
 
 import android.app.Service
 import android.content.Intent
-import android.os.*
+import android.os.Handler
+import android.os.HandlerThread
+import android.os.IBinder
 import android.os.Process.THREAD_PRIORITY_BACKGROUND
 import com.google.gson.JsonObject
-import kotlinx.coroutines.*
-import kotlinx.coroutines.android.Main
+import kotlinx.coroutines.GlobalScope
+import kotlinx.coroutines.Runnable
+import kotlinx.coroutines.launch
 import ml.adamsprogs.bimba.NetworkStateReceiver
 import ml.adamsprogs.bimba.calendarFromIso
-import ml.adamsprogs.bimba.models.*
+import ml.adamsprogs.bimba.models.Departure
+import ml.adamsprogs.bimba.models.Plate
 import ml.adamsprogs.bimba.secondsAfterMidnight
 import java.util.*
 import kotlin.collections.*
@@ -22,7 +26,6 @@         const val EXTRA_PLATE_ID = "ml.adamsprogs.bimba.extra.vm.plate"
         const val EXTRA_STOP_CODE = "ml.adamsprogs.bimba.extra.vm.stop"
         const val EXTRA_CODE = "ml.adamsprogs.bimba.extra.vm.code"
         const val TICK_6_ZINA_TIM = 12500L
-        const val TICK_6_ZINA_TIM_WITH_MARGIN = TICK_6_ZINA_TIM * 3 / 4
     }
 
     private var handler: Handler? = null
@@ -31,10 +34,8 @@         override fun run() {
             handler!!.postDelayed(this, TICK_6_ZINA_TIM)
             try {
                 for (plateId in requests.keys)
-                    launch(Dispatchers.Main) {
-                        withContext(Dispatchers.Default) {
-                            downloadVM()
-                        }
+                    GlobalScope.launch {
+                        downloadVM()
                     }
             } catch (e: IllegalArgumentException) {
             }
@@ -63,10 +64,8 @@                 sendResult(stopCode)
             } else {
                 if (!once)
                     addRequest(stopCode)
-                launch(Dispatchers.Main) {
-                    withContext(Dispatchers.Default) {
-                        downloadVM(stopCode)
-                    }
+                GlobalScope.launch {
+                    downloadVM(stopCode)
                 }
             }
         } else if (action == "remove") {




diff --git a/app/src/main/java/ml/adamsprogs/bimba/extensions.kt b/app/src/main/java/ml/adamsprogs/bimba/extensions.kt
index 9bb77bafd9c840c8914e3e84d4f14fa4bd08a4ef..ec86bc5c93eca92d2228020a27517054304315a0 100644
--- a/app/src/main/java/ml/adamsprogs/bimba/extensions.kt
+++ b/app/src/main/java/ml/adamsprogs/bimba/extensions.kt
@@ -4,11 +4,12 @@ import android.annotation.SuppressLint
 import android.content.Context
 import android.graphics.drawable.Drawable
 import android.os.Build
-import com.google.android.material.snackbar.Snackbar
 import android.text.format.DateFormat
 import android.view.View
-import ml.adamsprogs.bimba.activities.StopActivity
-import java.io.*
+import com.google.android.material.snackbar.Snackbar
+import java.io.File
+import java.io.InputStream
+import java.io.OutputStream
 import java.text.SimpleDateFormat
 import java.util.*
 import kotlin.collections.ArrayList
@@ -59,28 +60,12 @@     calendar.time = date
     return calendar
 }
 
-fun getColour(id: Int, context: Context): Int {
-    @Suppress("DEPRECATION")
-    (return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M)
-        context.resources.getColor(id, null)
-    else
-        context.resources.getColor(id))
-}
-
 fun getDrawable(id: Int, context: Context): Drawable {
     @Suppress("DEPRECATION")
     (return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
         context.resources.getDrawable(id, null)
     else
         context.resources.getDrawable(id))
-}
-
-internal fun Calendar.getMode(): Int {
-    return when (this.get(Calendar.DAY_OF_WEEK)) {
-        Calendar.SUNDAY -> StopActivity.MODE_SUNDAYS
-        Calendar.SATURDAY -> StopActivity.MODE_SATURDAYS
-        else -> StopActivity.MODE_WORKDAYS
-    }
 }
 
 internal fun CharSequence.safeSplit(vararg delimiters: String, ignoreCase: Boolean = false, limit: Int = 0): List<String>? {




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 9661f529ba9bd5d83a822b47ec43e022c1daa537..4435b56a85f6bd29a43e3de7a3e1e832eb6b1b58 100644
--- a/app/src/main/java/ml/adamsprogs/bimba/models/Departure.kt
+++ b/app/src/main/java/ml/adamsprogs/bimba/models/Departure.kt
@@ -1,11 +1,6 @@
 package ml.adamsprogs.bimba.models
 
 import ml.adamsprogs.bimba.safeSplit
-import ml.adamsprogs.bimba.secondsAfterMidnight
-import java.io.Serializable
-import java.util.*
-import kotlin.collections.ArrayList
-import kotlin.collections.HashMap
 
 data class Departure(val line: String, val mode: List<Int>, val time: Int, val lowFloor: Boolean, //time in seconds since midnight
                      val modification: List<String>, val headsign: String, val vm: Boolean = false,
@@ -25,29 +20,6 @@         return Departure.fromString(this.toString())
     }
 
     companion object {
-        private fun filterDepartures(departures: List<Departure>, relativeTo: Int = Calendar.getInstance().secondsAfterMidnight()): Array<Serializable> {
-            val filtered = ArrayList<Departure>()
-            val lines = HashMap<String, Int>()
-            val sortedDepartures = departures.sortedBy { it.timeTill(relativeTo) }
-            for (departure in sortedDepartures) {
-                val timeTill = departure.timeTill(relativeTo)
-                var lineExistedTimes = lines[departure.line]
-                if (timeTill >= 0 && lineExistedTimes ?: 0 < 3) {
-                    lineExistedTimes = (lineExistedTimes ?: 0) + 1
-                    lines[departure.line] = lineExistedTimes
-                    filtered.add(departure)
-                }
-            }
-            return arrayOf(filtered, lines.all { it.value >= 3 })
-        }
-
-        /*fun createDepartures(stopCode: String): Map<String, List<Departure>> {
-            val timetable = Timetable.getTimetable()
-            val departures = timetable.getStopDepartures(stopCode)
-
-            return rollDepartures(departures)
-        }*/
-
         fun fromString(string: String): Departure {
             val array = string.split("|")
             if (array.size != 9)




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 ee3c5ab21c3d525f85f3e52b59ab83c33f560a88..5c7db919c7242c6f09154caa31b6706562f1bddc 100644
--- a/app/src/main/java/ml/adamsprogs/bimba/models/Favourite.kt
+++ b/app/src/main/java/ml/adamsprogs/bimba/models/Favourite.kt
@@ -1,8 +1,10 @@
 package ml.adamsprogs.bimba.models
 
-import android.content.*
-import android.os.*
-import ml.adamsprogs.bimba.*
+import android.content.Context
+import android.os.Parcel
+import android.os.Parcelable
+import ml.adamsprogs.bimba.ProviderProxy
+import ml.adamsprogs.bimba.safeSplit
 import java.io.File
 import java.math.BigInteger
 import java.security.SecureRandom
@@ -27,10 +29,10 @@
     private val providerProxy: ProviderProxy
 
     constructor(parcel: Parcel) {
-        this.name = parcel.readString()
+        this.name = parcel.readString()!!
         @Suppress("UNCHECKED_CAST")
         val set = HashSet<StopSegment>()
-        val array = parcel.readParcelableArray(StopSegment::class.java.classLoader)
+        val array = parcel.readParcelableArray(StopSegment::class.java.classLoader)!!
         array.forEach {
             set.add(it as StopSegment)
         }
@@ -121,7 +123,7 @@     fun nextDeparture() =
             if (cache.isEmpty())
                 null
             else
-                cache.flatMap { it.value }.let {
+                cache.flatMap { it.value }.let { it ->
                     if (it.isEmpty())
                         null
                     else




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 b3c50228730ad0aad928460bce6685a8500a04e3..363e7bb0640347a8ba1a3882954ead8ec6a670e4 100644
--- a/app/src/main/java/ml/adamsprogs/bimba/models/Timetable.kt
+++ b/app/src/main/java/ml/adamsprogs/bimba/models/Timetable.kt
@@ -2,15 +2,19 @@ package ml.adamsprogs.bimba.models
 
 import android.annotation.SuppressLint
 import android.content.Context
-import android.database.*
+import android.database.Cursor
+import android.database.CursorIndexOutOfBoundsException
 import android.database.sqlite.SQLiteDatabase
 import android.database.sqlite.SQLiteException
 import android.util.SparseArray
 import android.util.SparseBooleanArray
 import ml.adamsprogs.bimba.*
-import ml.adamsprogs.bimba.models.gtfs.*
-import ml.adamsprogs.bimba.models.suggestions.*
-import java.io.*
+import ml.adamsprogs.bimba.models.gtfs.Route
+import ml.adamsprogs.bimba.models.gtfs.Stop
+import ml.adamsprogs.bimba.models.gtfs.Trip
+import ml.adamsprogs.bimba.models.suggestions.LineSuggestion
+import ml.adamsprogs.bimba.models.suggestions.StopSuggestion
+import java.io.File
 import kotlin.collections.*
 import java.util.Calendar as JCalendar
 
@@ -89,7 +93,7 @@                 "C" -> "#${getColour(R.color.zoneC, context).toString(16)}"
                 else -> "#000000"
             }
             */
-            StopSuggestion(it.key, it.value, "#000000")
+            StopSuggestion(it.key, it.value)
         }.sorted()
         return _stops!!
     }
@@ -428,24 +432,9 @@             null
         }
     }
 
-    private fun getPlatesForStop(stop: String): Set<Plate.ID> {
-
-        val plates = HashSet<Plate.ID>()
-        val cursor = db!!.rawQuery("select route_id, trip_headsign " +
-                "from stop_times natural join trips natural join stops where stop_code = ? " +
-                "group by route_id, trip_headsign", arrayOf(stop))
-
-        while (cursor.moveToNext()) {
-            val routeId = cursor.getString(0)
-            val headsign = cursor.getString(1)
-            plates.add(Plate.ID(routeId, stop, headsign))
-        }
-
-        cursor.close()
-        return plates
-    }
-
     fun getTripGraphs(id: String): Array<TripGraph> {
+        TODO("Not implemented")
+        /*
         val graphs = arrayOf(TripGraph(), TripGraph())
 
         val cursor = db!!.rawQuery("select trip_id, trip_headsign, direction_id, stop_id, " +
@@ -495,7 +484,7 @@                 }
             }
         }
 
-        return graphs
+        return graphs*/
     }
 
     fun getServiceFirstDay(service: String): Int {




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 3df17b2df72930a706939bedaf2cd9ff5eef7d25..b24b3736b730449f795d3adfa9b994cf8428c67b 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
@@ -3,15 +3,14 @@
 import android.app.AlertDialog
 import android.content.Context
 import android.content.DialogInterface
-import androidx.core.content.res.ResourcesCompat
-import androidx.recyclerview.widget.RecyclerView
+import android.view.LayoutInflater
 import android.view.View
 import android.view.ViewGroup
 import android.widget.ImageView
 import android.widget.TextView
+import androidx.core.content.res.ResourcesCompat
+import ml.adamsprogs.bimba.Declinator
 import ml.adamsprogs.bimba.R
-import android.view.LayoutInflater
-import ml.adamsprogs.bimba.Declinator
 import ml.adamsprogs.bimba.models.Departure
 import ml.adamsprogs.bimba.rollTime
 import java.util.*




diff --git a/app/src/main/java/ml/adamsprogs/bimba/models/adapters/FavouriteEditRowAdapter.kt b/app/src/main/java/ml/adamsprogs/bimba/models/adapters/FavouriteEditRowAdapter.kt
index f05e1d7b9732d514b4aa216b52eefc89d8733e0d..c4e638efb519ce0f8f0d74a1f83adf615a1fb30f 100644
--- a/app/src/main/java/ml/adamsprogs/bimba/models/adapters/FavouriteEditRowAdapter.kt
+++ b/app/src/main/java/ml/adamsprogs/bimba/models/adapters/FavouriteEditRowAdapter.kt
@@ -1,21 +1,12 @@
 package ml.adamsprogs.bimba.models.adapters
 
-import androidx.recyclerview.widget.RecyclerView
-import android.view.LayoutInflater
-import android.view.View
-import android.view.ViewGroup
-import android.widget.ImageView
-import android.widget.TextView
-import kotlinx.coroutines.Dispatchers
+import android.view.*
+import android.widget.*
+import kotlinx.coroutines.*
 import kotlinx.coroutines.android.Main
-import kotlinx.coroutines.launch
-import kotlinx.coroutines.withContext
-import ml.adamsprogs.bimba.ProviderProxy
-import ml.adamsprogs.bimba.R
+import ml.adamsprogs.bimba.*
 import ml.adamsprogs.bimba.collections.FavouriteStorage
-import ml.adamsprogs.bimba.models.Favourite
-import ml.adamsprogs.bimba.models.Plate
-import ml.adamsprogs.bimba.models.StopSegment
+import ml.adamsprogs.bimba.models.*
 
 
 class FavouriteEditRowAdapter(private var favourite: Favourite, private val loadingView: View, private val listView: View) :
@@ -28,34 +19,32 @@     private val platesList = ArrayList()
     private val namesList = HashMap<Plate.ID, String>()
 
     init {
-        launch(Dispatchers.Main) {
-            withContext(Dispatchers.Default) {
-                favourite.segments.forEach {
-                    if (it.plates == null) {
-                        (providerProxy.fillStopSegment(it) ?: it).let { segment ->
-                            segments[segment.stop] = segment
-                            it.plates = segment.plates
-                        }
-                    } else {
-                        segments[it.stop] = it
+        GlobalScope.launch {
+            favourite.segments.forEach {
+                if (it.plates == null) {
+                    (providerProxy.fillStopSegment(it) ?: it).let { segment ->
+                        segments[segment.stop] = segment
+                        it.plates = segment.plates
                     }
+                } else {
+                    segments[it.stop] = it
                 }
-                favourites[favourite.name] = favourite
+            }
+            favourites[favourite.name] = favourite
 
-                segments.flatMap {
-                    it.value.plates ?: emptyList<Plate.ID>()
-                }.sortedBy { "${it.line}${it.stop}" }.forEach {
-                    platesList.add(it)
-                    namesList[it] = providerProxy.getStopName(it.stop).let { name ->
-                        "${name ?: ""} (${it.stop}):\n${it.line} → ${it.headsign}"
-                    }
-                }
-                launch(Dispatchers.Main) {
-                    loadingView.visibility = View.GONE
-                    listView.visibility = View.VISIBLE
-                    this@FavouriteEditRowAdapter.notifyDataSetChanged()
+            segments.flatMap {
+                it.value.plates ?: emptyList<Plate.ID>()
+            }.sortedBy { "${it.line}${it.stop}" }.forEach {
+                platesList.add(it)
+                namesList[it] = providerProxy.getStopName(it.stop).let { name ->
+                    "${name ?: ""} (${it.stop}):\n${it.line} → ${it.headsign}"
                 }
             }
+            launch(Dispatchers.Main) {
+                loadingView.visibility = View.GONE
+                listView.visibility = View.VISIBLE
+                this@FavouriteEditRowAdapter.notifyDataSetChanged()
+            }
         }
     }
 
@@ -63,19 +52,17 @@
     override fun getItemCount(): Int = platesList.size
 
     override fun onBindViewHolder(holder: ViewHolder, position: Int) {
-        launch(Dispatchers.Main) {
+        GlobalScope.launch {
             val id = platesList[position]
             val favouriteElement = namesList[id]
 
             holder.rowTextView.text = favouriteElement
             holder.deleteButton.setOnClickListener {
-                launch(Dispatchers.Main) {
-                    favourites.delete(favourite.name, id)
-                    favourite = favourites.favourites[favourite.name]!!
-                    notifyItemRemoved(platesList.indexOf(id))
-                    platesList.remove(id)
-                    namesList.remove(id)
-                }
+                favourites.delete(favourite.name, id)
+                favourite = favourites.favourites[favourite.name]!!
+                notifyItemRemoved(platesList.indexOf(id))
+                platesList.remove(id)
+                namesList.remove(id)
             }
         }
     }




diff --git a/app/src/main/java/ml/adamsprogs/bimba/models/adapters/FavouritesAdapter.kt b/app/src/main/java/ml/adamsprogs/bimba/models/adapters/FavouritesAdapter.kt
index 4a7a1fc89a0ddb60f22a037790d2959b15966329..0f97754e7e1a7a65ef5703f4beaa434fbac3163c 100644
--- a/app/src/main/java/ml/adamsprogs/bimba/models/adapters/FavouritesAdapter.kt
+++ b/app/src/main/java/ml/adamsprogs/bimba/models/adapters/FavouritesAdapter.kt
@@ -1,21 +1,25 @@
 package ml.adamsprogs.bimba.models.adapters
 
 import android.content.Context
-import androidx.core.content.res.ResourcesCompat
-import androidx.appcompat.widget.*
-import androidx.appcompat.widget.PopupMenu
 import android.util.SparseBooleanArray
-import android.view.*
-import android.widget.*
-import ml.adamsprogs.bimba.R
 import android.view.LayoutInflater
-import kotlinx.coroutines.*
+import android.view.View
+import android.view.ViewGroup
+import android.widget.ImageView
+import android.widget.TextView
+import androidx.appcompat.widget.PopupMenu
+import androidx.core.content.res.ResourcesCompat
+import kotlinx.coroutines.Dispatchers
+import kotlinx.coroutines.GlobalScope
 import kotlinx.coroutines.android.Main
-import java.util.*
+import kotlinx.coroutines.launch
+import kotlinx.coroutines.withContext
 import ml.adamsprogs.bimba.Declinator
+import ml.adamsprogs.bimba.R
 import ml.adamsprogs.bimba.collections.FavouriteStorage
 import ml.adamsprogs.bimba.models.Favourite
 import ml.adamsprogs.bimba.secondsAfterMidnight
+import java.util.*
 
 
 class FavouritesAdapter(private val appContext: Context, var favourites: FavouriteStorage,
@@ -52,7 +56,7 @@
     override fun getItemCount() = favourites.size
 
     override fun onBindViewHolder(holder: ViewHolder, position: Int) {
-        launch(Dispatchers.Main) {
+        GlobalScope.launch(Dispatchers.Main) /*Main on all?*/ {
             val favourite = favourites[position]!!
             holder.nameTextView.text = favourite.name
 




diff --git a/app/src/main/java/ml/adamsprogs/bimba/models/suggestions/StopSuggestion.kt b/app/src/main/java/ml/adamsprogs/bimba/models/suggestions/StopSuggestion.kt
index cd3c4c7c57cda7ec6e1b6ab88a3d1ad6463fce3b..708daa18b82fe5d4eb5d9b3b9cefd743d7852fb7 100644
--- a/app/src/main/java/ml/adamsprogs/bimba/models/suggestions/StopSuggestion.kt
+++ b/app/src/main/java/ml/adamsprogs/bimba/models/suggestions/StopSuggestion.kt
@@ -2,7 +2,7 @@ package ml.adamsprogs.bimba.models.suggestions
 
 import ml.adamsprogs.bimba.R
 
-class StopSuggestion(name: String, val zone: String, private val zoneColour: String) : GtfsSuggestion(name) {
+class StopSuggestion(name: String, val zone: String) : GtfsSuggestion(name) {
 
     override fun getBody(): String {
         return name
@@ -17,7 +17,7 @@         return 0xffffff
     }
 
     override fun getBgColour(): Int {
-        return "ffffff".toInt(16)
+        return 0x000000
     }
 
     override fun compareTo(other: GtfsSuggestion): Int {




diff --git a/app/src/main/res/drawable/ic_help.xml b/app/src/main/res/drawable/ic_help.xml
deleted file mode 100644
index cd2b22d47887f6e146f303f750296cd7bee4c7f6..0000000000000000000000000000000000000000
--- a/app/src/main/res/drawable/ic_help.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
-        android:width="24dp"
-        android:height="24dp"
-        android:viewportWidth="24.0"
-        android:viewportHeight="24.0">
-    <path
-        android:fillColor="@color/textDark"
-        android:pathData="M11,18h2v-2h-2v2zM12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.41,0 -8,-3.59 -8,-8s3.59,-8 8,-8 8,3.59 8,8 -3.59,8 -8,8zM12,6c-2.21,0 -4,1.79 -4,4h2c0,-1.1 0.9,-2 2,-2s2,0.9 2,2c0,2 -3,1.75 -3,5h2c0,-2.25 3,-2.5 3,-5 0,-2.21 -1.79,-4 -4,-4z"/>
-</vector>




diff --git a/app/src/main/res/drawable/ic_home.xml b/app/src/main/res/drawable/ic_home.xml
deleted file mode 100644
index 9f17a8e8f3cef70da0b6573df691ffd762a6e78a..0000000000000000000000000000000000000000
--- a/app/src/main/res/drawable/ic_home.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
-        android:width="24dp"
-        android:height="24dp"
-        android:viewportWidth="24.0"
-        android:viewportHeight="24.0">
-    <path
-        android:fillColor="@color/textDark"
-        android:pathData="M10,20v-6h4v6h5v-8h3L12,3 2,12h3v8z"/>
-</vector>




diff --git a/app/src/main/res/drawable/ic_skip.xml b/app/src/main/res/drawable/ic_skip.xml
deleted file mode 100644
index 5248d32c9cdb23b266a221cb87153c4569215b06..0000000000000000000000000000000000000000
--- a/app/src/main/res/drawable/ic_skip.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-<vector android:autoMirrored="true" android:height="24dp"
-    android:viewportHeight="24.0" android:viewportWidth="24.0"
-    android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
-    <path android:fillColor="#FF000000" android:pathData="M10.09,15.59L11.5,17l5,-5 -5,-5 -1.41,1.41L12.67,11H3v2h9.67l-2.58,2.59zM19,3H5c-1.11,0 -2,0.9 -2,2v4h2V5h14v14H5v-4H3v4c0,1.1 0.89,2 2,2h14c1.1,0 2,-0.9 2,-2V5c0,-1.1 -0.9,-2 -2,-2z"/>
-</vector>




diff --git a/app/src/main/res/drawable/ic_split.xml b/app/src/main/res/drawable/ic_split.xml
deleted file mode 100644
index da15e8544ea4430fa1acbd866fb7470f5337d936..0000000000000000000000000000000000000000
--- a/app/src/main/res/drawable/ic_split.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
-        android:width="24dp"
-        android:height="24dp"
-        android:viewportWidth="24.0"
-        android:viewportHeight="24.0">
-    <path
-        android:fillColor="@color/textDark"
-        android:pathData="M14,4l2.29,2.29 -2.88,2.88 1.42,1.42 2.88,-2.88L20,10L20,4zM10,4L4,4v6l2.29,-2.29 4.71,4.7L11,20h2v-8.41l-5.29,-5.3z"/>
-</vector>




diff --git a/app/src/main/res/drawable/icon_dev.xml b/app/src/main/res/drawable/icon_dev.xml
deleted file mode 100644
index a4b238053d6fdefaa6c74cfe50a206f56b769aff..0000000000000000000000000000000000000000
--- a/app/src/main/res/drawable/icon_dev.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<vector android:height="24dp" android:viewportHeight="293"
-    android:viewportWidth="298" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
-    <path android:fillAlpha="1" android:fillColor="#5E5E5E"
-        android:pathData="m62.925,292.677v0c-3.69,-0.897 -5.684,-3.789 -4.288,-6.482L90.846,223.472c1.296,-2.593 5.485,-3.989 9.174,-2.992v0c3.69,0.897 5.684,3.789 4.288,6.482l-32.209,62.723c-1.296,2.593 -5.385,3.989 -9.174,2.992z" android:strokeWidth="0.99718279"/>
-    <path android:fillAlpha="1" android:fillColor="#5E5E5E"
-        android:pathData="m229.156,292.677v0c3.69,-0.897 5.684,-3.789 4.288,-6.482l-32.209,-62.723c-1.296,-2.593 -5.485,-3.989 -9.174,-2.992v0c-3.69,0.897 -5.684,3.789 -4.288,6.482l32.209,62.723c1.296,2.593 5.485,3.989 9.174,2.992z" android:strokeWidth="0.99718279"/>
-    <path android:fillAlpha="1" android:fillColor="#5E5E5E"
-        android:pathData="m151.076,37.797 l-0.598,0.199c-1.795,0.698 -3.789,-0.299 -4.487,-2.094L136.418,9.277c-0.698,-1.795 0.299,-3.789 2.094,-4.487l0.598,-0.199c1.795,-0.698 3.789,0.299 4.487,2.094l9.573,26.625c0.698,1.895 -0.299,3.889 -2.094,4.487z" android:strokeWidth="0.99718279"/>
-    <path android:fillAlpha="1" android:fillColor="#5E5E5E"
-        android:pathData="m180.294,4.79v0c0,2.094 -1.695,3.789 -3.789,3.789h-60.828c-2.094,0 -3.789,-1.695 -3.789,-3.789v0c0,-2.094 1.695,-3.789 3.789,-3.789h60.828c2.094,0 3.789,1.695 3.789,3.789z" android:strokeWidth="0.99718279"/>
-    <path android:fillAlpha="1" android:fillColor="#5E5E5E"
-        android:pathData="M218.286,237.034H73.795c-13.263,0 -23.932,-10.77 -23.932,-23.932V105.406c0,-41.184 33.406,-74.689 74.689,-74.689h43.178c41.184,0 74.689,33.406 74.689,74.689v107.696c-0.1,13.163 -10.869,23.932 -24.132,23.932z" android:strokeWidth="0.99718279"/>
-    <path android:fillColor="#FFFFFF" android:pathData="M212.104,146.789L79.977,146.789c-5.584,0 -10.171,-4.487 -10.171,-10.171l0,-34.802c0,-16.852 13.661,-30.514 30.514,-30.514L191.761,71.302c16.852,0 30.514,13.661 30.514,30.514l0,34.802c-0.1,5.684 -4.587,10.171 -10.171,10.171z"/>
-    <path android:fillColor="#FFFFFF" android:pathData="M161.148,56.344L130.933,56.344c-3.191,0 -5.684,-2.593 -5.684,-5.684l0,0c0,-3.191 2.593,-5.684 5.684,-5.684l30.215,0c3.191,0 5.684,2.593 5.684,5.684l0,0c0,3.091 -2.593,5.684 -5.684,5.684z"/>
-    <path android:fillColor="#FFFFFF" android:pathData="M86.957,192.36m-14.758,0a14.758,14.758 0,1 1,29.517 0a14.758,14.758 0,1 1,-29.517 0"/>
-    <path android:fillColor="#FFFFFF" android:pathData="M205.223,192.36m-14.758,0a14.758,14.758 0,1 1,29.517 0a14.758,14.758 0,1 1,-29.517 0"/>
-</vector>




diff --git a/app/src/main/res/drawable/nodb.xml b/app/src/main/res/drawable/nodb.xml
deleted file mode 100644
index 1fee6a8f9864a21b9ed0400fa435fe5adb58e7d4..0000000000000000000000000000000000000000
--- a/app/src/main/res/drawable/nodb.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
-        android:width="1080dp"
-        android:height="1920dp"
-        android:viewportWidth="285.75"
-        android:viewportHeight="508.0">
-    <path
-        android:pathData="M0,0h285.75v508h-285.75z"
-        android:fillAlpha="1"
-        android:strokeColor="#00000000"
-        android:fillColor="#e0e0e0"
-        android:strokeWidth="2.96499991"
-        android:strokeAlpha="1"/>
-    <path
-        android:pathData="M136.13,341.19h13.49v166.81h-13.49z"
-        android:fillAlpha="1"
-        android:strokeColor="#00000000"
-        android:fillColor="#aaaaaa"
-        android:strokeWidth="5.5416379"
-        android:strokeAlpha="1"/>
-    <path
-        android:pathData="M142.88,301.08m-42.33,0a42.33,42.33 69.77,1 1,84.67 0a42.33,42.33 69.77,1 1,-84.67 0"
-        android:strokeColor="#00000000"
-        android:fillColor="#0e518d"/>
-    <path
-        android:pathData="m131.65,282.69 l-10.98,7.52 9.06,6.2L113.25,296.41l0.3,1.93L111.83,304.94l0,8.44l5.23,0l0.45,-2.03l17.69,0l0.45,2.03l14.43,0l0.45,-2.03l17.69,0l0.45,2.03L173.92,313.38L173.92,304.94l-1.73,-6.61 0.31,-1.93L133.57,296.41l9.05,-6.2zM131.65,284.42 L140.09,290.2l0,0.02l-8.44,5.79 -8.44,-5.79l0,-0.02zM114.62,298.33L119.3,298.33L119.3,304.94L112.9,304.94ZM120.52,298.33L128.45,298.33L128.45,304.94L120.52,304.94ZM129.67,298.33l7.93,0l0,6.61l-7.93,0zM138.81,298.33l8.13,0L146.94,304.94L138.81,304.94ZM148.16,298.33l7.93,0l0,6.61l-7.93,0zM157.31,298.33l7.93,0l0,6.61l-7.93,0zM166.45,298.33l4.67,0l1.72,6.61L166.45,304.94ZM119.14,312.66l0,0.69c0,1.51 1.22,2.74 2.74,2.74 1.21,0 2.25,-0.79 2.6,-1.89l3.82,0c0.36,1.1 1.39,1.89 2.6,1.89 1.51,0 2.74,-1.22 2.74,-2.74l-0.01,-0.69L119.14,312.66ZM152.12,312.66 L152.11,313.36c0,1.51 1.22,2.74 2.74,2.74 1.21,0 2.25,-0.79 2.6,-1.89l3.82,0c0.36,1.1 1.39,1.89 2.6,1.89 1.51,0 2.74,-1.22 2.74,-2.74l0,-0.69l-14.49,0z"
-        android:strokeColor="#00000000"
-        android:fillColor="#ffffff"/>
-    <path
-        android:pathData="M142.88,301.08m-40.06,0a40.06,40.06 59.4,1 1,80.12 0a40.06,40.06 82.72,1 1,-80.12 0"
-        android:strokeColor="#f7fbf5"
-        android:fillColor="#00000000"
-        android:strokeWidth="6.73600006"/>
-</vector>




diff --git a/app/src/main/res/layout/activity_dash.xml b/app/src/main/res/layout/activity_dash.xml
index a85c89ba8d5384563c3efc2eb8235cf69d24032d..1760b734fe8a68f0e0c90f38a893d1fc14ab12e7 100644
--- a/app/src/main/res/layout/activity_dash.xml
+++ b/app/src/main/res/layout/activity_dash.xml
@@ -1,7 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <androidx.drawerlayout.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:app="http://schemas.android.com/apk/res-auto"
-    xmlns:tools="http://schemas.android.com/tools"
     android:id="@+id/drawer_layout"
     android:layout_width="match_parent"
     android:layout_height="match_parent">
@@ -41,6 +40,7 @@             app:layout_constraintEnd_toEndOf="parent"
             app:layout_constraintStart_toStartOf="parent"
             app:layout_constraintTop_toBottomOf="@+id/search_view" />
 
+        <!-- todo maxCount? -->
         <com.mancj.materialsearchbar.MaterialSearchBar
             android:id="@+id/search_view"
             style="@style/SearchBarTheme"




diff --git a/app/src/main/res/layout/activity_edit_favourite.xml b/app/src/main/res/layout/activity_edit_favourite.xml
index 713605a33d99df501ec14b890f20aa12288c7968..0fecff28a7bc950d101cefc5544d96a09a7652db 100644
--- a/app/src/main/res/layout/activity_edit_favourite.xml
+++ b/app/src/main/res/layout/activity_edit_favourite.xml
@@ -39,14 +39,16 @@              android:id="@+id/favourite_name_edit"
         android:layout_width="0dp"
         android:layout_height="wrap_content"
-        android:layout_marginEnd="8dp"
         android:layout_marginStart="8dp"
+        android:layout_marginEnd="8dp"
         android:ems="10"
+        android:importantForAutofill="no"
         android:inputType="text"
         android:text=""
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintStart_toStartOf="parent"
-        app:layout_constraintTop_toBottomOf="@+id/name_label" />
+        app:layout_constraintTop_toBottomOf="@+id/name_label"
+        tools:ignore="UnusedAttribute" />
 
     <androidx.recyclerview.widget.RecyclerView
         android:id="@+id/favourite_edit_list"




diff --git a/app/src/main/res/layout/activity_help.xml b/app/src/main/res/layout/activity_help.xml
deleted file mode 100644
index be113c8e5cd76911022673771525f27e71409633..0000000000000000000000000000000000000000
--- a/app/src/main/res/layout/activity_help.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:app="http://schemas.android.com/apk/res-auto"
-    xmlns:tools="http://schemas.android.com/tools"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:fitsSystemWindows="true"
-    tools:context="ml.adamsprogs.bimba.activities.HelpActivity">
-
-    <com.google.android.material.appbar.AppBarLayout
-        android:id="@+id/app_bar"
-        android:layout_width="match_parent"
-        android:layout_height="@dimen/app_bar_height"
-        android:fitsSystemWindows="true"
-        android:theme="@style/AppTheme.AppBarOverlay">
-
-        <com.google.android.material.appbar.CollapsingToolbarLayout
-            android:id="@+id/toolbar_layout"
-            android:layout_width="match_parent"
-            android:layout_height="match_parent"
-            android:fitsSystemWindows="true"
-            app:contentScrim="?attr/colorPrimary"
-            app:layout_scrollFlags="scroll|exitUntilCollapsed"
-            app:toolbarId="@+id/toolbar">
-
-            <androidx.appcompat.widget.Toolbar
-                android:id="@+id/toolbar"
-                android:layout_width="match_parent"
-                android:layout_height="?attr/actionBarSize"
-                app:layout_collapseMode="pin"
-                app:popupTheme="@style/AppTheme.PopupOverlay" />
-
-        </com.google.android.material.appbar.CollapsingToolbarLayout>
-    </com.google.android.material.appbar.AppBarLayout>
-
-    <include layout="@layout/content_help" />
-
-</androidx.coordinatorlayout.widget.CoordinatorLayout>




diff --git a/app/src/main/res/layout/activity_nodb.xml b/app/src/main/res/layout/activity_nodb.xml
deleted file mode 100644
index 1d1bde436e83ef413228d55a44d43a295384811d..0000000000000000000000000000000000000000
--- a/app/src/main/res/layout/activity_nodb.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:app="http://schemas.android.com/apk/res-auto"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent">
-
-    <ImageView
-        android:layout_width="match_parent"
-        android:layout_height="match_parent"
-        android:contentDescription="@string/no_database_background"
-        android:scaleType="centerCrop"
-        app:srcCompat="@drawable/nodb" />
-
-    <androidx.constraintlayout.widget.ConstraintLayout
-        android:layout_width="match_parent"
-        android:layout_height="match_parent"
-        android:orientation="vertical">
-
-        <TextView
-            android:id="@+id/no_db_caption"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_marginBottom="8dp"
-            android:layout_marginEnd="8dp"
-            android:layout_marginStart="8dp"
-            android:layout_marginTop="8dp"
-            android:text=""
-            android:textAlignment="center"
-            android:textAppearance="@style/TextAppearance.AppCompat.Headline"
-            android:textColor="@color/colorPrimary"
-            app:layout_constraintBottom_toBottomOf="parent"
-            app:layout_constraintEnd_toEndOf="parent"
-            app:layout_constraintStart_toStartOf="parent"
-            app:layout_constraintTop_toTopOf="parent"
-            app:layout_constraintVertical_bias="0.4" />
-
-        <com.google.android.material.floatingactionbutton.FloatingActionButton
-            android:id="@+id/skip_button"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_marginBottom="16dp"
-            android:layout_marginEnd="16dp"
-            android:clickable="true"
-            android:focusable="true"
-            app:fabSize="normal"
-            app:layout_constraintBottom_toBottomOf="parent"
-            app:layout_constraintEnd_toEndOf="parent"
-            app:srcCompat="@drawable/ic_skip" />
-
-    </androidx.constraintlayout.widget.ConstraintLayout>
-</FrameLayout>




diff --git a/app/src/main/res/layout/content_help.xml b/app/src/main/res/layout/content_help.xml
deleted file mode 100644
index 1897220231b033baeadc95adfc4b902b743e9211..0000000000000000000000000000000000000000
--- a/app/src/main/res/layout/content_help.xml
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:app="http://schemas.android.com/apk/res-auto"
-    xmlns:tools="http://schemas.android.com/tools"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    app:layout_behavior="@string/appbar_scrolling_view_behavior"
-    tools:context="ml.adamsprogs.bimba.activities.HelpActivity"
-    tools:showIn="@layout/activity_help">
-
-    <TextView
-        android:id="@+id/help_text"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:background="@android:color/transparent"
-        android:text="@string/help_text"
-        android:layout_margin="@dimen/text_margin"/>
-</androidx.core.widget.NestedScrollView>




diff --git a/app/src/main/res/layout/row_favourite_edit.xml b/app/src/main/res/layout/row_favourite_edit.xml
index 02a2c6fab85451e9d5383c26b9b69a9e1fbe03e7..18e99b529d051bc5490f8f6826e8e9acbbdd8568 100644
--- a/app/src/main/res/layout/row_favourite_edit.xml
+++ b/app/src/main/res/layout/row_favourite_edit.xml
@@ -1,7 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:app="http://schemas.android.com/apk/res-auto"
-    xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:orientation="vertical">
@@ -11,10 +10,10 @@              android:id="@+id/favourite_edit_row"
         android:layout_width="0dp"
         android:layout_height="wrap_content"
-        android:layout_marginBottom="16dp"
-        android:layout_marginEnd="16dp"
         android:layout_marginStart="16dp"
         android:layout_marginTop="16dp"
+        android:layout_marginEnd="16dp"
+        android:layout_marginBottom="16dp"
         android:text=""
         android:textAlignment="viewStart"
         android:textAppearance="@style/TextAppearance.AppCompat"
@@ -27,27 +26,13 @@              android:id="@+id/favourite_edit_delete"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
-        android:layout_marginBottom="16dp"
+        android:layout_marginTop="16dp"
         android:layout_marginEnd="8dp"
-        android:layout_marginTop="16dp"
+        android:layout_marginBottom="16dp"
         android:contentDescription="@string/favourite_element_delete_button"
         app:layout_constraintBottom_toBottomOf="parent"
         app:layout_constraintEnd_toEndOf="parent"
         app:layout_constraintTop_toTopOf="parent"
         app:srcCompat="@drawable/ic_delete" />
 
-    <!--<ImageView-->
-        <!--android:id="@+id/favourite_edit_split"-->
-        <!--android:layout_width="wrap_content"-->
-        <!--android:layout_height="wrap_content"-->
-        <!--android:layout_marginBottom="16dp"-->
-        <!--android:layout_marginEnd="58dp"-->
-        <!--android:layout_marginTop="16dp"-->
-        <!--app:layout_constraintBottom_toBottomOf="parent"-->
-        <!--app:layout_constraintEnd_toEndOf="parent"-->
-        <!--app:layout_constraintTop_toTopOf="parent"-->
-        <!--app:srcCompat="@drawable/ic_split"-->
-        <!--tools:layout_editor_absoluteX="302dp"-->
-        <!--tools:layout_editor_absoluteY="16dp"-->
-        <!--android:contentDescription="@string/favourite_element_split_button" />-->
 </androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file




diff --git a/app/src/main/res/menu/menu_drawer.xml b/app/src/main/res/menu/menu_drawer.xml
index 3dbf30fa996dbd94345b8d176a0f110b1729033c..97188f56a4a54264e7c38e98989bbe959d299c4e 100644
--- a/app/src/main/res/menu/menu_drawer.xml
+++ b/app/src/main/res/menu/menu_drawer.xml
@@ -6,7 +6,7 @@             android:id="@+id/drawer_home"
             android:icon="@drawable/ic_home"
             android:title="@string/home" />
     </group>-->
-    <group android:id="@+id/drawer_group_actions">
+    <group>
         <item
             android:id="@+id/drawer_refresh"
             android:icon="@drawable/ic_refresh"
@@ -21,9 +21,7 @@             android:icon="@drawable/ic_settings"
             android:title="@string/settings"
             />
     </group>
-    <group
-        android:id="@+id/drawer_group_validity"
-        android:enabled="false">
+    <group android:enabled="false">
         <item
             android:id="@+id/drawer_validity_since"
             android:title="" />




diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml
index 413363283deb54ced9c0ddbf0c5248dddcc402cc..ec1caea01009c2af74cdebb9c29f276da6b06c8d 100644
--- a/app/src/main/res/values/colors.xml
+++ b/app/src/main/res/values/colors.xml
@@ -15,5 +15,4 @@     #c4212a
     <color name="text_on_toolbar">#ffffff</color>
 
     <color name="textDark">#141415</color>
-    <color name="textLight">#ffffff</color>
 </resources>




diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml
index 79d1b762f2b41389057499b42141852197f2ef0f..d1cd0246f80ac882c028743baba512892ebf7262 100644
--- a/app/src/main/res/values/dimens.xml
+++ b/app/src/main/res/values/dimens.xml
@@ -1,9 +1,6 @@
 <resources>
-    <!-- Default screen margins, per the Android Design guidelines. -->
     <dimen name="activity_horizontal_margin">16dp</dimen>
     <dimen name="activity_vertical_margin">16dp</dimen>
     <dimen name="fab_margin">16dp</dimen>
     <dimen name="appbar_padding_top">8dp</dimen>
-    <dimen name="app_bar_height">180dp</dimen>
-    <dimen name="text_margin">16dp</dimen>
 </resources>




diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index ebccb8676c3f063a9db025b7aa91f8440dee7bb5..3d11bdcb2e8d2cba4cde3ca44df9e807a5b439e7 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -1,19 +1,12 @@
 <resources>
     <string name="app_name" translatable="false">Bimba</string>
-    <string name="no_timetable">No timetable found. Connect to the Internet and wait for a timetable to be downloaded</string>
     <string name="timetable_downloaded">New timetable downloaded</string>
     <string name="title_activity_stop" translatable="false">StopActivity</string>
-    <string name="tab_workday_text">Workdays</string>
-    <string name="tab_saturday_text">Saturdays</string>
-    <string name="tab_sunday_text">Sundays</string>
     <string name="action_change_type">Type</string>
     <string name="departure_type_icon_description" translatable="false">departure type (timetable, VM)</string>
     <string name="departure_to">→ %1$s</string>
     <string name="departure_to_line">%1$s → %2$s</string>
     <string name="departure_at">At %1$s</string>
-    <string name="no_database_background" translatable="false">no database background</string>
-    <string name="no_db_connect">Connect to the Internet to download the timetable</string>
-    <string name="no_db_downloading">Timetable is being downloaded…</string>
     <string name="timetable_downloading">Downloading timetable</string>
     <string name="timetable_downloading_progress" translatable="false">%1$1.2f MiB/%2$1.2f MiB</string>
     <string name="timetable_decompressing">Decompressing timetable</string>
@@ -21,19 +14,15 @@     Stop…
     <string name="no_connectivity_cant_update">No connectivity – can’t update timetable</string>
     <string name="no_connectivity">No connectivity</string>
     <string name="timetable_up_to_date">Timetable is up-to-date</string>
-    <string name="validity_failed">Downloaded timetable is corrupted – can’t update</string>
     <string name="error_try_later">Error. Try again later</string>
     <string name="now">Now</string>
     <string name="stop_already_fav">This stop is already in favourites</string>
     <string name="favourite_row_more_button" translatable="false">favourite row more button</string>
     <string name="action_edit">Edit</string>
     <string name="action_delete">Delete</string>
-    <string name="done">Done</string>
-    <string name="favourite_edit">Edit favourite</string>
     <string name="favourite_name">Favourite name</string>
     <string name="edit_favourite_title">Edit ‘%1$s’</string>
     <string name="favourite_element_delete_button" translatable="false">favourite element delete button</string>
-    <string name="favourite_element_split_button" translatable="false">favourite element split button</string>
     <string name="no_next_departure">No next departure</string>
     <string name="action_merge">Merge</string>
     <string name="merge_favourites">Merge favourites</string>
@@ -42,28 +31,14 @@     In %1$s minute
     <string name="departure_in__plural_genitive">In %1$s minutes</string>
     <string name="departure_in__plural_nominative">In %1$s minutes</string>
 
-    <string name="home">Home</string>
     <string name="refresh">Update timetable</string>
-    <string name="help">Help</string>
-    <string name="navigation_drawer_home_button" translatable="false">navigation drawer home button</string>
-    <string name="navigation_drawer_refresh_button" translatable="false">navigation drawer refresh button</string>
-    <string name="navigation_drawer_help_button" translatable="false">navigation drawer help button</string>
     <string name="title_activity_help">Help</string>
-    <string name="help_text">
-        "Why a favourite card shows ‘No next departure’?\n\n"
-
-        "Favourite cards contain times for today and tomorrow."
-        "‘No next departure’ may happen when, e.g. there is no timetable for tomorrow and there"
-        "are no more departures today.\n\n"
-    </string>
     <string name="departure_row_getting_departures">Getting departures…</string>
     <string name="valid_since">Valid since %1$s</string>
     <string name="valid_till">Valid till %1$s</string>
     <string name="departure_floor" translatable="false">departure floor type (lowFloor)</string>
     <string name="departure_info" translatable="false">departure info icon</string>
-    <string name="refreshing_cache">Refreshing cache. May take some time…</string>
 
-    <string name="today">Today</string>
     <string name="no_departures">No departures</string>
     <string name="title_activity_main" translatable="false">LineSpecifyActivity</string>
     <string name="tab_text_line_to">To</string>




diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml
index 6d69eba5bfa47ba8533df940f075bbf037a47384..321823a1de36e036af6fc66617b149638df0ba60 100644
--- a/app/src/main/res/values/styles.xml
+++ b/app/src/main/res/values/styles.xml
@@ -7,12 +7,6 @@         @color/colorPrimaryDark
         <item name="colorAccent">@color/colorAccent</item>
     </style>
 
-    <style name="AppTheme.ActionBar" parent="Theme.AppCompat.DayNight">
-        <item name="colorPrimary">@color/colorPrimary</item>
-        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
-        <item name="colorAccent">@color/colorAccent</item>
-    </style>
-
     <style name="SplashTheme" parent="Theme.AppCompat.DayNight.NoActionBar">
         <item name="colorPrimary">@color/colorPrimary</item>
         <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
@@ -22,10 +16,6 @@
     <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
 
     <style name="AppTheme.PopupOverlay" parent="ThemeOverlay.AppCompat.Light" />
-
-    <style name="DividerTheme">
-        <item name="android:background">?android:attr/dividerVertical</item>
-    </style>
 
     <style name="SearchBarTheme" parent="MaterialSearchBarLight">
         <item name="mt_navIconTint">@color/textDark</item>




diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml
index 094229af232761e69b00552d2a3022dca6161e84..2aa35f26cd77104f979d8f986dd4469b12d46160 100644
--- a/app/src/main/res/values-de/strings.xml
+++ b/app/src/main/res/values-de/strings.xml
@@ -7,48 +7,28 @@     In %1$s Minute
     <string name="departure_in__plural_genitive">In %1$s Minuten</string>
     <string name="departure_in__plural_nominative">In %1$s Minuten</string>
 
-    <string name="no_timetable">Kein Fahrplan gefunden. Verbind mit dem Internet und warte bis ein Fahrplan heruntergeladen wurde</string>
     <string name="timetable_downloaded">Neuer Fahrplan heruntergeladen</string>
-    <string name="tab_workday_text">Arbeitstage</string>
-    <string name="tab_saturday_text">Samstags</string>
-    <string name="tab_sunday_text">Sonntags</string>
     <string name="action_change_type">Typ</string>
-    <string name="no_db_connect">Verbind mit dem Internet, um den Fahrplan herunterzuladen</string>
-    <string name="no_db_downloading">Fahrplan wird heruntergeladen…</string>
     <string name="timetable_downloading">Fahrplan wird heruntergeladen</string>
     <string name="search_placeholder">Haltestelle…</string>
     <string name="no_connectivity_cant_update">Kein Verbindung – kann nicht den Fahrplan aktualisieren</string>
     <string name="no_connectivity">Kein Verbindung</string>
     <string name="timetable_up_to_date">Fahrplan ist aktuell</string>
-    <string name="validity_failed">Der heruntergeladene Fahrplan ist geschädigt – kann nicht aktualisieren</string>
     <string name="error_try_later">Fehler. Versuch später noch einmal</string>
     <string name="stop_already_fav">Diese Haltestelle ist bereits eine Lieblingshaltestelle</string>
     <string name="action_edit">Bearbeiten</string>
     <string name="action_delete">Löschen</string>
-    <string name="done">Fertig</string>
-    <string name="favourite_edit">Lieblingshaltestelle bearbeiten</string>
     <string name="favourite_name">Lieblingshaltestelles Name</string>
     <string name="edit_favourite_title">„%1$s“ bearbeiten</string>
     <string name="no_next_departure">Keine nächste Abfahrt</string>
     <string name="action_merge">Zusammenfügen</string>
     <string name="merge_favourites">Lieblingshaltestellen zusammenfügen</string>
     <string name="loading">Laden…</string>
-    <string name="home">Startseite</string>
     <string name="refresh">Fahrplan aktualisieren</string>
-    <string name="help">Hilfe</string>
     <string name="title_activity_help">Hilfe</string>
     <string name="valid_since">Gilt seit %1$s</string>
     <string name="valid_till">Gilt bis %1$s</string>
     <string name="departure_row_getting_departures">Abfahrten sammeln…</string>
-    <string name="help_text">
-        "Warum Lieblingshaltestelle zeigt „Keine nächste Abfahrt“?\n\n"
-
-        "Die Lieblingshaltestellen enthalten Abfahrtszeiten für heute und morgen."
-        "„Keine nächste Abfahrt“ kann passieren, wenn es z.B. keinen Zeitplan für"
-        "morgen gibt und heute keine Abfahrten mehr stattfinden.\n\n"
-    </string>
-    <string name="refreshing_cache">Cache wird aktualisiert. Es kann einige Zeit dauern…</string>
-    <string name="today">Heute</string>
     <string name="no_departures">Keine Abfahrten</string>
     <string name="tab_text_line_to">Hin</string>
     <string name="tab_text_line_fro">Her</string>




diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml
index 2269942ded34a1ddcc980175b7536da1b0b10ede..96a49332ee42d46b8a59b3170fcf498ed9af25f9 100644
--- a/app/src/main/res/values-it/strings.xml
+++ b/app/src/main/res/values-it/strings.xml
@@ -5,32 +5,21 @@     Alle %1$s
     <string name="departure_in__singular_genitive">Tra %1$s minuto</string>
     <string name="departure_in__plural_genitive">Tra %1$s minuti</string>
     <string name="departure_in__plural_nominative">Tra %1$s minuti</string>
-    <string name="home">Schermo principale</string>
-    <string name="help">Aiuto</string>
     <string name="title_activity_help">Aiuto</string>
     <string name="valid_since">Valido da %1$s</string>
     <string name="valid_till">Valido a %1$s</string>
-    <string name="no_timetable">Nessun orario è stato trovato. Connettiti a Internet e aspetta che un orario venga scaricato</string>
     <string name="timetable_downloaded">Nuovo orario è stato scaricato</string>
-    <string name="tab_workday_text">Giorni di lavoro</string>
-    <string name="tab_saturday_text">Sabato</string>
-    <string name="tab_sunday_text">Domenica</string>
     <string name="action_change_type">Tipo</string>
-    <string name="no_db_connect">Connetti a Internet per scaricare l’orario</string>
-    <string name="no_db_downloading">L’orario è stando scaricato</string>
     <string name="timetable_downloading">Scaricando l’orario</string>
     <string name="search_placeholder">Fermata…</string>
     <string name="no_connectivity_cant_update">Nessuna connettività – non si riesce aggiornare l’orario</string>
     <string name="no_connectivity">Nessuna connettività</string>
     <string name="timetable_up_to_date">L’orario sta aggiornato</string>
-    <string name="validity_failed">L’orario scaricato sta corrotto – non si riesce aggiornare</string>
     <string name="error_try_later">Errore. Riprova più tardi</string>
     <string name="now">Adesso</string>
     <string name="stop_already_fav">Questa fermata è già un favorito</string>
     <string name="action_edit">Modifica</string>
     <string name="action_delete">Cancella</string>
-    <string name="done">Pronto</string>
-    <string name="favourite_edit">Modifica il favorito</string>
     <string name="favourite_name">Il nome del favorito</string>
     <string name="edit_favourite_title">Modifica «%1$s»</string>
     <string name="no_next_departure">Nessuna partenza successiva</string>
@@ -39,15 +28,6 @@     Unisci le favorite
     <string name="loading">Caricamento in corso…</string>
     <string name="refresh">Aggiorna l’orario</string>
     <string name="departure_row_getting_departures">Ottenere le partenze…</string>
-    <string name="help_text">
-        "Perché un favorito mostra «Nessuna partenza successiva»?\n\n"
-        
-        "I favoriti contengono ore per oggi e domani."
-        "«Nessuna partenza successiva» potrebbe succedere quando, ad esempio, non c’e orario per"
-        "domani e non ci sono partenze oggi in più.\n\n" 
-    </string>
-    <string name="refreshing_cache">Cache sta essendo aggiornato. Può richiedere un certo tempo…</string>
-    <string name="today">Oggi</string>
     <string name="no_departures">Nessune partenze</string>
     <string name="tab_text_line_to">Avanti</string>
     <string name="tab_text_line_fro">Indietro</string>




diff --git a/app/src/main/res/values-night/colors.xml b/app/src/main/res/values-night/colors.xml
index 67f11cd762f83c4392bd8172df01725ce99e4060..e366d72f4ad0eb01775aa5a852a38d8e6e77c317 100644
--- a/app/src/main/res/values-night/colors.xml
+++ b/app/src/main/res/values-night/colors.xml
@@ -1,5 +1,4 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
     <color name="textDark">#ffffff</color>
-    <color name="textLight">#141415</color>
 </resources>
\ No newline at end of file




diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml
index e3a00a950c096b82a64501d0a55b6649e1cccce8..afbe30f95d0afcd22d7b45bb8e25993b461c1f65 100644
--- a/app/src/main/res/values-nl/strings.xml
+++ b/app/src/main/res/values-nl/strings.xml
@@ -1,28 +1,19 @@
 <resources>
-    <string name="no_timetable">Geen dienstregeling gevonden. Maak verbinding met internet en wacht tot er een dienstregeling wordt gedownload.</string>
     <string name="timetable_downloaded">De nieuwe dienstregeling is gedownload</string>
-    <string name="tab_workday_text">Werkdagen</string>
-    <string name="tab_saturday_text">Zaterdagen</string>
-    <string name="tab_sunday_text">Zondagen</string>
     <string name="action_change_type">Type</string>
     <string name="departure_to">→ %1$s</string>
     <string name="departure_to_line">%1$s → %2$s</string>
     <string name="departure_at">Op %1$s</string>
-    <string name="no_db_connect">Maak verbinding met internet om de dienstregeling te downloaden.</string>
-    <string name="no_db_downloading">De dienstregeling wordt gedownload…</string>
     <string name="timetable_downloading">Bezig met downloaden van dienstregeling</string>
     <string name="search_placeholder">Halte…</string>
     <string name="no_connectivity_cant_update">Geen internetverbinding – de dienstregeling kan niet worden bijgewerkt.</string>
     <string name="no_connectivity">Geen internetverbinding</string>
     <string name="timetable_up_to_date">De dienstregeling is volledig bijgewerkt.</string>
-    <string name="validity_failed">De gedownloade dienstregeling bevat fouten – bijwerken is niet mogelijk.</string>
     <string name="error_try_later">Fout; probeer het later opnieuw.</string>
     <string name="now">Nu</string>
     <string name="stop_already_fav">Deze halte staat al bij je favorieten</string>
     <string name="action_edit">Bewerken</string>
     <string name="action_delete">Verwijderen</string>
-    <string name="done">Afronden</string>
-    <string name="favourite_edit">Favoriet bewerken</string>
     <string name="favourite_name">Naam van favoriet</string>
     <string name="edit_favourite_title">‘%1$s’ bewerken</string>
     <string name="no_next_departure">Geen vertrektijden</string>
@@ -33,23 +24,12 @@     Over %1$s minuut
     <string name="departure_in__plural_genitive">Over %1$s minuten</string>
     <string name="departure_in__plural_nominative">Over %1$s minuten</string>
 
-    <string name="home">Startpagina</string>
     <string name="refresh">Dienstregeling bijwerken</string>
-    <string name="help">Hulp</string>
     <string name="title_activity_help">Hulp</string>
-    <string name="help_text">
-        "Waarom toont een favoriet ‘Geen vertrektijden’?\n\n"
-
-        "Favorieten tonen tijden voor vandaag en morgen."
-        "‘Geen vertrektijden’ kan worden getoond als er bijv. geen dienstregeling voor morgen is en"
-        "er vandaag geen voertuigen meer vertrekken.\n\n"
-    </string>
     <string name="departure_row_getting_departures">Bezig met ophalen van vertrektijden…</string>
     <string name="valid_since">Ingegaan op %1$s</string>
     <string name="valid_till">Verloopt op %1$s</string>
-    <string name="refreshing_cache">Bezig met verversen van de cache. Dit kan even duren…</string>
 
-    <string name="today">Vandaag</string>
     <string name="no_departures">Geen vertrektijden</string>
     <string name="tab_text_line_to">Naar</string>
     <string name="tab_text_line_fro">Van</string>




diff --git a/app/src/main/res/values-notnight/colors.xml b/app/src/main/res/values-notnight/colors.xml
index 10fc58768fe4bae6c2a4838b64968576fd538114..fa7059b500d66dccee68c2aa529378a3b0ec5c06 100644
--- a/app/src/main/res/values-notnight/colors.xml
+++ b/app/src/main/res/values-notnight/colors.xml
@@ -1,5 +1,4 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
     <color name="textDark">#141415</color>
-    <color name="textLight">#ffffff</color>
 </resources>
\ No newline at end of file




diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml
index d627a692c607c5efb7198a47e16ecda5d285f774..97fe20b5e0c8a07c43dbd43c33e58a095c0518db 100644
--- a/app/src/main/res/values-pl/strings.xml
+++ b/app/src/main/res/values-pl/strings.xml
@@ -1,19 +1,12 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
-    <string name="no_timetable">Nie znaleziono rozkładu</string>
     <string name="timetable_downloaded">Pobrano nowy rozkład</string>
-    <string name="tab_workday_text">Dni robocze</string>
-    <string name="tab_saturday_text">Soboty</string>
-    <string name="tab_sunday_text">Niedziele</string>
     <string name="action_change_type">Typ</string>
     <string name="departure_at">O %1$s</string>
     <string name="departure_to">→ %1$s</string>
-    <string name="no_db_connect">Połącz się z Internetem aby pobrać rozkład</string>
-    <string name="no_db_downloading">Pobieranie rozkładu…</string>
     <string name="timetable_downloading">Pobieranie rozkładu</string>
     <string name="search_placeholder">Przystanek…</string>
     <string name="timetable_up_to_date">Rozkład jest aktualny</string>
-    <string name="validity_failed">Pobrany rozkład jest uszkodzony – nie można zaktualizować</string>
     <string name="no_connectivity_cant_update">Brak połączenia z Internetem – nie można zaktualizować rozkładu</string>
     <string name="no_connectivity">Brak połączenia z Internetem</string>
     <string name="error_try_later">Błąd. Spróbuj ponownie później</string>
@@ -22,8 +15,6 @@     Ten przystanek już jest pośród ulubionych
     <string name="departure_to_line">%1$s → %2$s</string>
     <string name="action_delete">Usuń</string>
     <string name="action_edit">Edytuj</string>
-    <string name="done">Zakończ</string>
-    <string name="favourite_edit">Edytuj ulubiony</string>
     <string name="edit_favourite_title">Edytuj „%1$s”</string>
     <string name="favourite_name">Nazwa ulubionego</string>
     <string name="no_next_departure">Brak następnego odjazdu</string>
@@ -33,22 +24,11 @@     Ładowanie…
     <string name="departure_in__singular_genitive">Za %1$s minutę</string>
     <string name="departure_in__plural_genitive">Za %1$s minut</string>
     <string name="departure_in__plural_nominative">Za %1$s minuty</string>
-    <string name="home">Strona główna</string>
     <string name="refresh">Zaktualizuj rozkład</string>
-    <string name="help">Pomoc</string>
     <string name="title_activity_help">Pomoc</string>
-    <string name="help_text">
-        "Dlaczego ulubiony pokazuje „Brak następnego odjazdu”?\n\n"
-
-        "Ulubione zawierają czasy dla dzisiaj i jutra."
-        "„Brak następnego odjazdu” może się wydarzyć, np. gdy nie ma rozkładu na jutro, a dzisiaj"
-        "nie ma już odjazdów.\n\n"
-    </string>
     <string name="departure_row_getting_departures">Zbieranie odjazdów…</string>
     <string name="valid_since">Ważny od %1$s</string>
     <string name="valid_till">Ważny do %1$s</string>
-    <string name="refreshing_cache">Odświeżanie pamięci podręcznej. Może chwilę potrwać…</string>
-    <string name="today">Dzisiaj</string>
     <string name="no_departures">Brak odjazdów</string>
     <string name="tab_text_line_to">Tam</string>
     <string name="tab_text_line_fro">Z powrotem</string>




diff --git a/app/src/test/java/ml/adamsprogs/bimba/ExampleUnitTest.java b/app/src/test/java/ml/adamsprogs/bimba/ExampleUnitTest.java
deleted file mode 100644
index 9e90ac72335f902c08a4955f8b44c556dac43764..0000000000000000000000000000000000000000
--- a/app/src/test/java/ml/adamsprogs/bimba/ExampleUnitTest.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package ml.adamsprogs.bimba;
-
-import org.junit.Test;
-
-import static org.junit.Assert.*;
-
-/**
- * Example local unit test, which will execute on the development machine (host).
- *
- * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
- */
-public class ExampleUnitTest {
-    @Test
-    public void addition_isCorrect() throws Exception {
-        assertEquals(4, 2 + 2);
-    }
-}
\ No newline at end of file




diff --git a/build.gradle b/build.gradle
index 84d2ffb7869a3654fae51072c3b2487a54de3026..fb7d4191ee180c74779189e71f769cd79d86d2c3 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.3.10'
+    ext.kotlin_version = '1.3.11'
     repositories {
         jcenter()
         maven { url 'https://maven.google.com' }