update Commons to 2.23.7

This commit is contained in:
tibbi 2017-08-03 21:59:19 +02:00
parent d6f367e845
commit 59eb2523cb
2 changed files with 10 additions and 5 deletions

View File

@ -32,7 +32,7 @@ android {
}
dependencies {
compile 'com.simplemobiletools:commons:2.21.12'
compile 'com.simplemobiletools:commons:2.23.7'
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
}

View File

@ -10,6 +10,7 @@ import android.view.MotionEvent
import android.view.View
import com.bumptech.glide.Glide
import com.bumptech.glide.load.DecodeFormat
import com.bumptech.glide.request.RequestOptions
import com.simplemobiletools.commons.extensions.getContrastColor
import java.util.*
@ -89,13 +90,17 @@ class MyCanvas(context: Context, attrs: AttributeSet) : View(context, attrs) {
Thread({
val size = Point()
activity.windowManager.defaultDisplay.getSize(size)
mBackgroundBitmap = Glide.with(context)
.load(path)
.asBitmap()
val options = RequestOptions()
.format(DecodeFormat.PREFER_ARGB_8888)
.fitCenter()
val builder = Glide.with(context)
.asBitmap()
.load(path)
.apply(options)
.into(size.x, size.y)
.get()
mBackgroundBitmap = builder.get()
activity.runOnUiThread {
invalidate()
}