Skip to content

Commit

Permalink
optimize
Browse files Browse the repository at this point in the history
  • Loading branch information
GangJust committed Jul 1, 2024
1 parent fed441f commit 9a3bc29
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ android {
applicationId "io.github.fplus"
minSdk 24
targetSdk 33
versionCode 131
versionName "1.3.2"
versionCode 135
versionName "1.3.3"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/assets/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.3.2-131
1.3.3-135
13 changes: 13 additions & 0 deletions core/src/main/java/io/github/fplus/core/hook/HPhoneWindow.kt
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
package io.github.fplus.core.hook

import android.content.Context
import android.graphics.Color
import com.freegang.extension.findMethodInvoke
import de.robv.android.xposed.XC_MethodHook
import io.github.fplus.core.config.ConfigV1
import io.github.fplus.core.ui.activity.FreedomSettingActivity
import io.github.xpler.core.entity.HookEntity
import io.github.xpler.core.entity.OnBefore
import io.github.xpler.core.hookBlockRunning
Expand All @@ -19,9 +22,16 @@ class HPhoneWindow : HookEntity() {
return findClass("com.android.internal.policy.PhoneWindow")
}

private fun getContext(params: XC_MethodHook.MethodHookParam): Context? {
return params.thisObject.findMethodInvoke<Context> { name("getContext") }
}

@OnBefore("setStatusBarColor")
fun setStatusBarColorBefore(params: XC_MethodHook.MethodHookParam, color: Int) {
hookBlockRunning(params) {
if (getContext(this) is FreedomSettingActivity)
return

if (config.isImmersive) {
args[0] = Color.TRANSPARENT
}
Expand All @@ -33,6 +43,9 @@ class HPhoneWindow : HookEntity() {
@OnBefore("setNavigationBarColor")
fun setNavigationBarColorBefore(params: XC_MethodHook.MethodHookParam, color: Int) {
hookBlockRunning(params) {
if (getContext(this) is FreedomSettingActivity)
return

if (config.isImmersive) {
args[0] = Color.TRANSPARENT
}
Expand Down

0 comments on commit 9a3bc29

Please sign in to comment.