From 0fd3c0cc53d1ba06ad3f723e5f8e4759451605e1 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 9 Apr 2017 18:11:41 +0200 Subject: [PATCH] get the display resolution when resizing bitmap --- .../main/kotlin/com/simplemobiletools/draw/MyCanvas.kt | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/draw/MyCanvas.kt b/app/src/main/kotlin/com/simplemobiletools/draw/MyCanvas.kt index 4ca4674..425d90a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/draw/MyCanvas.kt +++ b/app/src/main/kotlin/com/simplemobiletools/draw/MyCanvas.kt @@ -2,10 +2,7 @@ package com.simplemobiletools.draw import android.app.Activity import android.content.Context -import android.graphics.Bitmap -import android.graphics.Canvas -import android.graphics.Color -import android.graphics.Paint +import android.graphics.* import android.os.Parcel import android.os.Parcelable import android.util.AttributeSet @@ -94,12 +91,14 @@ class MyCanvas(context: Context, attrs: AttributeSet) : View(context, attrs) { fun drawBitmap(activity: Activity, path: String) { Thread({ + val size = Point() + activity.windowManager.defaultDisplay.getSize(size) mBackgroundBitmap = Glide.with(context) .load(path) .asBitmap() .format(DecodeFormat.PREFER_ARGB_8888) .fitCenter() - .into(width, height) + .into(size.x, size.y) .get() activity.runOnUiThread { invalidate()