diff --git a/app/build.gradle b/app/build.gradle
index 60d7ff4dd1cc7f634f2ea63bade2a44142788dd3..04479a25f93c37a117a1a81152f7fbeafe6eb9b5 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -3,15 +3,15 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
android {
- compileSdkVersion 27
- buildToolsVersion "28.0.2"
+ compileSdkVersion 28
+ buildToolsVersion '28.0.3'
defaultConfig {
applicationId "ml.adamsprogs.bimba"
minSdkVersion 19
- targetSdkVersion 27
+ targetSdkVersion 28
versionCode 15
versionName "2.0"
- testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
}
buildTypes {
@@ -24,21 +24,21 @@ }
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
- androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
+ androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0', {
exclude group: 'com.android.support', module: 'support-annotations'
})
- implementation 'com.android.support:appcompat-v7:27.1.1'
- implementation 'com.android.support:cardview-v7:27.1.1'
- implementation 'com.android.support:design:27.1.1'
- implementation 'com.android.support:support-vector-drawable:27.1.1'
- implementation 'com.android.support.constraint:constraint-layout:1.1.3'
+ implementation 'androidx.appcompat:appcompat:1.0.2'
+ implementation 'androidx.cardview:cardview:1.0.0'
+ implementation 'com.google.android.material:material:1.1.0-alpha01'
+ implementation 'androidx.vectordrawable:vectordrawable:1.0.1'
+ implementation 'androidx.constraintlayout:constraintlayout:2.0.0-alpha2'
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation 'com.github.arimorty:floatingsearchview:2.1.1'
- implementation 'com.google.code.gson:gson:2.8.1'
- implementation 'com.squareup.okhttp3:okhttp:3.8.1'
+ implementation 'com.google.code.gson:gson:2.8.2'
+ implementation 'com.squareup.okhttp3:okhttp:3.10.0'
implementation 'io.requery:sqlite-android:3.22.0'
- implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:0.22.5'
- implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:0.22.5'
+ implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:0.27.0-eap13'
+ implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:0.27.0-eap13'
testImplementation 'junit:junit:4.12'
}
repositories {
diff --git a/app/src/androidTest/java/ml/adamsprogs/bimba/ExampleInstrumentedTest.java b/app/src/androidTest/java/ml/adamsprogs/bimba/ExampleInstrumentedTest.java
index f66a5f890feef1d0355c36fae39cced6e1446d12..cef03f892c551316d036664d501ddd0933ba8383 100644
--- a/app/src/androidTest/java/ml/adamsprogs/bimba/ExampleInstrumentedTest.java
+++ b/app/src/androidTest/java/ml/adamsprogs/bimba/ExampleInstrumentedTest.java
@@ -1,8 +1,8 @@
package ml.adamsprogs.bimba;
import android.content.Context;
-import android.support.test.InstrumentationRegistry;
-import android.support.test.runner.AndroidJUnit4;
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
diff --git a/app/src/main/java/ml/adamsprogs/bimba/NotificationChannels.kt b/app/src/main/java/ml/adamsprogs/bimba/NotificationChannels.kt
index 8ed8000409fe4705c3161668f926bb0d8d87272d..009de4ed616680e7e1b7cc6c91aa152330e3cb75 100644
--- a/app/src/main/java/ml/adamsprogs/bimba/NotificationChannels.kt
+++ b/app/src/main/java/ml/adamsprogs/bimba/NotificationChannels.kt
@@ -3,7 +3,7 @@
import android.app.NotificationChannel
import android.app.NotificationManager
import android.os.Build
-import android.support.annotation.RequiresApi
+import androidx.annotation.RequiresApi
class NotificationChannels {
diff --git a/app/src/main/java/ml/adamsprogs/bimba/ProviderProxy.kt b/app/src/main/java/ml/adamsprogs/bimba/ProviderProxy.kt
index 45a60fc90e45adb61e3dd09c5a5ed12bbe9b7059..cb45d2c150fc033ecc5e182c06d5a0db0a967280 100644
--- a/app/src/main/java/ml/adamsprogs/bimba/ProviderProxy.kt
+++ b/app/src/main/java/ml/adamsprogs/bimba/ProviderProxy.kt
@@ -1,8 +1,8 @@
package ml.adamsprogs.bimba
import android.content.*
-import kotlinx.coroutines.experimental.android.UI
-import kotlinx.coroutines.experimental.*
+import kotlinx.coroutines.*
+import kotlinx.coroutines.android.Main
import ml.adamsprogs.bimba.datasources.*
import ml.adamsprogs.bimba.models.*
import ml.adamsprogs.bimba.models.suggestions.*
@@ -24,17 +24,17 @@ const val MODE_VM = "mode_vm"
}
fun getSuggestions(query: String = "", callback: (List<GtfsSuggestion>) -> Unit) {
- launch(UI) {
- val filtered = withContext(DefaultDispatcher) {
+ 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)
}
callback(filtered)
- }
+ })
}
private suspend fun getStopSuggestions(query: String): List<StopSuggestion> {
- val vmSuggestions = withContext(DefaultDispatcher) {
+ val vmSuggestions = withContext(Dispatchers.Default) {
vmClient.getStops(query)
}
@@ -65,8 +65,8 @@ return result
}
fun getSheds(name: String, callback: (Map<String, Set<String>>) -> Unit) {
- launch(UI) {
- val sheds = withContext(DefaultDispatcher) {
+ launch(Dispatchers.Main) {
+ val sheds = withContext(Dispatchers.Default) {
val vmSheds = vmClient.getSheds(name)
if (vmSheds.isEmpty() and !timetable.isEmpty()) {
@@ -104,13 +104,13 @@ return uuid
}
private fun constructSegmentDepartures(stopSegments: Set<StopSegment>): Deferred<Map<String, List<Departure>>> {
- return async {
+ return GlobalScope.async(Dispatchers.Default, CoroutineStart.DEFAULT, null, {
if (timetable.isEmpty())
emptyMap()
else {
timetable.getStopDeparturesBySegments(stopSegments)
}
- }
+ })
}
private fun filterDepartures(departures: Map<String, List<Departure>>): List<Departure> {
@@ -161,8 +161,8 @@
}
fun fillStopSegment(stopSegment: StopSegment, callback: (StopSegment?) -> Unit) {
- launch(UI) {
- withContext(DefaultDispatcher) {
+ launch(Dispatchers.Main) {
+ withContext(Dispatchers.Default) {
callback(fillStopSegment(stopSegment))
}
}
@@ -179,8 +179,8 @@ timetable.getHeadlinesForStopCode(stopSegment.stop)
}
fun getStopName(stopCode: String, callback: (String?) -> Unit) {
- launch(UI) {
- withContext(DefaultDispatcher) {
+ launch(Dispatchers.Main) {
+ withContext(Dispatchers.Default) {
callback(getStopName(stopCode))
}
}
@@ -216,13 +216,13 @@ private var cache: Deferred