Apply background dim to view instead of window

Setting both blur and dim to window at the same time breaks the blur transition
This commit is contained in:
MM20 2022-01-29 17:18:56 +01:00
parent 8f5e920d4e
commit 7b6ff6e6eb
No known key found for this signature in database
GPG Key ID: 0B61A8F2DEAFA389

View File

@ -50,11 +50,9 @@ class LauncherActivity : BaseActivity() {
viewModel.dimBackground.observe(this) { dim ->
window.attributes = window.attributes.also {
if (dim) {
it.dimAmount = 0.3f
it.flags = it.flags or WindowManager.LayoutParams.FLAG_DIM_BEHIND
binding.rootView.setBackgroundColor(0x4C000000)
} else {
it.dimAmount = 0f
it.flags = it.flags and WindowManager.LayoutParams.FLAG_DIM_BEHIND.inv()
binding.rootView.setBackgroundColor(0)
}
}
}