Skip to content

Commit

Permalink
fix: GalBgBlurHook setBackgroundBlurRadius throw exception
Browse files Browse the repository at this point in the history
  • Loading branch information
HdShare committed Dec 22, 2024
1 parent 2156e0a commit 1bb032a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,15 @@ object GalBgBlurHook : CommonConfigFunctionHook(SyncUtils.PROC_PEAK + SyncUtils.
override fun initOnce(): Boolean {
Activity::class.java.hookAfter(this, "onCreate", Bundle::class.java) {
val activity = it.thisObject as Activity
when(activity::class.java.name) {
when (activity::class.java.name) {
"com.tencent.mobileqq.richmediabrowser.AIOGalleryActivity",
"com.tencent.mobileqq.activity.aio.photo.AIOGalleryActivity",
"com.tencent.mobileqq.activity.photo.album.NewPhotoPreviewActivity",
"com.tencent.richframework.gallery.QQGalleryActivity"-> {
activity.window.blurBackground(ConfigManager.getDefaultConfig().getIntOrDefault(brCfg, 10), ConfigManager.getDefaultConfig().getFloat(bdCfg, 0.1F))
"com.tencent.richframework.gallery.QQGalleryActivity" -> {
activity.window.blurBackground(
ConfigManager.getDefaultConfig().getIntOrDefault(brCfg, 10),
ConfigManager.getDefaultConfig().getFloat(bdCfg, 0.1F)
)
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/io/github/duzhaokun123/util/Windows.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ fun Window.blurBackground(br: Int, bd: Float) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.S) return
addFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND)
attributes.blurBehindRadius = br
setBackgroundBlurRadius(br)
val blurEnableListener = { _: Boolean ->
setDimAmount(bd)
setBackgroundBlurRadius(br)
}
decorView.addOnAttachStateChangeListener(object : View.OnAttachStateChangeListener {
@RequiresApi(Build.VERSION_CODES.S)
Expand Down

0 comments on commit 1bb032a

Please sign in to comment.