-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HomeHandleAnim: Workaround MiuiHome Mi Blur freeze issue
HyperCeiler attached MiBlur View for replaced Original Window Blur, but Mi Blur will draw only top layer. Unfortunately, NavBar has higher z-index than MiuiHome Blur view if we active the blur for home handle caused home blur view freezed. Deactive blur if home view rect blur active and reactive it when home blur view radius return to zero. Signed-off-by: Art_Chen <[email protected]>
- Loading branch information
Showing
4 changed files
with
73 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
app/src/main/java/moe/chenxy/miuiextra/hooker/entity/home/ViewBlurHooker.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package moe.chenxy.miuiextra.hooker.entity.home | ||
|
||
import android.content.Context | ||
import android.content.Intent | ||
import android.util.Log | ||
import android.view.View | ||
import com.highcapable.yukihookapi.hook.entity.YukiBaseHooker | ||
import com.highcapable.yukihookapi.hook.factory.method | ||
import com.highcapable.yukihookapi.hook.type.android.ViewClass | ||
import com.highcapable.yukihookapi.hook.type.java.IntType | ||
import de.robv.android.xposed.XposedHelpers | ||
|
||
object ViewBlurHooker : YukiBaseHooker() { | ||
override fun onHook() { | ||
var launcherBlurActivated = false | ||
|
||
fun View.getMiViewBlurModeCompat() = XposedHelpers.callMethod( | ||
this, "getMiViewBlurMode") as Int | ||
// Workaround NavBar zindex higher than launcher caused mi blur not draw the blur view | ||
ViewClass.apply { | ||
method { | ||
name = "setMiBackgroundBlurRadius" | ||
param(IntType) | ||
}.hook { | ||
before { | ||
if ((this.instance as View).getMiViewBlurModeCompat() != 1) { | ||
return@before | ||
} | ||
Log.i("Art_Chen", "setMiBackgroundBlurRadius ${this.args[0]}") | ||
val isActive = this.args[0] as Int > 0 | ||
// if (isActive == launcherBlurActivated) return@before | ||
// | ||
// launcherBlurActivated = isActive | ||
|
||
val mContext = XposedHelpers.getObjectField(this.instance, "mContext") as Context | ||
val intent = Intent("chen.action.home.blur.state.switched") | ||
intent.`package`= "com.android.systemui" | ||
intent.putExtra("active", isActive) | ||
mContext.sendBroadcast(intent) | ||
} | ||
} | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters