新增状态栏时钟双排显示

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" applicationId = "com.lt2333.simplicitytools"
minSdk = 31 minSdk = 31
targetSdk = 32 targetSdk = 32
versionCode = 19 versionCode = 20
versionName = "1.1.8" versionName = "1.1.9"
} }
buildTypes { buildTypes {

View File

@@ -162,6 +162,12 @@ class SettingsActivity : MIUIActivity() {
SwitchV("status_bar_time_hide_space") 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(LineV())
add(TitleTextV(resId = R.string.status_bar_icon)) add(TitleTextV(resId = R.string.status_bar_icon))
add( add(

View File

@@ -34,6 +34,7 @@ class StatusBarTimeCustomization : IXposedHookLoadPackage {
override fun afterHookedMethod(param: MethodHookParam) { override fun afterHookedMethod(param: MethodHookParam) {
c = param.args[0] as Context c = param.args[0] as Context
val textV = param.thisObject as TextView val textV = param.thisObject as TextView
val d: Method = textV.javaClass.getDeclaredMethod("updateTime") val d: Method = textV.javaClass.getDeclaredMethod("updateTime")
val r = Runnable { val r = Runnable {
d.isAccessible = true d.isAccessible = true
@@ -64,9 +65,18 @@ class StatusBarTimeCustomization : IXposedHookLoadPackage {
c!!.contentResolver, c!!.contentResolver,
Settings.System.TIME_12_24 Settings.System.TIME_12_24
) )
now_time= Calendar.getInstance().time 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 = textV.text =
getYear() + getMonth() + getDay() + getDateSpace() + getWeek() + getDoubleHour() + getTime( getYear() + getMonth() + getDay() + getDateSpace() + getWeek() + str + getDoubleHour() + getTime(
t t
) + getSecond() ) + getSecond()
} }
@@ -209,6 +219,7 @@ class StatusBarTimeCustomization : IXposedHookLoadPackage {
} else { } else {
doubleHour += " " doubleHour += " "
} }
} }
return doubleHour return doubleHour
} }

View File

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