Skip to content

Commit

Permalink
6.1.3
Browse files Browse the repository at this point in the history
修复 部分log输出错误
修复 更换壁纸导致无法显示
修复 Android14无法隐藏通知图标
修复 开启边缘模糊后宽度异常
适配 部分HyperOS For Pad 
适配 多个音乐软件图标
将 隐藏运营商 移动到 SystemSpecialPage并限制Android14以下才能使用
  • Loading branch information
xiaowine authored Jan 9, 2024
1 parent 9d56a81 commit 88234a8
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 20 deletions.
6 changes: 3 additions & 3 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ android {
applicationId = "statusbar.lyric"
minSdk = 26
targetSdk = 34
versionCode = 205
versionName = "6.1.2"
versionCode = 206
versionName = "6.1.3"
aaptOptions.cruncherEnabled = false
aaptOptions.useNewCruncher = false
buildConfigField("long", "BUILD_TIME", "$buildTime")
Expand Down Expand Up @@ -58,7 +58,7 @@ android {
}
}
buildFeatures {
viewBinding = true
viewBinding = false
}
applicationVariants.all {
outputs.all {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ class ExtendPage : BasePage() {
TextSw(textId = R.string.hide_notification_icon, key = "hideNotificationIcon", onClickListener = { changeConfig() })
TextSSw(textId = R.string.limit_visibility_change, tipsId = R.string.limit_visibility_change_tips, key = "limitVisibilityChange")
TextSw(textId = R.string.hide_lyric_when_lock_screen, key = "hideLyricWhenLockScreen", defValue = true)
TextSw(textId = R.string.hide_carrier, key = "hideCarrier")
val lyricColorScheme: LinkedHashMap<Int, String> = LinkedHashMap<Int, String>().apply {
this[0] = getString(R.string.color_scheme1)
this[1] = getString(R.string.color_scheme2)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package statusbar.lyric.activity.page

import android.os.Build
import cn.fkj233.ui.activity.annotation.BMPage
import cn.fkj233.ui.activity.data.BasePage
import statusbar.lyric.R
Expand All @@ -11,6 +12,7 @@ class SystemSpecialPage : BasePage() {
if (isMIUI) {
TextSw(textId = R.string.miui_hide_network_speed, key = "mMIUIHideNetworkSpeed")
TextSw(textId = R.string.miui_pad_optimize, key = "mMiuiPadOptimize")
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.TIRAMISU) TextSw(textId = R.string.hide_carrier, key = "hideCarrier")
}
Line()
TitleText("Wait for More...")
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/java/statusbar/lyric/config/Config.kt
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,8 @@ class Config {
this["com.tencent.qqmusic"] = qQMusicIcon
this["com.miui.player"] = miPlayerIcon
this["com.netease.cloudmusic"] = neteaseIcon
this["com.netease.cloudmusic.lite"] = neteaseIcon
this["com.hihonor.cloudmusic"] = neteaseIcon
this["com.kugou.android"] = kuGouIcon
this["com.kugou.android.lite"] = kuGouIcon
this["cn.kuwo.player"] = kuWoIcon
Expand Down
76 changes: 61 additions & 15 deletions app/src/main/java/statusbar/lyric/hook/app/SystemUILyric.kt
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ class SystemUILyric : BaseHook() {
private var isHiding: Boolean = false
private var themeMode: Int by observableChange(0) { oldValue, _ ->
if (oldValue == 0) return@observableChange
"onConfigurationChanged".log()
canLoad = true
hideLyric()
}
Expand Down Expand Up @@ -169,7 +170,7 @@ class SystemUILyric : BaseHook() {

private lateinit var mMIUINetworkSpeedView: TextView

val isReally by lazy { this@SystemUILyric::targetView.isInitialized }
val isReally by lazy { this@SystemUILyric::clockView.isInitialized }

//////////////////////////////Hook//////////////////////////////////////
@SuppressLint("DiscouragedApi")
Expand Down Expand Up @@ -211,8 +212,7 @@ class SystemUILyric : BaseHook() {
}
}
}

"${moduleRes.getString(R.string.lyric_color_scheme)}:${moduleRes.getString(R.string.lyric_color_scheme)}".log()
"${moduleRes.getString(R.string.lyric_color_scheme)}:${config.lyricColorScheme}".log()
when (config.lyricColorScheme) {
0 -> {
loadClassOrNull("com.android.systemui.statusbar.phone.DarkIconDispatcherImpl").isNotNull {
Expand Down Expand Up @@ -243,21 +243,31 @@ class SystemUILyric : BaseHook() {
if (config.hideNotificationIcon) {
moduleRes.getString(R.string.hide_notification_icon).log()
loadClassOrNull("com.android.systemui.statusbar.phone.NotificationIconAreaController").isNotNull {
it.methodFinder().filterByName("initializeNotificationAreaViews").first().createHook {
after { hookParam ->
val clazz = hookParam.thisObject::class.java
if (clazz.simpleName == "NotificationIconAreaController") {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
it.constructorFinder().first().createHook {
after { hookParam ->
hookParam.thisObject.objectHelper {
mNotificationIconArea = this.getObjectOrNullAs<View>("mNotificationIconArea")!!
}
} else {
mNotificationIconArea = clazz.superclass.getField("mNotificationIconArea").get(hookParam.thisObject) as View
}
}
} else {
it.methodFinder().filterByName("initializeNotificationAreaViews").first().createHook {
after { hookParam ->
val clazz = hookParam.thisObject::class.java
if (clazz.simpleName == "NotificationIconAreaController") {
hookParam.thisObject.objectHelper {
mNotificationIconArea = this.getObjectOrNullAs<View>("mNotificationIconArea")!!
}
} else {
mNotificationIconArea = clazz.superclass.getField("mNotificationIconArea").get(hookParam.thisObject) as View
}
}
}
}
}
}
if (config.hideCarrier) {
if (config.hideCarrier && Build.VERSION.SDK_INT <= Build.VERSION_CODES.TIRAMISU) {
moduleRes.getString(R.string.hide_carrier).log()
loadClassOrNull("com.android.systemui.statusbar.phone.KeyguardStatusBarView").isNotNull {
it.methodFinder().filterByName("onFinishInflate").first().createHook {
Expand All @@ -268,7 +278,7 @@ class SystemUILyric : BaseHook() {
mCarrierLabel = this.getObjectOrNullAs<View>("mCarrierLabel")!!
}
} else {
mCarrierLabel = clazz.superclass.getField("mCarrierLabel").get(hookParam.thisObject) as TextView
mCarrierLabel = clazz.superclass.getField("mCarrierLabel").get(hookParam.thisObject) as View
}
}
}
Expand Down Expand Up @@ -566,9 +576,39 @@ class SystemUILyric : BaseHook() {
}).roundToInt()
}

private fun Class<*>.hasMethod(methodName: String): Boolean {
val methods = declaredMethods
for (method in methods) {
if (method.name == methodName) {
return true
}
}
return false
}

inner class SystemUISpecial {
init {
if (isMIUI) {
for (i in 0..10) {
val clazz = loadClassOrNull("com.android.keyguard.wallpaper.MiuiKeyguardWallPaperManager\$$i")
if (clazz.isNotNull()) {
if (clazz!!.hasMethod("onWallpaperChanged")) {
clazz.methodFinder().filterByName("onWallpaperChanged").first().createHook {
after {
if (this@SystemUILyric::clockView.isInitialized) {
"onWallpaperChanged".log()
canLoad = true
hideLyric()
}
}
}
}
break
}
}
}


if (togglePrompts) {
loadClassOrNull("com.android.systemui.SystemUIApplication").isNotNull { clazz ->
clazz.methodFinder().filterByName("onConfigurationChanged").first().createHook {
Expand All @@ -583,10 +623,16 @@ class SystemUILyric : BaseHook() {
after {
if (isPad) {
loadClassOrNull("com.android.systemui.statusbar.phone.MiuiCollapsedStatusBarFragment").isNotNull {
it.methodFinder().filterByName("initMiuiViewsOnViewCreated").first().createHook {
after { hookParam ->
hookParam.thisObject.objectHelper {
mPadClockView = this.getObjectOrNullAs<View>("mPadClockView")!!
if (it.hasMethod("initMiuiViewsOnViewCreated")) {
it.methodFinder().filterByName("initMiuiViewsOnViewCreated").first()
} else {
it.methodFinder().filterByName("onViewCreated").first()
}.let { method ->
method.createHook {
after { hookParam ->
hookParam.thisObject.objectHelper {
mPadClockView = this.getObjectOrNullAs<View>("mPadClockView")!!
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ buildscript {
mavenCentral()
}
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.22")
classpath("com.android.tools.build:gradle:8.1.3")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.20")
}
}

Expand Down

0 comments on commit 88234a8

Please sign in to comment.