diff --git a/Readme.md b/Readme.md index 83e2c94..49b7b74 100644 --- a/Readme.md +++ b/Readme.md @@ -1,4 +1,4 @@ -[ ![Download](https://api.bintray.com/packages/peterlaurence/maven/mapview/images/download.svg?version=1.0.6) ](https://bintray.com/peterlaurence/maven/mapview/1.0.6/link) +[ ![Download](https://api.bintray.com/packages/peterlaurence/maven/mapview/images/download.svg?version=1.0.7) ](https://bintray.com/peterlaurence/maven/mapview/1.0.7/link) # MapView @@ -29,7 +29,7 @@ This project holds the source code of this library, plus a demo app (which is us Add this to your module's build.gradle ```groovy -implementation 'com.peterlaurence:mapview:1.0.6' +implementation 'com.peterlaurence:mapview:1.0.7' ``` ## Origin and motivation diff --git a/demo/build.gradle b/demo/build.gradle index 879d6d5..57b7019 100644 --- a/demo/build.gradle +++ b/demo/build.gradle @@ -4,11 +4,11 @@ apply plugin: 'kotlin-android-extensions' apply plugin: 'kotlinx-serialization' android { - compileSdkVersion 28 + compileSdkVersion 29 defaultConfig { applicationId "com.peterlaurence.mapview.demo" minSdkVersion 23 - targetSdkVersion 28 + targetSdkVersion 29 versionCode 1 versionName "1.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" diff --git a/mapview/build.gradle b/mapview/build.gradle index 890d99b..6b387d7 100644 --- a/mapview/build.gradle +++ b/mapview/build.gradle @@ -4,7 +4,7 @@ apply plugin: 'kotlin-android' apply plugin: 'kotlin-android-extensions' apply plugin: 'kotlinx-serialization' -def version = "1.0.6" +def version = "1.0.7" androidExtensions { experimental = true @@ -20,12 +20,12 @@ buildscript { } android { - compileSdkVersion 28 + compileSdkVersion 29 defaultConfig { minSdkVersion 23 - targetSdkVersion 28 + targetSdkVersion 29 versionCode 2 versionName version } @@ -54,7 +54,7 @@ dependencies { implementation 'androidx.appcompat:appcompat:1.1.0' testImplementation 'junit:junit:4.12' - testImplementation 'org.robolectric:robolectric:4.3' + testImplementation 'org.robolectric:robolectric:4.3.1' implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.2' implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.2' diff --git a/mapview/src/main/java/com/peterlaurence/mapview/core/TileCollector.kt b/mapview/src/main/java/com/peterlaurence/mapview/core/TileCollector.kt index b10c1ba..b961746 100644 --- a/mapview/src/main/java/com/peterlaurence/mapview/core/TileCollector.kt +++ b/mapview/src/main/java/com/peterlaurence/mapview/core/TileCollector.kt @@ -136,8 +136,10 @@ class TileCollector(private val workerCount: Int) { SynchronousQueue(), ThreadFactory { r -> Thread(r).apply { isDaemon = true - priority = Thread.MIN_PRIORITY - Process.setThreadPriority(Process.THREAD_PRIORITY_LOWEST) + /* Beware, using THREAD_PRIORITY_LOWEST leads to UI hang on some emulators, while + * THREAD_PRIORITY_BACKGROUND has similar positive impact on overall responsiveness on + * low-end devices while not having this side effect. */ + Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND) } }).asCoroutineDispatcher() } \ No newline at end of file diff --git a/mapview/src/test/java/com/peterlaurence/mapview/core/TileCollectorTest.kt b/mapview/src/test/java/com/peterlaurence/mapview/core/TileCollectorTest.kt index 483c54a..0bd4962 100644 --- a/mapview/src/test/java/com/peterlaurence/mapview/core/TileCollectorTest.kt +++ b/mapview/src/test/java/com/peterlaurence/mapview/core/TileCollectorTest.kt @@ -2,6 +2,7 @@ package com.peterlaurence.mapview.core import android.graphics.Bitmap import android.graphics.BitmapFactory +import android.os.Build import kotlinx.coroutines.* import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.channels.ReceiveChannel @@ -13,6 +14,7 @@ import org.junit.Assert.* import org.junit.Test import org.junit.runner.RunWith import org.robolectric.RobolectricTestRunner +import org.robolectric.annotation.Config import java.io.File import java.io.FileInputStream import java.io.InputStream @@ -26,6 +28,7 @@ import com.peterlaurence.mapview.core.TileStreamProvider as MapViewTileStreamPro * * The [Bitmap] of the [Tile]s produced should be consistent with the output of the flow */ @RunWith(RobolectricTestRunner::class) +@Config(sdk = [Build.VERSION_CODES.P]) class TileCollectorTest { private val tileSize = 256