Skip to content

Commit

Permalink
Improve handling notification footer buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
Mahmud0808 committed Apr 23, 2024
1 parent 9926555 commit c42dec1
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 24 deletions.
Expand Up @@ -656,16 +656,22 @@ class QuickSettings(context: Context?) : ModPack(context!!) {
override fun afterHookedMethod(param: MethodHookParam) {
if (!fixNotificationColor) return

val mClearAllButton =
getObjectField(param.thisObject, "mClearAllButton") as Button
val mManageButton =
getObjectField(param.thisObject, "mManageButton") as Button
try {
val mManageButton =
getObjectField(param.thisObject, "mManageButton") as Button
val mClearAllButton = try {
getObjectField(param.thisObject, "mClearAllButton")
} catch (ignored: Throwable) {
getObjectField(param.thisObject, "mDismissButton")
} as Button

mClearAllButton.background.clearColorFilter()
mManageButton.background.clearColorFilter()
mManageButton.background?.clearColorFilter()
mClearAllButton.background?.clearColorFilter()

mClearAllButton.invalidate()
mManageButton.invalidate()
mManageButton.invalidate()
mClearAllButton.invalidate()
} catch (ignored: Throwable) {
}
}
}

Expand Down
Expand Up @@ -645,16 +645,19 @@ class QSFluidThemeA13(context: Context?) : ModPack(context!!) {
override fun afterHookedMethod(param: MethodHookParam) {
if (!fluidQsThemeEnabled || !fluidNotifEnabled) return

val mManageButton =
getObjectField(param.thisObject, "mManageButton") as Button?
val mClearAllButton: Button? = try {
getObjectField(param.thisObject, "mClearAllButton") as Button?
try {
val mManageButton =
getObjectField(param.thisObject, "mManageButton") as Button
val mClearAllButton = try {
getObjectField(param.thisObject, "mClearAllButton")
} catch (ignored: Throwable) {
getObjectField(param.thisObject, "mDismissButton")
} as Button

mManageButton.background?.alpha = (INACTIVE_ALPHA * 255).toInt()
mClearAllButton.background?.alpha = (INACTIVE_ALPHA * 255).toInt()
} catch (ignored: Throwable) {
getObjectField(param.thisObject, "mDismissButton") as Button?
}

mManageButton?.background?.alpha = (INACTIVE_ALPHA * 255).toInt()
mClearAllButton?.background?.alpha = (INACTIVE_ALPHA * 255).toInt()
}
}

Expand Down
Expand Up @@ -797,16 +797,19 @@ class QSFluidThemeA14(context: Context?) : ModPack(context!!) {
override fun afterHookedMethod(param: MethodHookParam) {
if (!fluidQsThemeEnabled || !fluidNotifEnabled) return

val mManageButton =
getObjectField(param.thisObject, "mManageButton") as Button?
val mClearAllButton: Button? = try {
getObjectField(param.thisObject, "mClearAllButton") as Button?
try {
val mManageButton =
getObjectField(param.thisObject, "mManageButton") as Button
val mClearAllButton: Button = try {
getObjectField(param.thisObject, "mClearAllButton")
} catch (ignored: Throwable) {
getObjectField(param.thisObject, "mDismissButton")
} as Button

mManageButton.background?.alpha = (INACTIVE_ALPHA * 255).toInt()
mClearAllButton.background?.alpha = (INACTIVE_ALPHA * 255).toInt()
} catch (ignored: Throwable) {
getObjectField(param.thisObject, "mDismissButton") as Button?
}

mManageButton?.background?.alpha = (INACTIVE_ALPHA * 255).toInt()
mClearAllButton?.background?.alpha = (INACTIVE_ALPHA * 255).toInt()
}
}

Expand Down

0 comments on commit c42dec1

Please sign in to comment.