Compare commits

17 Commits

Author SHA1 Message Date
乌堆小透明
91c3b8311b New translations strings.xml (Portuguese)
[ci skip] New translations from Crowdin
2022-06-29 19:05:28 +08:00
乌堆小透明
a414e2a9c8 New translations strings.xml (Chinese Traditional)
[ci skip] New translations from Crowdin
2022-06-29 19:05:17 +08:00
乌堆小透明
73325ee306 New translations strings.xml (Portuguese, Brazilian)
[ci skip] New translations from Crowdin
2022-06-29 19:05:12 +08:00
乌堆小透明
a9d43e9977 New translations strings.xml (Romanian)
[ci skip] New translations from Crowdin
2022-06-29 19:05:07 +08:00
乌堆小透明
a0e0741924 New translations strings.xml (Portuguese)
[ci skip] New translations from Crowdin
2022-06-29 16:58:33 +08:00
乌堆小透明
a38d9c661c New translations strings.xml (Chinese Simplified)
[ci skip] New translations from Crowdin
2022-06-29 16:58:23 +08:00
乌堆小透明
422189b16e New translations strings.xml (Portuguese, Brazilian)
[ci skip] New translations from Crowdin
2022-06-29 16:58:17 +08:00
乌堆小透明
12726a5831 New translations strings.xml (Romanian)
[ci skip] New translations from Crowdin
2022-06-29 16:58:14 +08:00
乌堆小透明
999f9a088f New translations strings.xml (Portuguese)
[ci skip] New translations from Crowdin
2022-06-29 16:56:52 +08:00
乌堆小透明
49c293d30d New translations strings.xml (Portuguese, Brazilian)
[ci skip] New translations from Crowdin
2022-06-29 16:56:34 +08:00
LittleTurtle2333
87a8059a06 更新Strings.xml 2022-06-29 16:55:56 +08:00
乌堆小透明
8e85c34db3 Merge pull request #174
* New translations strings.xml (Vietnamese)

* New translations strings.xml (Vietnamese)

* New translations strings.xml (Vietnamese)

* New translations strings.xml (Portuguese, Brazilian)

* New translations strings.xml (Portuguese)

* New translations strings.xml (Portuguese, Brazilian)

* New translations strings.xml (Chinese Simplified)

* New translations strings.xml (Portuguese)
2022-06-29 16:52:43 +08:00
LittleTurtle2333
72ad0479df 更新时钟自定义极客模式 2022-06-29 16:44:19 +08:00
LittleTurtle2333
479251fb67 更新居中挖孔兼容模式(网速右显) 2022-06-29 16:43:58 +08:00
LittleTurtle2333
dec3bc0a42 更新功能界面 2022-06-29 16:43:27 +08:00
LittleTurtle2333
32f2fc7215 更新blockmiui版本 2022-06-29 16:37:10 +08:00
YuKongA
4246e2910e 修复 截图无限裁切 功能导致的崩溃问题 (#172)
* 同时更新依赖
* 允许应用横屏
2022-06-28 00:51:43 +08:00
12 changed files with 410 additions and 183 deletions

View File

@@ -6,12 +6,12 @@ plugins {
} }
android { android {
compileSdk = 32 compileSdk = 33
buildToolsVersion = "32.0.0" buildToolsVersion = "33.0.0"
defaultConfig { defaultConfig {
applicationId = "com.lt2333.simplicitytools" applicationId = "com.lt2333.simplicitytools"
minSdk = 31 minSdk = 31
targetSdk = 32 targetSdk = 33
versionCode = 67 versionCode = 67
versionName = "1.6.6" versionName = "1.6.6"
} }

View File

@@ -13,7 +13,6 @@
<activity <activity
android:name=".activity.SettingsActivity" android:name=".activity.SettingsActivity"
android:exported="true" android:exported="true"
android:screenOrientation="portrait"
android:launchMode="singleTop"> android:launchMode="singleTop">
<intent-filter> <intent-filter>
<action android:name="android.intent.action.MAIN" /> <action android:name="android.intent.action.MAIN" />

View File

@@ -93,7 +93,7 @@ class SettingsActivity : MIUIActivity() {
}) })
) )
Line() Line()
TitleText(resId = R.string.scope) TitleText(textId = R.string.scope)
TextSummaryArrow( TextSummaryArrow(
TextSummaryV( TextSummaryV(
textId = R.string.scope_systemui, textId = R.string.scope_systemui,
@@ -116,7 +116,7 @@ class SettingsActivity : MIUIActivity() {
) )
) )
Line() Line()
TitleText(resId = R.string.about) TitleText(textId = R.string.about)
TextSummaryArrow( TextSummaryArrow(
TextSummaryV( TextSummaryV(
textId = R.string.about_module, textId = R.string.about_module,
@@ -127,14 +127,14 @@ class SettingsActivity : MIUIActivity() {
} }
register("scope_systemui", getString(R.string.scope_systemui), false) { register("scope_systemui", getString(R.string.scope_systemui), false) {
TitleText(resId = R.string.statusbar) TitleText(textId = R.string.statusbar)
TextSummaryWithSwitch( TextSummaryWithSwitch(
TextSummaryV( TextSummaryV(
textId = R.string.double_tap_to_sleep textId = R.string.double_tap_to_sleep
), SwitchV("status_bar_double_tap_to_sleep") ), SwitchV("status_bar_double_tap_to_sleep")
) )
Line() Line()
TitleText(resId = R.string.status_bar_layout) TitleText(textId = R.string.status_bar_layout)
val statusBarLayoutMode: HashMap<Int, String> = hashMapOf<Int, String>().also { val statusBarLayoutMode: HashMap<Int, String> = hashMapOf<Int, String>().also {
it[0] = getString(R.string.default1) it[0] = getString(R.string.default1)
it[1] = getString(R.string.clock_center) it[1] = getString(R.string.clock_center)
@@ -142,7 +142,7 @@ class SettingsActivity : MIUIActivity() {
it[3] = getString(R.string.clock_center_and_icon_left) it[3] = getString(R.string.clock_center_and_icon_left)
} }
TextWithSpinner( TextWithSpinner(
TextV(resId = R.string.status_bar_layout_mode), TextV(textId = R.string.status_bar_layout_mode),
SpinnerV( SpinnerV(
statusBarLayoutMode[safeSP.getInt( statusBarLayoutMode[safeSP.getInt(
"status_bar_layout_mode", "status_bar_layout_mode",
@@ -163,10 +163,11 @@ class SettingsActivity : MIUIActivity() {
} }
} }
) )
val layoutCompatibilityModeBinding = GetDataBinding( val layoutCompatibilityModeBinding = GetDataBinding(
object : DefValue { object : DefValue {
override fun getValue(): Any { override fun getValue(): Any {
return safeSP.getBoolean("layout_compatibility_mode", false) return safeSP.getInt("screen_hole_location", 0)==2
} }
} }
) { view, flags, data -> ) { view, flags, data ->
@@ -175,18 +176,37 @@ class SettingsActivity : MIUIActivity() {
2 -> view.visibility = if (data as Boolean) View.VISIBLE else View.GONE 2 -> view.visibility = if (data as Boolean) View.VISIBLE else View.GONE
} }
} }
TextSummaryWithSwitch(
TextSummaryV( val screenHoleLocation: HashMap<Int, String> = hashMapOf<Int, String>().also {
textId = R.string.layout_compatibility_mode, it[0] = getString(R.string.off)
tipsId = R.string.layout_compatibility_mode_summary it[1] = getString(R.string.center)
), it[2] = getString(R.string.left_or_right)
SwitchV( }
"layout_compatibility_mode", TextSummaryWithSpinner(
dataBindingSend = layoutCompatibilityModeBinding.bindingSend TextSummaryV(textId = R.string.layout_compatibility_mode, tipsId = R.string.screen_hole_location),
) SpinnerV(
screenHoleLocation[safeSP.getInt(
"screen_hole_location",
0
)].toString()
) {
add(screenHoleLocation[0].toString()) {
safeSP.putAny("screen_hole_location", 0)
layoutCompatibilityModeBinding.binding.Send().send(false)
}
add(screenHoleLocation[1].toString()) {
safeSP.putAny("screen_hole_location", 1)
layoutCompatibilityModeBinding.binding.Send().send(false)
}
add(screenHoleLocation[2].toString()) {
safeSP.putAny("screen_hole_location", 2)
layoutCompatibilityModeBinding.binding.Send().send(true)
}
}
) )
Text( Text(
resId = R.string.left_margin, textId = R.string.left_margin,
dataBindingRecv = layoutCompatibilityModeBinding.binding.getRecv(2) dataBindingRecv = layoutCompatibilityModeBinding.binding.getRecv(2)
) )
SeekBarWithText( SeekBarWithText(
@@ -197,7 +217,7 @@ class SettingsActivity : MIUIActivity() {
dataBindingRecv = layoutCompatibilityModeBinding.binding.getRecv(2) dataBindingRecv = layoutCompatibilityModeBinding.binding.getRecv(2)
) )
Text( Text(
resId = R.string.right_margin, textId = R.string.right_margin,
dataBindingRecv = layoutCompatibilityModeBinding.binding.getRecv(2) dataBindingRecv = layoutCompatibilityModeBinding.binding.getRecv(2)
) )
SeekBarWithText( SeekBarWithText(
@@ -208,10 +228,12 @@ class SettingsActivity : MIUIActivity() {
dataBindingRecv = layoutCompatibilityModeBinding.binding.getRecv(2) dataBindingRecv = layoutCompatibilityModeBinding.binding.getRecv(2)
) )
Line() Line()
TitleText(resId = R.string.status_bar_clock_format) TitleText(textId = R.string.status_bar_clock_format)
val customClockBinding = GetDataBinding(object : DefValue {
val customClockPresetBinding = GetDataBinding(object : DefValue {
override fun getValue(): Any { override fun getValue(): Any {
return safeSP.getBoolean("custom_clock_switch", false) return safeSP.getInt("custom_clock_mode", 0)==1
} }
}) { view, flags, data -> }) { view, flags, data ->
when (flags) { when (flags) {
@@ -219,81 +241,170 @@ class SettingsActivity : MIUIActivity() {
2 -> view.visibility = if (data as Boolean) View.VISIBLE else View.GONE 2 -> view.visibility = if (data as Boolean) View.VISIBLE else View.GONE
} }
} }
TextWithSwitch(
TextV(resId = R.string.custom_clock_switch, colorId = R.color.purple_700), val customClockGeekBinding = GetDataBinding(object : DefValue {
SwitchV( override fun getValue(): Any {
"custom_clock_switch", return safeSP.getInt("custom_clock_mode", 0)==2
dataBindingSend = customClockBinding.bindingSend }
) }) { view, flags, data ->
when (flags) {
1 -> (view as Switch).isEnabled = data as Boolean
2 -> view.visibility = if (data as Boolean) View.VISIBLE else View.GONE
}
}
val customClockMode: HashMap<Int, String> = hashMapOf<Int, String>().also {
it[0] = getString(R.string.off)
it[1] = getString(R.string.preset)
it[2] = getString(R.string.geek)
}
TextWithSpinner(
TextV(textId = R.string.custom_clock_mode),
SpinnerV(
customClockMode[safeSP.getInt(
"custom_clock_mode",
0
)].toString()
) {
add(customClockMode[0].toString()) {
safeSP.putAny("custom_clock_mode", 0)
customClockPresetBinding.binding.Send().send(false)
customClockGeekBinding.binding.Send().send(false)
}
add(customClockMode[1].toString()) {
safeSP.putAny("custom_clock_mode", 1)
customClockPresetBinding.binding.Send().send(true)
customClockGeekBinding.binding.Send().send(false)
}
add(customClockMode[2].toString()) {
safeSP.putAny("custom_clock_mode", 2)
customClockPresetBinding.binding.Send().send(false)
customClockGeekBinding.binding.Send().send(true)
}
}
) )
//预设模式起始
TextWithSwitch( TextWithSwitch(
TextV(resId = R.string.status_bar_time_year), TextV(textId = R.string.status_bar_time_year),
SwitchV("status_bar_time_year"), SwitchV("status_bar_time_year"),
dataBindingRecv = customClockBinding.binding.getRecv(2) dataBindingRecv = customClockPresetBinding.binding.getRecv(2)
) )
TextWithSwitch( TextWithSwitch(
TextV(resId = R.string.status_bar_time_month), TextV(textId = R.string.status_bar_time_month),
SwitchV("status_bar_time_month"), SwitchV("status_bar_time_month"),
dataBindingRecv = customClockBinding.binding.getRecv(2) dataBindingRecv = customClockPresetBinding.binding.getRecv(2)
) )
TextWithSwitch( TextWithSwitch(
TextV(resId = R.string.status_bar_time_day), TextV(textId = R.string.status_bar_time_day),
SwitchV("status_bar_time_day"), SwitchV("status_bar_time_day"),
dataBindingRecv = customClockBinding.binding.getRecv(2) dataBindingRecv = customClockPresetBinding.binding.getRecv(2)
) )
TextWithSwitch( TextWithSwitch(
TextV(resId = R.string.status_bar_time_week), TextV(textId = R.string.status_bar_time_week),
SwitchV("status_bar_time_week"), SwitchV("status_bar_time_week"),
dataBindingRecv = customClockBinding.binding.getRecv(2) dataBindingRecv = customClockPresetBinding.binding.getRecv(2)
) )
TextWithSwitch( TextWithSwitch(
TextV(resId = R.string.status_bar_time_double_hour), TextV(textId = R.string.status_bar_time_double_hour),
SwitchV("status_bar_time_double_hour"), SwitchV("status_bar_time_double_hour"),
dataBindingRecv = customClockBinding.binding.getRecv(2) dataBindingRecv = customClockPresetBinding.binding.getRecv(2)
) )
TextWithSwitch( TextWithSwitch(
TextV(resId = R.string.status_bar_time_period), TextV(textId = R.string.status_bar_time_period),
SwitchV("status_bar_time_period", true), SwitchV("status_bar_time_period", true),
dataBindingRecv = customClockBinding.binding.getRecv(2) dataBindingRecv = customClockPresetBinding.binding.getRecv(2)
) )
TextWithSwitch( TextWithSwitch(
TextV(resId = R.string.status_bar_time_seconds), TextV(textId = R.string.status_bar_time_seconds),
SwitchV("status_bar_time_seconds"), SwitchV("status_bar_time_seconds"),
dataBindingRecv = customClockBinding.binding.getRecv(2) dataBindingRecv = customClockPresetBinding.binding.getRecv(2)
) )
TextWithSwitch( TextWithSwitch(
TextV(resId = R.string.status_bar_time_hide_space), TextV(textId = R.string.status_bar_time_hide_space),
SwitchV("status_bar_time_hide_space"), SwitchV("status_bar_time_hide_space"),
dataBindingRecv = customClockBinding.binding.getRecv(2) dataBindingRecv = customClockPresetBinding.binding.getRecv(2)
) )
TextWithSwitch( TextWithSwitch(
TextV(resId = R.string.status_bar_time_double_line), TextV(textId = R.string.status_bar_time_double_line),
SwitchV("status_bar_time_double_line"), SwitchV("status_bar_time_double_line"),
dataBindingRecv = customClockBinding.binding.getRecv(2) dataBindingRecv = customClockPresetBinding.binding.getRecv(2)
) )
TextWithSwitch( TextWithSwitch(
TextV(resId = R.string.status_bar_time_double_line_center_align), TextV(textId = R.string.status_bar_time_double_line_center_align),
SwitchV("status_bar_time_double_line_center_align"), SwitchV("status_bar_time_double_line_center_align"),
dataBindingRecv = customClockBinding.binding.getRecv(2) dataBindingRecv = customClockPresetBinding.binding.getRecv(2)
) )
Text( Text(
resId = R.string.status_bar_clock_size, textId = R.string.status_bar_clock_size,
dataBindingRecv = customClockBinding.binding.getRecv(2) dataBindingRecv = customClockPresetBinding.binding.getRecv(2)
) )
SeekBarWithText( SeekBarWithText(
"status_bar_clock_size", 0, 18, 0, "status_bar_clock_size", 0, 18, 0,
dataBindingRecv = customClockBinding.binding.getRecv(2) dataBindingRecv = customClockPresetBinding.binding.getRecv(2)
) )
Text( Text(
resId = R.string.status_bar_clock_double_line_size, textId = R.string.status_bar_clock_double_line_size,
dataBindingRecv = customClockBinding.binding.getRecv(2) dataBindingRecv = customClockPresetBinding.binding.getRecv(2)
) )
SeekBarWithText( SeekBarWithText(
"status_bar_clock_double_line_size", 0, 9, 0, "status_bar_clock_double_line_size", 0, 9, 0,
dataBindingRecv = customClockBinding.binding.getRecv(2) dataBindingRecv = customClockPresetBinding.binding.getRecv(2)
) )
//预设模式结束
//极客模式起始
TextSummaryArrow(
TextSummaryV(
textId = R.string.custom_clock_format_geek
) {
MIUIDialog(activity) {
setTitle(R.string.custom_clock_format_geek)
setEditText(
safeSP.getString(
"custom_clock_format_geek", "HH:mm:ss"
),
""
)
setLButton(textId = R.string.cancel) {
dismiss()
}
setRButton(textId = R.string.Done) {
if (getEditText().isNotEmpty()) {
try {
safeSP.putAny("custom_clock_format_geek", getEditText())
dismiss()
return@setRButton
} catch (_: Throwable) {
}
}
Toast.makeText(
activity,
R.string.input_error,
Toast.LENGTH_SHORT
).show()
}
}.show()
}, dataBindingRecv = customClockGeekBinding.binding.getRecv(2)
)
TextWithSwitch(
TextV(textId = R.string.status_bar_time_double_line_center_align),
SwitchV("status_bar_time_center_align_geek"),
dataBindingRecv = customClockGeekBinding.binding.getRecv(2)
)
Text(
textId = R.string.status_bar_clock_size,
dataBindingRecv = customClockGeekBinding.binding.getRecv(2)
)
SeekBarWithText(
"status_bar_clock_size_geek", 0, 18, 0,
dataBindingRecv = customClockGeekBinding.binding.getRecv(2)
)
//极客模式结束
Line() Line()
TitleText(resId = R.string.status_bar_icon) TitleText(textId = R.string.status_bar_icon)
TextSummaryArrow( TextSummaryArrow(
TextSummaryV( TextSummaryV(
textId = R.string.hide_icon, textId = R.string.hide_icon,
@@ -301,7 +412,7 @@ class SettingsActivity : MIUIActivity() {
) )
) )
TextWithSwitch( TextWithSwitch(
TextV(resId = R.string.show_wifi_standard), TextV(textId = R.string.show_wifi_standard),
SwitchV("show_wifi_standard") SwitchV("show_wifi_standard")
) )
val customMobileTypeTextBinding = GetDataBinding(object : DefValue { val customMobileTypeTextBinding = GetDataBinding(object : DefValue {
@@ -499,7 +610,7 @@ class SettingsActivity : MIUIActivity() {
}, dataBindingRecv = bigMobileTypeIconBinding.binding.getRecv(2) }, dataBindingRecv = bigMobileTypeIconBinding.binding.getRecv(2)
) )
Text( Text(
resId = R.string.maximum_number_of_notification_icons textId = R.string.maximum_number_of_notification_icons
) )
SeekBarWithText( SeekBarWithText(
"maximum_number_of_notification_icons", "maximum_number_of_notification_icons",
@@ -508,7 +619,7 @@ class SettingsActivity : MIUIActivity() {
3 3
) )
Text( Text(
resId = R.string.maximum_number_of_notification_dots textId = R.string.maximum_number_of_notification_dots
) )
SeekBarWithText( SeekBarWithText(
"maximum_number_of_notification_dots", "maximum_number_of_notification_dots",
@@ -555,7 +666,7 @@ class SettingsActivity : MIUIActivity() {
SwitchV("hide_battery_percentage_icon") SwitchV("hide_battery_percentage_icon")
) )
Line() Line()
TitleText(resId = R.string.status_bar_network_speed) TitleText(textId = R.string.status_bar_network_speed)
TextSummaryWithSwitch( TextSummaryWithSwitch(
TextSummaryV( TextSummaryV(
textId = R.string.status_bar_network_speed_refresh_speed, textId = R.string.status_bar_network_speed_refresh_speed,
@@ -571,7 +682,7 @@ class SettingsActivity : MIUIActivity() {
SwitchV("hide_status_bar_network_speed_second") SwitchV("hide_status_bar_network_speed_second")
) )
TextWithSwitch( TextWithSwitch(
TextV(resId = R.string.hide_network_speed_splitter), TextV(textId = R.string.hide_network_speed_splitter),
SwitchV("hide_network_speed_splitter") SwitchV("hide_network_speed_splitter")
) )
val statusBarDualRowNetworkSpeedBinding = GetDataBinding(object : DefValue { val statusBarDualRowNetworkSpeedBinding = GetDataBinding(object : DefValue {
@@ -598,7 +709,7 @@ class SettingsActivity : MIUIActivity() {
align[0] = getString(R.string.left) align[0] = getString(R.string.left)
align[1] = getString(R.string.right) align[1] = getString(R.string.right)
TextWithSpinner( TextWithSpinner(
TextV(resId = R.string.status_bar_network_speed_dual_row_gravity), TextV(textId = R.string.status_bar_network_speed_dual_row_gravity),
SpinnerV( SpinnerV(
align[safeSP.getInt( align[safeSP.getInt(
"status_bar_network_speed_dual_row_gravity", "status_bar_network_speed_dual_row_gravity",
@@ -616,7 +727,7 @@ class SettingsActivity : MIUIActivity() {
dataBindingRecv = statusBarDualRowNetworkSpeedBinding.binding.getRecv(2) dataBindingRecv = statusBarDualRowNetworkSpeedBinding.binding.getRecv(2)
) )
TextWithSpinner( TextWithSpinner(
TextV(resId = R.string.status_bar_network_speed_dual_row_icon), TextV(textId = R.string.status_bar_network_speed_dual_row_icon),
SpinnerV( SpinnerV(
safeSP.getString( safeSP.getString(
"status_bar_network_speed_dual_row_icon", "status_bar_network_speed_dual_row_icon",
@@ -641,7 +752,7 @@ class SettingsActivity : MIUIActivity() {
} }
) )
Text( Text(
resId = R.string.status_bar_network_speed_dual_row_size, textId = R.string.status_bar_network_speed_dual_row_size,
dataBindingRecv = statusBarDualRowNetworkSpeedBinding.binding.getRecv(2) dataBindingRecv = statusBarDualRowNetworkSpeedBinding.binding.getRecv(2)
) )
SeekBarWithText( SeekBarWithText(
@@ -652,7 +763,7 @@ class SettingsActivity : MIUIActivity() {
dataBindingRecv = statusBarDualRowNetworkSpeedBinding.binding.getRecv(2) dataBindingRecv = statusBarDualRowNetworkSpeedBinding.binding.getRecv(2)
) )
Line() Line()
TitleText(resId = R.string.notification_center) TitleText(textId = R.string.notification_center)
val showWeatherMainSwitchBinding = GetDataBinding(object : DefValue { val showWeatherMainSwitchBinding = GetDataBinding(object : DefValue {
override fun getValue(): Any { override fun getValue(): Any {
return safeSP.getBoolean("notification_weather", false) return safeSP.getBoolean("notification_weather", false)
@@ -687,7 +798,7 @@ class SettingsActivity : MIUIActivity() {
SwitchV("can_notification_slide"), SwitchV("can_notification_slide"),
) )
Line() Line()
TitleText(resId = R.string.control_center) TitleText(textId = R.string.control_center)
val controlCenterWeatherBinding = GetDataBinding(object : DefValue { val controlCenterWeatherBinding = GetDataBinding(object : DefValue {
override fun getValue(): Any { override fun getValue(): Any {
return safeSP.getBoolean("control_center_weather", false) return safeSP.getBoolean("control_center_weather", false)
@@ -717,7 +828,7 @@ class SettingsActivity : MIUIActivity() {
dataBindingRecv = controlCenterWeatherBinding.binding.getRecv(2) dataBindingRecv = controlCenterWeatherBinding.binding.getRecv(2)
) )
Line() Line()
TitleText(resId = R.string.lock_screen) TitleText(textId = R.string.lock_screen)
TextSummaryWithSwitch( TextSummaryWithSwitch(
TextSummaryV( TextSummaryV(
textId = R.string.lock_screen_clock_display_seconds, textId = R.string.lock_screen_clock_display_seconds,
@@ -759,7 +870,7 @@ class SettingsActivity : MIUIActivity() {
), SwitchV("lock_screen_double_tap_to_sleep") ), SwitchV("lock_screen_double_tap_to_sleep")
) )
Line() Line()
TitleText(resId = R.string.old_quick_settings_panel) TitleText(textId = R.string.old_quick_settings_panel)
val oldQSCustomSwitchBinding = GetDataBinding(object : DefValue { val oldQSCustomSwitchBinding = GetDataBinding(object : DefValue {
override fun getValue(): Any { override fun getValue(): Any {
return safeSP.getBoolean("old_qs_custom_switch", false) return safeSP.getBoolean("old_qs_custom_switch", false)
@@ -781,7 +892,7 @@ class SettingsActivity : MIUIActivity() {
) )
) )
Text( Text(
resId = R.string.qs_custom_rows, textId = R.string.qs_custom_rows,
dataBindingRecv = oldQSCustomSwitchBinding.binding.getRecv(2) dataBindingRecv = oldQSCustomSwitchBinding.binding.getRecv(2)
) )
SeekBarWithText( SeekBarWithText(
@@ -792,7 +903,7 @@ class SettingsActivity : MIUIActivity() {
dataBindingRecv = oldQSCustomSwitchBinding.binding.getRecv(2) dataBindingRecv = oldQSCustomSwitchBinding.binding.getRecv(2)
) )
Text( Text(
resId = R.string.qs_custom_rows_horizontal, textId = R.string.qs_custom_rows_horizontal,
dataBindingRecv = oldQSCustomSwitchBinding.binding.getRecv(2) dataBindingRecv = oldQSCustomSwitchBinding.binding.getRecv(2)
) )
SeekBarWithText( SeekBarWithText(
@@ -803,7 +914,7 @@ class SettingsActivity : MIUIActivity() {
dataBindingRecv = oldQSCustomSwitchBinding.binding.getRecv(2) dataBindingRecv = oldQSCustomSwitchBinding.binding.getRecv(2)
) )
Text( Text(
resId = R.string.qs_custom_columns, textId = R.string.qs_custom_columns,
dataBindingRecv = oldQSCustomSwitchBinding.binding.getRecv(2) dataBindingRecv = oldQSCustomSwitchBinding.binding.getRecv(2)
) )
SeekBarWithText( SeekBarWithText(
@@ -814,7 +925,7 @@ class SettingsActivity : MIUIActivity() {
dataBindingRecv = oldQSCustomSwitchBinding.binding.getRecv(2) dataBindingRecv = oldQSCustomSwitchBinding.binding.getRecv(2)
) )
Text( Text(
resId = R.string.qs_custom_columns_unexpanded, textId = R.string.qs_custom_columns_unexpanded,
dataBindingRecv = oldQSCustomSwitchBinding.binding.getRecv(2) dataBindingRecv = oldQSCustomSwitchBinding.binding.getRecv(2)
) )
SeekBarWithText( SeekBarWithText(
@@ -826,7 +937,7 @@ class SettingsActivity : MIUIActivity() {
) )
} }
register("scope_android", getString(R.string.scope_android), false) { register("scope_android", getString(R.string.scope_android), false) {
TitleText(resId = R.string.corepacth) TitleText(textId = R.string.corepacth)
TextSummaryWithSwitch( TextSummaryWithSwitch(
TextSummaryV( TextSummaryV(
@@ -923,7 +1034,7 @@ class SettingsActivity : MIUIActivity() {
SwitchV("allow_untrusted_touches") SwitchV("allow_untrusted_touches")
) )
Line() Line()
TitleText(resId = R.string.sound) TitleText(textId = R.string.sound)
val mediaVolumeStepsSwitchBinding = GetDataBinding( val mediaVolumeStepsSwitchBinding = GetDataBinding(
object : DefValue { object : DefValue {
override fun getValue(): Any { override fun getValue(): Any {
@@ -954,7 +1065,7 @@ class SettingsActivity : MIUIActivity() {
) )
} }
register("scope_other", getString(R.string.scope_other), false) { register("scope_other", getString(R.string.scope_other), false) {
TitleText(resId = R.string.scope_miuihome) TitleText(textId = R.string.scope_miuihome)
TextSummaryWithSwitch( TextSummaryWithSwitch(
TextSummaryV( TextSummaryV(
textId = R.string.home_time, textId = R.string.home_time,
@@ -968,7 +1079,7 @@ class SettingsActivity : MIUIActivity() {
), SwitchV("double_tap_to_sleep") ), SwitchV("double_tap_to_sleep")
) )
Line() Line()
TitleText(resId = R.string.scope_powerkeeper) TitleText(textId = R.string.scope_powerkeeper)
TextSummaryWithSwitch( TextSummaryWithSwitch(
TextSummaryV( TextSummaryV(
textId = R.string.lock_max_fps, textId = R.string.lock_max_fps,
@@ -1003,7 +1114,7 @@ class SettingsActivity : MIUIActivity() {
}) })
) )
Line() Line()
TitleText(resId = R.string.scope_securitycenter) TitleText(textId = R.string.scope_securitycenter)
TextSummaryWithSwitch( TextSummaryWithSwitch(
TextSummaryV( TextSummaryV(
textId = R.string.skip_waiting_time, textId = R.string.skip_waiting_time,
@@ -1038,7 +1149,7 @@ class SettingsActivity : MIUIActivity() {
SwitchV("battery_life_function") SwitchV("battery_life_function")
) )
Line() Line()
TitleText(resId = R.string.scope_mediaeditor) TitleText(textId = R.string.scope_mediaeditor)
TextSummaryWithSwitch( TextSummaryWithSwitch(
TextSummaryV( TextSummaryV(
textId = R.string.unlock_unlimited_cropping, textId = R.string.unlock_unlimited_cropping,
@@ -1047,7 +1158,7 @@ class SettingsActivity : MIUIActivity() {
SwitchV("unlock_unlimited_cropping") SwitchV("unlock_unlimited_cropping")
) )
Line() Line()
TitleText(resId = R.string.updater) TitleText(textId = R.string.updater)
TextSummaryWithSwitch( TextSummaryWithSwitch(
TextSummaryV( TextSummaryV(
textId = R.string.remove_ota_validate, textId = R.string.remove_ota_validate,
@@ -1056,7 +1167,7 @@ class SettingsActivity : MIUIActivity() {
SwitchV("remove_ota_validate") SwitchV("remove_ota_validate")
) )
Line() Line()
TitleText(resId = R.string.settings) TitleText(textId = R.string.settings)
TextSummaryWithSwitch( TextSummaryWithSwitch(
TextSummaryV( TextSummaryV(
textId = R.string.show_notification_importance, textId = R.string.show_notification_importance,
@@ -1065,7 +1176,7 @@ class SettingsActivity : MIUIActivity() {
SwitchV("show_notification_importance") SwitchV("show_notification_importance")
) )
Line() Line()
TitleText(resId = R.string.cast) TitleText(textId = R.string.cast)
TextSummaryWithSwitch( TextSummaryWithSwitch(
TextSummaryV( TextSummaryV(
textId = R.string.force_support_send_app, textId = R.string.force_support_send_app,
@@ -1073,7 +1184,7 @@ class SettingsActivity : MIUIActivity() {
SwitchV("force_support_send_app") SwitchV("force_support_send_app")
) )
Line() Line()
TitleText(resId = R.string.rear_display) TitleText(textId = R.string.rear_display)
TextSummaryWithSwitch( TextSummaryWithSwitch(
TextSummaryV( TextSummaryV(
textId = R.string.show_weather_main_switch, textId = R.string.show_weather_main_switch,
@@ -1081,7 +1192,7 @@ class SettingsActivity : MIUIActivity() {
SwitchV("rear_show_weather") SwitchV("rear_show_weather")
) )
Line() Line()
TitleText(resId = R.string.remove_ad) TitleText(textId = R.string.remove_ad)
TextSummaryWithSwitch( TextSummaryWithSwitch(
TextSummaryV( TextSummaryV(
textId = R.string.remove_thememanager_ads textId = R.string.remove_thememanager_ads
@@ -1090,106 +1201,106 @@ class SettingsActivity : MIUIActivity() {
) )
} }
register("hide_icon", getString(R.string.hide_icon), false) { register("hide_icon", getString(R.string.hide_icon), false) {
TitleText(resId = R.string.status_bar_icon) TitleText(textId = R.string.status_bar_icon)
TextWithSwitch( TextWithSwitch(
TextV(resId = R.string.hide_battery_icon), TextV(textId = R.string.hide_battery_icon),
SwitchV("hide_battery_icon") SwitchV("hide_battery_icon")
) )
TextWithSwitch( TextWithSwitch(
TextV(resId = R.string.hide_battery_charging_icon), TextV(textId = R.string.hide_battery_charging_icon),
SwitchV("hide_battery_charging_icon") SwitchV("hide_battery_charging_icon")
) )
TextWithSwitch( TextWithSwitch(
TextV(resId = R.string.hide_gps_icon), TextV(textId = R.string.hide_gps_icon),
SwitchV("hide_gps_icon") SwitchV("hide_gps_icon")
) )
TextWithSwitch( TextWithSwitch(
TextV(resId = R.string.hide_bluetooth_icon), TextV(textId = R.string.hide_bluetooth_icon),
SwitchV("hide_bluetooth_icon") SwitchV("hide_bluetooth_icon")
) )
TextWithSwitch( TextWithSwitch(
TextV(resId = R.string.hide_nfc_icon), TextV(textId = R.string.hide_nfc_icon),
SwitchV("hide_nfc_icon") SwitchV("hide_nfc_icon")
) )
TextWithSwitch( TextWithSwitch(
TextV(resId = R.string.hide_bluetooth_battery_icon), TextV(textId = R.string.hide_bluetooth_battery_icon),
SwitchV("hide_bluetooth_battery_icon") SwitchV("hide_bluetooth_battery_icon")
) )
TextWithSwitch( TextWithSwitch(
TextV(resId = R.string.hide_small_hd_icon), TextV(textId = R.string.hide_small_hd_icon),
SwitchV("hide_small_hd_icon") SwitchV("hide_small_hd_icon")
) )
TextWithSwitch( TextWithSwitch(
TextV(resId = R.string.hide_big_hd_icon), TextV(textId = R.string.hide_big_hd_icon),
SwitchV("hide_big_hd_icon") SwitchV("hide_big_hd_icon")
) )
TextWithSwitch( TextWithSwitch(
TextV(resId = R.string.hide_hd_no_service_icon), TextV(textId = R.string.hide_hd_no_service_icon),
SwitchV("hide_hd_no_service_icon") SwitchV("hide_hd_no_service_icon")
) )
TextWithSwitch( TextWithSwitch(
TextV(resId = R.string.hide_no_sim_icon), TextV(textId = R.string.hide_no_sim_icon),
SwitchV("hide_no_sim_icon") SwitchV("hide_no_sim_icon")
) )
TextWithSwitch( TextWithSwitch(
TextV(resId = R.string.hide_sim_one_icon), TextV(textId = R.string.hide_sim_one_icon),
SwitchV("hide_sim_one_icon") SwitchV("hide_sim_one_icon")
) )
TextWithSwitch( TextWithSwitch(
TextV(resId = R.string.hide_sim_two_icon), TextV(textId = R.string.hide_sim_two_icon),
SwitchV("hide_sim_two_icon") SwitchV("hide_sim_two_icon")
) )
TextWithSwitch( TextWithSwitch(
TextV(resId = R.string.hide_mobile_activity_icon), TextV(textId = R.string.hide_mobile_activity_icon),
SwitchV("hide_mobile_activity_icon") SwitchV("hide_mobile_activity_icon")
) )
TextWithSwitch( TextWithSwitch(
TextV(resId = R.string.hide_mobile_type_icon), TextV(textId = R.string.hide_mobile_type_icon),
SwitchV("hide_mobile_type_icon") SwitchV("hide_mobile_type_icon")
) )
TextWithSwitch( TextWithSwitch(
TextV(resId = R.string.hide_wifi_icon), TextV(textId = R.string.hide_wifi_icon),
SwitchV("hide_wifi_icon") SwitchV("hide_wifi_icon")
) )
TextWithSwitch( TextWithSwitch(
TextV(resId = R.string.hide_wifi_activity_icon), TextV(textId = R.string.hide_wifi_activity_icon),
SwitchV("hide_wifi_activity_icon") SwitchV("hide_wifi_activity_icon")
) )
TextWithSwitch( TextWithSwitch(
TextV(resId = R.string.hide_wifi_standard_icon), TextV(textId = R.string.hide_wifi_standard_icon),
SwitchV("hide_wifi_standard_icon") SwitchV("hide_wifi_standard_icon")
) )
TextWithSwitch( TextWithSwitch(
TextV(resId = R.string.hide_slave_wifi_icon), TextV(textId = R.string.hide_slave_wifi_icon),
SwitchV("hide_slave_wifi_icon") SwitchV("hide_slave_wifi_icon")
) )
TextWithSwitch( TextWithSwitch(
TextV(resId = R.string.hide_hotspot_icon), TextV(textId = R.string.hide_hotspot_icon),
SwitchV("hide_hotspot_icon") SwitchV("hide_hotspot_icon")
) )
TextWithSwitch( TextWithSwitch(
TextV(resId = R.string.hide_vpn_icon), TextV(textId = R.string.hide_vpn_icon),
SwitchV("hide_vpn_icon") SwitchV("hide_vpn_icon")
) )
TextWithSwitch( TextWithSwitch(
TextV(resId = R.string.hide_airplane_icon), TextV(textId = R.string.hide_airplane_icon),
SwitchV("hide_airplane_icon") SwitchV("hide_airplane_icon")
) )
TextWithSwitch( TextWithSwitch(
TextV(resId = R.string.hide_alarm_icon), TextV(textId = R.string.hide_alarm_icon),
SwitchV("hide_alarm_icon") SwitchV("hide_alarm_icon")
) )
TextWithSwitch( TextWithSwitch(
TextV(resId = R.string.hide_headset_icon), TextV(textId = R.string.hide_headset_icon),
SwitchV("hide_headset_icon") SwitchV("hide_headset_icon")
) )
TextWithSwitch( TextWithSwitch(
TextV(resId = R.string.hide_volume_icon), TextV(textId = R.string.hide_volume_icon),
SwitchV("hide_volume_icon") SwitchV("hide_volume_icon")
) )
TextWithSwitch( TextWithSwitch(
TextV(resId = R.string.hide_zen_icon), TextV(textId = R.string.hide_zen_icon),
SwitchV("hide_zen_icon") SwitchV("hide_zen_icon")
) )
} }
@@ -1198,7 +1309,7 @@ class SettingsActivity : MIUIActivity() {
authorHead = getDrawable(R.drawable.app_icon)!!, authorHead = getDrawable(R.drawable.app_icon)!!,
authorName = getString(R.string.app_name), authorName = getString(R.string.app_name),
authorTips = BuildConfig.VERSION_NAME + "(" + BuildConfig.BUILD_TYPE + ")", authorTips = BuildConfig.VERSION_NAME + "(" + BuildConfig.BUILD_TYPE + ")",
onClick = { onClickListener = {
try { try {
startActivity( startActivity(
Intent( Intent(
@@ -1221,7 +1332,7 @@ class SettingsActivity : MIUIActivity() {
authorHead = getDrawable(R.drawable.lt)!!, authorHead = getDrawable(R.drawable.lt)!!,
authorName = "乌堆小透明", authorName = "乌堆小透明",
authorTips = "LittleTurtle2333", authorTips = "LittleTurtle2333",
onClick = { onClickListener = {
try { try {
startActivity( startActivity(
Intent( Intent(

View File

@@ -10,7 +10,7 @@ object UnlockUnlimitedCropping : HookRegister() {
override fun init() { override fun init() {
//截图无限裁切 //截图无限裁切
findMethod("com.miui.gallery.editor.photo.screen.crop.ScreenCropView\$b") { findMethod("com.miui.gallery.editor.photo.screen.crop.ScreenCropView\$b") {
name == "a" name == "a" && parameterCount == 0 && returnType == Int::class.java
}.hookBefore { }.hookBefore {
hasEnable("unlock_unlimited_cropping") { hasEnable("unlock_unlimited_cropping") {
it.result = 0 it.result = 0

View File

@@ -11,15 +11,16 @@ import android.widget.LinearLayout
import android.widget.TextView import android.widget.TextView
import androidx.constraintlayout.widget.ConstraintLayout import androidx.constraintlayout.widget.ConstraintLayout
import cn.fkj233.ui.activity.dp2px import cn.fkj233.ui.activity.dp2px
import com.github.kyuubiran.ezxhelper.utils.findMethod import com.github.kyuubiran.ezxhelper.utils.*
import com.github.kyuubiran.ezxhelper.utils.getObjectAs
import com.github.kyuubiran.ezxhelper.utils.hookAfter
import com.lt2333.simplicitytools.util.XSPUtils import com.lt2333.simplicitytools.util.XSPUtils
import com.lt2333.simplicitytools.util.hasEnable import com.lt2333.simplicitytools.util.hasEnable
import com.lt2333.simplicitytools.util.xposed.base.HookRegister import com.lt2333.simplicitytools.util.xposed.base.HookRegister
object StatusBarLayout : HookRegister() { object StatusBarLayout : HookRegister() {
private val getMode = XSPUtils.getInt("status_bar_layout_mode", 0)
private val getHoleLocation = XSPUtils.getInt("screen_hole_location", 0)
private var statusBarLeft = 0 private var statusBarLeft = 0
private var statusBarTop = 0 private var statusBarTop = 0
private var statusBarRight = 0 private var statusBarRight = 0
@@ -46,7 +47,16 @@ object StatusBarLayout : HookRegister() {
} }
} }
when (XSPUtils.getInt("status_bar_layout_mode", 0)) { //判断是否开启居中挖孔兼容模式
if (getHoleLocation == 1) {
findMethod("com.android.systemui.ScreenDecorations\$DisplayCutoutView") {
name == "boundsFromDirection" && parameterCount == 3 && isStatic
}.hookBefore {
it.args[1] = 0
}
}
when (getMode) {
//默认 //默认
0 -> return 0 -> return
//时钟居中 //时钟居中
@@ -150,7 +160,7 @@ object StatusBarLayout : HookRegister() {
statusBarBottom = statusBar!!.paddingBottom statusBarBottom = statusBar!!.paddingBottom
if (XSPUtils.getBoolean("layout_compatibility_mode", false)) { if (getHoleLocation == 2) {
val customLeftMargin = XSPUtils.getInt("status_bar_left_margin", 0) val customLeftMargin = XSPUtils.getInt("status_bar_left_margin", 0)
if (customLeftMargin != 0) { if (customLeftMargin != 0) {
statusBarLeft = customLeftMargin statusBarLeft = customLeftMargin
@@ -365,7 +375,7 @@ object StatusBarLayout : HookRegister() {
statusBarBottom = statusBar!!.paddingBottom statusBarBottom = statusBar!!.paddingBottom
if (XSPUtils.getBoolean("layout_compatibility_mode", false)) { if (getHoleLocation == 2) {
val customLeftMargin = XSPUtils.getInt("status_bar_left_margin", 0) val customLeftMargin = XSPUtils.getInt("status_bar_left_margin", 0)
if (customLeftMargin != 0) { if (customLeftMargin != 0) {
statusBarLeft = customLeftMargin statusBarLeft = customLeftMargin
@@ -382,7 +392,7 @@ object StatusBarLayout : HookRegister() {
findMethod("com.android.systemui.statusbar.phone.PhoneStatusBarView") { findMethod("com.android.systemui.statusbar.phone.PhoneStatusBarView") {
name == "updateLayoutForCutout" name == "updateLayoutForCutout"
}.hookAfter { }.hookAfter {
if (XSPUtils.getBoolean("layout_compatibility_mode", false)) { if (getHoleLocation == 2) {
val context = (it.thisObject as ViewGroup).context val context = (it.thisObject as ViewGroup).context
updateLayout(context) updateLayout(context)
} }
@@ -409,5 +419,4 @@ object StatusBarLayout : HookRegister() {
} }
} }
} }
} }

View File

@@ -18,6 +18,9 @@ import java.util.*
object StatusBarTimeCustomization : HookRegister() { object StatusBarTimeCustomization : HookRegister() {
private val getMode = XSPUtils.getInt("custom_clock_mode", 0)
private val getClockSize = XSPUtils.getInt("status_bar_clock_size", 0)
private val getClockDoubleSize = XSPUtils.getInt("status_bar_clock_double_line_size", 0)
private val isYear = XSPUtils.getBoolean("status_bar_time_year", false) private val isYear = XSPUtils.getBoolean("status_bar_time_year", false)
private val isMonth = XSPUtils.getBoolean("status_bar_time_month", false) private val isMonth = XSPUtils.getBoolean("status_bar_time_month", false)
private val isDay = XSPUtils.getBoolean("status_bar_time_day", false) private val isDay = XSPUtils.getBoolean("status_bar_time_day", false)
@@ -27,85 +30,160 @@ object StatusBarTimeCustomization : HookRegister() {
private val isSecond = XSPUtils.getBoolean("status_bar_time_seconds", false) private val isSecond = XSPUtils.getBoolean("status_bar_time_seconds", false)
private val isDoubleHour = XSPUtils.getBoolean("status_bar_time_double_hour", false) private val isDoubleHour = XSPUtils.getBoolean("status_bar_time_double_hour", false)
private val isPeriod = XSPUtils.getBoolean("status_bar_time_period", true) private val isPeriod = XSPUtils.getBoolean("status_bar_time_period", true)
private val getClockSize = XSPUtils.getInt("status_bar_clock_size", 0)
private val isOpen = XSPUtils.getBoolean("custom_clock_switch", false)
private val isCenterAlign = private val isCenterAlign =
XSPUtils.getBoolean("status_bar_time_double_line_center_align", false) XSPUtils.getBoolean("status_bar_time_double_line_center_align", false)
private val getClockDoubleSize = XSPUtils.getInt("status_bar_clock_double_line_size", 0)
//极客模式
private val getGeekClockSize = XSPUtils.getInt("status_bar_clock_size_geek", 0)
private val getGeekFormat = XSPUtils.getString("custom_clock_format_geek", "HH:mm:ss")
private val isGeekCenterAlign =
XSPUtils.getBoolean("status_bar_time_center_align_geek", false)
private lateinit var nowTime: Date private lateinit var nowTime: Date
private var str = "" private var str = ""
@SuppressLint("SetTextI18n") @SuppressLint("SetTextI18n")
override fun init() { override fun init() {
if (isOpen) { when (getMode) {
var c: Context? = null //预设模式
1 -> {
var c: Context? = null
findConstructor("com.android.systemui.statusbar.views.MiuiClock") { findConstructor("com.android.systemui.statusbar.views.MiuiClock") {
paramCount == 3 paramCount == 3
}.hookAfter { }.hookAfter {
try { try {
c = it.args[0] as Context c = it.args[0] as Context
val textV = it.thisObject as TextView val textV = it.thisObject as TextView
if (textV.resources.getResourceEntryName(textV.id) != "clock") return@hookAfter if (textV.resources.getResourceEntryName(textV.id) != "clock") return@hookAfter
textV.isSingleLine = false textV.isSingleLine = false
if (isDoubleLine) { if (isDoubleLine) {
str = "\n" str = "\n"
var clockDoubleLineSize = 7F var clockDoubleLineSize = 7F
if (getClockDoubleSize != 0) { if (getClockDoubleSize != 0) {
clockDoubleLineSize = getClockDoubleSize.toFloat() clockDoubleLineSize = getClockDoubleSize.toFloat()
}
textV.setTextSize(TypedValue.COMPLEX_UNIT_DIP, clockDoubleLineSize)
textV.setLineSpacing(0F, 0.8F)
} else {
if (getClockSize != 0) {
val clockSize = getClockSize.toFloat()
textV.setTextSize(TypedValue.COMPLEX_UNIT_DIP, clockSize)
}
} }
textV.setTextSize(TypedValue.COMPLEX_UNIT_DIP, clockDoubleLineSize) val d: Method = textV.javaClass.getDeclaredMethod("updateTime")
val r = Runnable {
d.isAccessible = true
d.invoke(textV)
}
class T : TimerTask() {
override fun run() {
Handler(textV.context.mainLooper).post(r)
}
}
Timer().scheduleAtFixedRate(
T(),
1000 - System.currentTimeMillis() % 1000,
1000
)
} catch (_: Exception) {
}
}
findMethod("com.android.systemui.statusbar.views.MiuiClock") {
name == "updateTime"
}.hookAfter {
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 is24 = t == "24"
nowTime = Calendar.getInstance().time
textV.text = getDate(c!!) + str + getTime(c!!, is24)
}
} catch (_: Exception) {
}
}
if (isCenterAlign) {
findMethod("com.android.systemui.statusbar.phone.CollapsedStatusBarFragment") {
name == "onViewCreated" && parameterCount == 2
}.hookAfter {
val miuiPhoneStatusBarView =
it.thisObject.getObject("mStatusBar") as ViewGroup
val res: Resources = miuiPhoneStatusBarView.resources
val clockId: Int = res.getIdentifier("clock", "id", "com.android.systemui")
val clock: TextView = miuiPhoneStatusBarView.findViewById(clockId)
clock.gravity = Gravity.CENTER
}
}
}
//极客模式
2 -> {
var c: Context? = null
findConstructor("com.android.systemui.statusbar.views.MiuiClock") {
paramCount == 3
}.hookAfter {
try {
c = it.args[0] as Context
val textV = it.thisObject as TextView
if (textV.resources.getResourceEntryName(textV.id) != "clock") return@hookAfter
textV.isSingleLine = false
textV.setLineSpacing(0F, 0.8F) textV.setLineSpacing(0F, 0.8F)
} else { if (getGeekClockSize != 0) {
if (getClockSize != 0) { val clockSize = getGeekClockSize.toFloat()
val clockSize = getClockSize.toFloat()
textV.setTextSize(TypedValue.COMPLEX_UNIT_DIP, clockSize) textV.setTextSize(TypedValue.COMPLEX_UNIT_DIP, clockSize)
} }
}
val d: Method = textV.javaClass.getDeclaredMethod("updateTime")
val r = Runnable {
d.isAccessible = true
d.invoke(textV)
}
class T : TimerTask() { val d: Method = textV.javaClass.getDeclaredMethod("updateTime")
override fun run() { val r = Runnable {
Handler(textV.context.mainLooper).post(r) d.isAccessible = true
d.invoke(textV)
} }
}
Timer().scheduleAtFixedRate(T(), 1000 - System.currentTimeMillis() % 1000, 1000)
} catch (_: Exception) {
}
}
findMethod("com.android.systemui.statusbar.views.MiuiClock") { class T : TimerTask() {
name == "updateTime" override fun run() {
}.hookAfter { Handler(textV.context.mainLooper).post(r)
try { }
val textV = it.thisObject as TextView }
if (textV.resources.getResourceEntryName(textV.id) == "clock") { Timer().scheduleAtFixedRate(
val t = Settings.System.getString( T(),
c!!.contentResolver, 1000 - System.currentTimeMillis() % 1000,
Settings.System.TIME_12_24 1000
) )
val is24 = t == "24" } catch (_: Exception) {
nowTime = Calendar.getInstance().time
textV.text = getDate(c!!) + str + getTime(c!!, is24)
} }
} catch (_: Exception) {
} }
}
if (isCenterAlign) { findMethod("com.android.systemui.statusbar.views.MiuiClock") {
findMethod("com.android.systemui.statusbar.phone.CollapsedStatusBarFragment") { name == "updateTime"
name == "onViewCreated" && parameterCount == 2
}.hookAfter { }.hookAfter {
val miuiPhoneStatusBarView = try {
it.thisObject.getObject("mStatusBar") as ViewGroup val textV = it.thisObject as TextView
val res: Resources = miuiPhoneStatusBarView.resources if (textV.resources.getResourceEntryName(textV.id) == "clock") {
val clockId: Int = res.getIdentifier("clock", "id", "com.android.systemui") nowTime = Calendar.getInstance().time
val clock: TextView = miuiPhoneStatusBarView.findViewById(clockId) textV.text = SimpleDateFormat(getGeekFormat).format(nowTime)
clock.gravity = Gravity.CENTER }
} catch (_: Exception) {
}
}
if (isGeekCenterAlign) {
findMethod("com.android.systemui.statusbar.phone.CollapsedStatusBarFragment") {
name == "onViewCreated" && parameterCount == 2
}.hookAfter {
val miuiPhoneStatusBarView =
it.thisObject.getObject("mStatusBar") as ViewGroup
val res: Resources = miuiPhoneStatusBarView.resources
val clockId: Int = res.getIdentifier("clock", "id", "com.android.systemui")
val clock: TextView = miuiPhoneStatusBarView.findViewById(clockId)
clock.gravity = Gravity.CENTER
}
} }
} }
} }

View File

@@ -218,4 +218,12 @@
<string name="take_effect_after_reboot">Intră în vigoare după repornire</string> <string name="take_effect_after_reboot">Intră în vigoare după repornire</string>
<string name="media_volume_steps_summary">Activarea poate provoca înghețarea derulării barei de volum sau volumul Bluetooth să fie anormal</string> <string name="media_volume_steps_summary">Activarea poate provoca înghețarea derulării barei de volum sau volumul Bluetooth să fie anormal</string>
<string name="can_notification_slide_summary">Este posibil ca unele notificări prin Mi Push să nu fie acceptate.</string> <string name="can_notification_slide_summary">Este posibil ca unele notificări prin Mi Push să nu fie acceptate.</string>
<string name="screen_hole_location">Locație gaură ecran</string>
<string name="custom_clock_mode">Mod ceas personalizat</string>
<string name="custom_clock_format_geek">Format ceas</string>
<string name="off">Oprit</string>
<string name="center">La centru</string>
<string name="left_or_right">Stânga sau dreapta</string>
<string name="preset">Presetare</string>
<string name="geek">Tocilar</string>
</resources> </resources>

View File

@@ -218,4 +218,12 @@
<string name="take_effect_after_reboot">重新启动后生效</string> <string name="take_effect_after_reboot">重新启动后生效</string>
<string name="media_volume_steps_summary">打开可能会导致音量条的滚动卡顿或蓝牙音量异常。</string> <string name="media_volume_steps_summary">打开可能会导致音量条的滚动卡顿或蓝牙音量异常。</string>
<string name="can_notification_slide_summary">一些通过Mi Push推送的通知可能不受支持</string> <string name="can_notification_slide_summary">一些通过Mi Push推送的通知可能不受支持</string>
<string name="screen_hole_location">屏幕挖孔位置</string>
<string name="custom_clock_mode">自定义时钟模式</string>
<string name="custom_clock_format_geek">时钟格式</string>
<string name="off">关闭</string>
<string name="center">中间</string>
<string name="left_or_right">左右</string>
<string name="preset">预设</string>
<string name="geek">极客</string>
</resources> </resources>

View File

@@ -218,4 +218,10 @@
<string name="take_effect_after_reboot">重新開機後生效</string> <string name="take_effect_after_reboot">重新開機後生效</string>
<string name="media_volume_steps_summary">開啟後可能會導致音量條的滾動卡頓或藍牙音量異常</string> <string name="media_volume_steps_summary">開啟後可能會導致音量條的滾動卡頓或藍牙音量異常</string>
<string name="can_notification_slide_summary">可能無法支援一些使用小米推送(Mi Push)推播的通知</string> <string name="can_notification_slide_summary">可能無法支援一些使用小米推送(Mi Push)推播的通知</string>
<string name="screen_hole_location">螢幕挖孔位置</string>
<string name="custom_clock_mode">自訂時鐘模式</string>
<string name="custom_clock_format_geek">時鐘格式</string>
<string name="off">關閉</string>
<string name="center">置中</string>
<string name="left_or_right">左右</string>
</resources> </resources>

View File

@@ -222,4 +222,12 @@
<string name="take_effect_after_reboot">Take effect after reboot</string> <string name="take_effect_after_reboot">Take effect after reboot</string>
<string name="media_volume_steps_summary">Turning on may cause the scrolling of the volume bar to freeze or the Bluetooth volume to be abnormal</string> <string name="media_volume_steps_summary">Turning on may cause the scrolling of the volume bar to freeze or the Bluetooth volume to be abnormal</string>
<string name="can_notification_slide_summary">Some notifications through Mi Push may not be supported.</string> <string name="can_notification_slide_summary">Some notifications through Mi Push may not be supported.</string>
<string name="screen_hole_location">Screen hole location</string>
<string name="custom_clock_mode">Custom clock mode</string>
<string name="custom_clock_format_geek">Clock format</string>
<string name="off">Off</string>
<string name="center">Center</string>
<string name="left_or_right">Left or Right</string>
<string name="preset">Preset</string>
<string name="geek">Geek</string>
</resources> </resources>

View File

@@ -5,8 +5,8 @@ buildscript {
mavenCentral() mavenCentral()
} }
dependencies { dependencies {
classpath("com.android.tools.build:gradle:7.2.0") classpath("com.android.tools.build:gradle:7.2.1")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10") classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.0")
// NOTE: Do not place your application dependencies here; they belong // NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle.kts files // in the individual module build.gradle.kts files