新增状态栏时钟双排显示

This commit is contained in:
乌堆小透明
2022-02-24 23:28:02 +08:00
parent 2ec17c4c68
commit 7deba9f3c3
4 changed files with 22 additions and 4 deletions

View File

@@ -12,8 +12,8 @@ android {
applicationId = "com.lt2333.simplicitytools"
minSdk = 31
targetSdk = 32
versionCode = 19
versionName = "1.1.8"
versionCode = 20
versionName = "1.1.9"
}
buildTypes {

View File

@@ -162,6 +162,12 @@ class SettingsActivity : MIUIActivity() {
SwitchV("status_bar_time_hide_space")
)
)
add(
TextWithSwitchV(
TextV(resId = R.string.status_bar_time_double_line),
SwitchV("status_bar_time_double_line")
)
)
add(LineV())
add(TitleTextV(resId = R.string.status_bar_icon))
add(

View File

@@ -34,6 +34,7 @@ class StatusBarTimeCustomization : IXposedHookLoadPackage {
override fun afterHookedMethod(param: MethodHookParam) {
c = param.args[0] as Context
val textV = param.thisObject as TextView
val d: Method = textV.javaClass.getDeclaredMethod("updateTime")
val r = Runnable {
d.isAccessible = true
@@ -65,8 +66,17 @@ class StatusBarTimeCustomization : IXposedHookLoadPackage {
Settings.System.TIME_12_24
)
now_time = Calendar.getInstance().time
var str = ""
if (XSPUtils.getBoolean("status_bar_time_double_line", false)) {
textV.isSingleLine = false
textV.textSize = 7F
str = "\n"
} else {
textV.isSingleLine = true
textV.textSize = 13.454498F
}
textV.text =
getYear() + getMonth() + getDay() + getDateSpace() + getWeek() + getDoubleHour() + getTime(
getYear() + getMonth() + getDay() + getDateSpace() + getWeek() + str + getDoubleHour() + getTime(
t
) + getSecond()
}
@@ -209,6 +219,7 @@ class StatusBarTimeCustomization : IXposedHookLoadPackage {
} else {
doubleHour += " "
}
}
return doubleHour
}

View File

@@ -68,5 +68,6 @@
<string name="status_bar_time_double_hour">显示时辰</string>
<string name="custom_clock_switch">自定义时钟-总开关</string>
<string name="status_bar_time_period">显示时段</string>
<string name="status_bar_time_double_line">双行显示</string>
</resources>