Currently I do:
- create a transparent widget
- create a bitmap (android.graphics.Bitmap)
- create a canvas (android.graphics.Canvas) with the bitmap
- draw the widget on the canvas.
- analyze the colors on the canvas.
-> it's currently white only, because my transparent widget always comes off as white on the canvas, whatever the color under it.
How should I proceed? Is it even possible? I am open to looking for colors around my Widget (in places where I don't have any widgets from my app) if necessary.
Here are my layout params (copy-pasted from an autoclicker app):
val overlayParam =
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY
} else {
WindowManager.LayoutParams.TYPE_PHONE
}
params = WindowManager.LayoutParams(
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.WRAP_CONTENT,
overlayParam,
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
PixelFormat.TRANSLUCENT)