mirror of
https://github.com/oxen-io/session-android.git
synced 2025-01-11 19:03:39 +00:00
Remove laid out check before drawToBitmap
This commit is contained in:
commit
910ab8874e
@ -21,7 +21,6 @@ import android.widget.Toast
|
|||||||
import androidx.activity.viewModels
|
import androidx.activity.viewModels
|
||||||
import androidx.annotation.DimenRes
|
import androidx.annotation.DimenRes
|
||||||
import androidx.appcompat.app.AlertDialog
|
import androidx.appcompat.app.AlertDialog
|
||||||
import androidx.core.view.drawToBitmap
|
|
||||||
import androidx.core.view.isGone
|
import androidx.core.view.isGone
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
import androidx.lifecycle.Observer
|
import androidx.lifecycle.Observer
|
||||||
|
@ -5,6 +5,7 @@ import android.animation.AnimatorListenerAdapter
|
|||||||
import android.animation.FloatEvaluator
|
import android.animation.FloatEvaluator
|
||||||
import android.animation.ValueAnimator
|
import android.animation.ValueAnimator
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import android.graphics.Bitmap
|
||||||
import android.graphics.PointF
|
import android.graphics.PointF
|
||||||
import android.graphics.Rect
|
import android.graphics.Rect
|
||||||
import android.view.View
|
import android.view.View
|
||||||
@ -13,6 +14,7 @@ import androidx.annotation.DimenRes
|
|||||||
import network.loki.messenger.R
|
import network.loki.messenger.R
|
||||||
import org.session.libsession.utilities.getColorFromAttr
|
import org.session.libsession.utilities.getColorFromAttr
|
||||||
import android.view.inputmethod.InputMethodManager
|
import android.view.inputmethod.InputMethodManager
|
||||||
|
import androidx.core.graphics.applyCanvas
|
||||||
|
|
||||||
fun View.contains(point: PointF): Boolean {
|
fun View.contains(point: PointF): Boolean {
|
||||||
return hitRect.contains(point.x.toInt(), point.y.toInt())
|
return hitRect.contains(point.x.toInt(), point.y.toInt())
|
||||||
@ -65,3 +67,9 @@ fun View.hideKeyboard() {
|
|||||||
val imm = this.context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
|
val imm = this.context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
|
||||||
imm.hideSoftInputFromWindow(this.windowToken, 0)
|
imm.hideSoftInputFromWindow(this.windowToken, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun View.drawToBitmap(config: Bitmap.Config = Bitmap.Config.ARGB_8888): Bitmap =
|
||||||
|
Bitmap.createBitmap(width, height, config).applyCanvas {
|
||||||
|
translate(-scrollX.toFloat(), -scrollY.toFloat())
|
||||||
|
draw(this)
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user