Skip to content

Commit

Permalink
fix(NoForceShape): in recent app list, if mask is null, use system mask
Browse files Browse the repository at this point in the history
  • Loading branch information
RichardLuo0 committed Feb 16, 2025
1 parent a43e964 commit 162eff3
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions app/src/main/kotlin/com/richardluo/globalIconPack/NoForceShape.kt
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,12 @@ class NoForceShape : Hook {
object : XC_MethodHook() {
override fun beforeHookedMethod(param: MethodHookParam) {
param.args[0].asType<Drawable?>()?.let {
if (it !is AdaptiveIconDrawable) param.args[0] = createUnMask(it)
param.args[0] =
when (it) {
is IconHelper.Adaptively -> it.makeAdaptive()
!is AdaptiveIconDrawable -> makeUnMask(it)
else -> it
}
}
}
},
Expand All @@ -91,7 +96,12 @@ class NoForceShape : Hook {
object : XC_MethodHook() {
override fun beforeHookedMethod(param: MethodHookParam) {
param.args[0].asType<Drawable?>()?.let {
if (it !is AdaptiveIconDrawable) param.args[0] = createUnMask(it)
param.args[0] =
when (it) {
is IconHelper.Adaptively -> it.makeAdaptive()
!is AdaptiveIconDrawable -> makeUnMask(it)
else -> it
}
}
}
},
Expand Down Expand Up @@ -168,6 +178,6 @@ class NoForceShape : Hook {
}
}

fun createUnMask(drawable: Drawable) =
fun makeUnMask(drawable: Drawable) =
UnmaskAdaptiveIconDrawable(null, IconHelper.createScaledDrawable(drawable))
}

0 comments on commit 162eff3

Please sign in to comment.