Skip to content

Commit

Permalink
HomeHandle: get MiBlurCompat Class on function
Browse files Browse the repository at this point in the history
Fixed HomeHandle Animation caused SystemUI Crashed on Android T

Signed-off-by: Art_Chen <[email protected]>
  • Loading branch information
Art-Chen committed Nov 4, 2023
1 parent ce18b99 commit 1dab18e
Showing 1 changed file with 19 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,20 @@ package moe.chenxy.miuiextra.hooker.entity.systemui
import android.view.View
import de.robv.android.xposed.XposedHelpers
import moe.chenxy.miuiextra.hooker.entity.systemui.StatusBarBlurUtilsHooker.toClass
import moe.chenxy.miuiextra.utils.ChenUtils

object MiBlurCompatUtils {
private val blurCompatCls = "com.miui.systemui.util.MiBlurCompat".toClass()
private const val blurCompatCls = "com.miui.systemui.util.MiBlurCompat"

@JvmStatic
fun View.setPassWindowBlurEnabledCompat(enable: Boolean) = XposedHelpers.callStaticMethod(
blurCompatCls, "setPassWindowBlurEnabledCompat", this, enable)
fun View.setPassWindowBlurEnabledCompat(enable: Boolean) =
if (ChenUtils.isAboveAndroidVersion(ChenUtils.Companion.AndroidVersion.U)) {
XposedHelpers.callStaticMethod(
blurCompatCls.toClass(), "setPassWindowBlurEnabledCompat", this, enable
)
} else {

}

@JvmStatic
fun View.setMiBackgroundBlurModeCompat(mode: Int) = XposedHelpers.callMethod(
Expand All @@ -25,5 +32,13 @@ object MiBlurCompatUtils {

@JvmStatic
fun View.isSupportMiBlur() =
XposedHelpers.callStaticMethod(blurCompatCls, "getBackgroundBlurOpened", this.context) as Boolean
if (ChenUtils.isAboveAndroidVersion(ChenUtils.Companion.AndroidVersion.U)) {
XposedHelpers.callStaticMethod(
blurCompatCls.toClass(),
"getBackgroundBlurOpened",
this.context
) as Boolean
} else {
false
}
}

0 comments on commit 1dab18e

Please sign in to comment.