修复部分版本下拉时钟变小

This commit is contained in:
LittleTurtle2333
2022-03-26 14:22:36 +08:00
parent a7947d5a2f
commit c91a46cabb

View File

@@ -38,11 +38,17 @@ class StatusBarTimeCustomization : IXposedHookLoadPackage {
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
if (isOpen) {
var c: Context? = null
val miuiClockClass = "com.android.systemui.statusbar.views.MiuiClock".findClass(lpparam.classLoader)
miuiClockClass.hookAfterConstructor(Context::class.java, AttributeSet::class.java, Integer.TYPE) {
val miuiClockClass =
"com.android.systemui.statusbar.views.MiuiClock".findClass(lpparam.classLoader)
miuiClockClass.hookAfterConstructor(
Context::class.java,
AttributeSet::class.java,
Integer.TYPE
) {
try {
c = it.args[0] as Context
val textV = it.thisObject as TextView
if (textV.resources.getResourceEntryName(textV.id) != "clock") return@hookAfterConstructor
textV.isSingleLine = false
if (isDoubleLine) {
str = "\n"
@@ -68,7 +74,6 @@ class StatusBarTimeCustomization : IXposedHookLoadPackage {
Handler(textV.context.mainLooper).post(r)
}
}
if (textV.resources.getResourceEntryName(textV.id) == "clock")
Timer().scheduleAtFixedRate(T(), 1000 - System.currentTimeMillis() % 1000, 1000)
} catch (e: java.lang.Exception) {
}
@@ -77,7 +82,10 @@ class StatusBarTimeCustomization : IXposedHookLoadPackage {
try {
val textV = it.thisObject as TextView
if (textV.resources.getResourceEntryName(textV.id) == "clock") {
val t = Settings.System.getString(c!!.contentResolver, Settings.System.TIME_12_24)
val t = Settings.System.getString(
c!!.contentResolver,
Settings.System.TIME_12_24
)
val is24 = t == "24"
now_time = Calendar.getInstance().time
textV.text = getDate(c!!) + str + getTime(c!!, is24)