From 99da21e76227833b26876a8ead818767f6a27b40 Mon Sep 17 00:00:00 2001 From: LittleTurtle2333 Date: Fri, 17 Feb 2023 23:07:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DA13=E6=8E=A7=E5=88=B6?= =?UTF-8?q?=E4=B8=AD=E5=BF=83=E6=97=B6=E9=92=9F=E5=AF=B9=E9=BD=90=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../StatusBarTimeCustomizationForT.kt | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/com/lt2333/simplicitytools/hooks/rules/t/systemui/StatusBarTimeCustomizationForT.kt b/app/src/main/java/com/lt2333/simplicitytools/hooks/rules/t/systemui/StatusBarTimeCustomizationForT.kt index 3b458703..5a6cee5d 100644 --- a/app/src/main/java/com/lt2333/simplicitytools/hooks/rules/t/systemui/StatusBarTimeCustomizationForT.kt +++ b/app/src/main/java/com/lt2333/simplicitytools/hooks/rules/t/systemui/StatusBarTimeCustomizationForT.kt @@ -107,9 +107,15 @@ object StatusBarTimeCustomizationForT : HookRegister() { findConstructor("com.android.systemui.statusbar.views.MiuiClock") { paramCount == 3 }.hookAfter { - c = it.args[0] as Context - val textV = it.thisObject as TextView - textV.gravity = Gravity.CENTER + try { + val textV = it.thisObject as TextView + 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") { paramCount == 3 }.hookAfter { - c = it.args[0] as Context - val textV = it.thisObject as TextView - textV.gravity = Gravity.CENTER + try { + val textV = it.thisObject as TextView + 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 (isZh) { datePattern += "YY年" -// if (!isHideSpace) datePattern = "$datePattern " } else { datePattern += "YY" if (isMonth || isDay) datePattern += "/" @@ -200,7 +211,6 @@ object StatusBarTimeCustomizationForT : HookRegister() { if (isMonth) { if (isZh) { datePattern += "M月" -// if (!isHideSpace) datePattern = "$datePattern " } else { datePattern += "M" if (isDay) datePattern += "/"