显示 WIFI 角标 (#166)

This commit is contained in:
YuKongA
2022-05-17 00:22:48 +08:00
committed by GitHub
parent 2a94e1da69
commit cef006ced2
6 changed files with 46 additions and 6 deletions

View File

@@ -20,8 +20,7 @@ android {
release {
isMinifyEnabled = true
isShrinkResources = true
setProguardFiles(listOf("proguard-rules.pro")
)
setProguardFiles(listOf("proguard-rules.pro"))
}
}
compileOptions {
@@ -44,8 +43,7 @@ android {
}
applicationVariants.all {
outputs.all {
(this as BaseVariantOutputImpl).outputFileName =
"WooBoxForMIUI-$versionName-$name.apk"
(this as BaseVariantOutputImpl).outputFileName = "WooBoxForMIUI-$versionName-$name.apk"
}
}
}
@@ -53,7 +51,7 @@ android {
dependencies {
//API
compileOnly("de.robv.android.xposed:api:82")
implementation("com.github.kyuubiran:EzXHelper:0.8.6")
implementation("com.github.kyuubiran:EzXHelper:0.9.2")
//UI
implementation(project(":blockmiui"))
implementation("androidx.constraintlayout:constraintlayout:2.1.3")

View File

@@ -319,6 +319,10 @@ class SettingsActivity : MIUIActivity() {
dataBindingSend = customMobileTypeTextBinding.bindingSend
)
)
TextWithSwitch(
TextV(resId = R.string.show_wifi_standard),
SwitchV("show_wifi_standard")
)
TextSummaryArrow(
TextSummaryV(
textId = R.string.custom_mobile_type_text

View File

@@ -43,6 +43,7 @@ object SystemUI: AppRegister() {
CustomMobileTypeText, //自定义移动类型文本
CanNotificationSlide, //允许下滑通知打开小窗
LockScreenClockDisplaySeconds, // 锁屏时钟显示秒
ShowWifiStandard, // 显示 WIFI 角标
)
}
}

View File

@@ -0,0 +1,36 @@
package com.lt2333.simplicitytools.hook.app.systemui
import com.github.kyuubiran.ezxhelper.utils.*
import com.lt2333.simplicitytools.util.hasEnable
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
object ShowWifiStandard : HookRegister() {
override fun init() {
findMethod("com.android.systemui.statusbar.StatusBarWifiView") {
name == "initViewState" && parameterCount == 1
}.hookBefore {
hasEnable("show_wifi_standard") {
findMethod("com.android.systemui.statusbar.phone.StatusBarSignalPolicy\$WifiIconState") {
name == "copyTo" && parameterCount == 1
}.hookBefore {
val wifiStandard = it.thisObject.getObjectAs<Int>("wifiStandard")
it.thisObject.putObject("showWifiStandard", wifiStandard != 0)
}
}
}
findMethod("com.android.systemui.statusbar.StatusBarWifiView") {
name == "updateState" && parameterCount == 1
}.hookBefore {
hasEnable("show_wifi_standard") {
findMethod("com.android.systemui.statusbar.phone.StatusBarSignalPolicy\$WifiIconState") {
name == "copyTo" && parameterCount == 1
}.hookBefore {
val wifiStandard = it.thisObject.getObjectAs<Int>("wifiStandard")
it.thisObject.putObject("showWifiStandard", wifiStandard != 0)
}
}
}
}
}

View File

@@ -182,6 +182,7 @@
<string name="left">Left</string>
<string name="right">Right</string>
<string name="big_mobile_type_icon">Big Mobile Type Icon</string>
<string name="show_wifi_standard">Show Wifi Standard</string>
<string name="can_notification_slide">Make most notifications can be slide to small window</string>
<string name="battery_percentage_font_size">Battery percentage font size</string>
<string name="zero_do_no_change">0: do not change</string>

View File

@@ -5,7 +5,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:7.1.3")
classpath("com.android.tools.build:gradle:7.2.0")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10")
// NOTE: Do not place your application dependencies here; they belong