修复A13控制中心时钟对齐问题

This commit is contained in:
LittleTurtle2333
2023-02-17 23:07:44 +08:00
parent 8fe9d09624
commit 99da21e762

View File

@@ -107,9 +107,15 @@ object StatusBarTimeCustomizationForT : HookRegister() {
findConstructor("com.android.systemui.statusbar.views.MiuiClock") { findConstructor("com.android.systemui.statusbar.views.MiuiClock") {
paramCount == 3 paramCount == 3
}.hookAfter { }.hookAfter {
c = it.args[0] as Context try {
val textV = it.thisObject as TextView val textV = it.thisObject as TextView
textV.gravity = Gravity.CENTER if (textV.resources.getResourceEntryName(textV.id) == "clock") {
c = it.args[0] as Context
val textV = it.thisObject as TextView
textV.gravity = Gravity.CENTER
}
} catch (_: Exception) {
}
} }
} }
} }
@@ -174,9 +180,15 @@ object StatusBarTimeCustomizationForT : HookRegister() {
findConstructor("com.android.systemui.statusbar.views.MiuiClock") { findConstructor("com.android.systemui.statusbar.views.MiuiClock") {
paramCount == 3 paramCount == 3
}.hookAfter { }.hookAfter {
c = it.args[0] as Context try {
val textV = it.thisObject as TextView val textV = it.thisObject as TextView
textV.gravity = Gravity.CENTER if (textV.resources.getResourceEntryName(textV.id) == "clock") {
c = it.args[0] as Context
val textV = it.thisObject as TextView
textV.gravity = Gravity.CENTER
}
} catch (_: Exception) {
}
} }
} }
} }
@@ -191,7 +203,6 @@ object StatusBarTimeCustomizationForT : HookRegister() {
if (isYear) { if (isYear) {
if (isZh) { if (isZh) {
datePattern += "YY年" datePattern += "YY年"
// if (!isHideSpace) datePattern = "$datePattern "
} else { } else {
datePattern += "YY" datePattern += "YY"
if (isMonth || isDay) datePattern += "/" if (isMonth || isDay) datePattern += "/"
@@ -200,7 +211,6 @@ object StatusBarTimeCustomizationForT : HookRegister() {
if (isMonth) { if (isMonth) {
if (isZh) { if (isZh) {
datePattern += "M月" datePattern += "M月"
// if (!isHideSpace) datePattern = "$datePattern "
} else { } else {
datePattern += "M" datePattern += "M"
if (isDay) datePattern += "/" if (isDay) datePattern += "/"