Closed c0dd3vi11 closed 4 years ago
It could be simple - I admit, but in the meantime this is how to do it:
There's a TileOptionsProvider
that you can assign to the MapView using MapViewConfiguration.setTileOptionsProvider
interface TileOptionsProvider {
/* Must not be a blocking call - should return immediately */
@JvmDefault
fun getColorFilter(row: Int, col: Int, zoomLvl: Int): ColorFilter? = null
/**
* Controls the speed of fade in effect when rendering tiles. Higher values make alpha
* value go to 255 faster. Should be in between (0.0f, 1.0f].
*/
@JvmDefault
val alphaTick : Float
get() = 0.07f
}
You just have to provide an implementation which returns 255f as alphaTick
You do not have to override getColorFilter
method.
To summarize all this, here's an example:
val tileOptionsProvider = object : TileOptionsProvider {
override val alphaTick: Float
get() = 255f
}
val config = MapViewConfiguration(
5, 8192, 8192, tileSize, tileStreamProvider)
.setMaxScale(2f).setTileOptionsProvider(tileOptionsProvider)
You might have to add this to your android{}
section of your build.gradle:
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8
freeCompilerArgs = ['-Xjvm-default=compatibility']
}
Thank you for fast replying)
I tried the method and noticed, that 2.0.5 version didn't contain alphaTick method to override it. I applied the lib via gradle implementation 'com.peterlaurence:mapview:2.0.5'
and don't know how to fetch the very recent implementation. Could you help me, please?
Oh my bad.. didn't see that it wasn't released yet.
Wait a sec, I'm releasing 2.0.6
.
@c0dd3vi11 2.0.6
is released!
Thank you a lot! ^_^
Hi, @peterLaurence, again)
I found that TileCanvasView that performs that animation is internal. Could you recommend the best way to manage how tiles appear or how to remove the animation at all?