Skip to content

Commit

Permalink
fix: round clip in some apps such as blocker
Browse files Browse the repository at this point in the history
  • Loading branch information
RichardLuo0 committed Feb 18, 2025
1 parent a811c4e commit d0bd360
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,11 @@ class NoForceShape : Hook {
UnClipAdaptiveIconDrawable(background, foreground) {
override fun getIconMask(): Path = getFullBoundsPath()

override fun getConstantState(): ConstantState {
return UnmaskState(background, foreground)
}
override val cState: ConstantState by lazy { CState() }

override fun getConstantState(): ConstantState = cState

class UnmaskState(private val background: Drawable?, private val foreground: Drawable?) :
ConstantState() {
private inner class CState : ConstantState() {
override fun newDrawable(): Drawable = UnmaskAdaptiveIconDrawable(background, foreground)

override fun getChangingConfigurations(): Int = 0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,17 @@ object IconHelper {
super.setAlpha(alpha)
paint.alpha = alpha
}

override val cState by lazy { CState() }

override fun getConstantState(): ConstantState = cState

private inner class CState : ConstantState() {
override fun newDrawable(): Drawable =
CustomAdaptiveIconDrawable(background, foreground, back, upon, mask, iconScale)

override fun getChangingConfigurations(): Int = 0
}
}

interface Adaptively {
Expand Down Expand Up @@ -232,7 +243,9 @@ private val useUnClipAdaptive: Boolean by lazy {
if (!isInMod) false
else
when (AndroidAppHelper.currentPackageName()) {
// Fix app list, black background sometimes
"com.android.settings" -> false
// Fix splash screen
"com.android.systemui" -> false
"com.android.intentresolver" -> true
else -> true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,14 @@ open class UnClipAdaptiveIconDrawable(background: Drawable?, foreground: Drawabl
RectF(bounds).apply {
inset(-bounds.width() * getExtraInsetFraction(), -bounds.height() * getExtraInsetFraction())
}

open val cState: ConstantState by lazy { CState() }

override fun getConstantState(): ConstantState = cState

private inner class CState : ConstantState() {
override fun newDrawable(): Drawable = UnClipAdaptiveIconDrawable(background, foreground)

override fun getChangingConfigurations(): Int = 0
}
}

0 comments on commit d0bd360

Please sign in to comment.