mirror of
https://github.com/LittleTurtle2333/SimplicityTools.git
synced 2026-07-14 12:21:18 +08:00
Compare commits
6 Commits
068eab0cc8
...
93b39c9bdb
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
93b39c9bdb | ||
|
|
6807a1a953 | ||
|
|
53a7e39220 | ||
|
|
99666c926b | ||
|
|
5925534ff9 | ||
|
|
c2df80dc10 |
@@ -10,6 +10,7 @@ import android.view.View
|
|||||||
import android.widget.Switch
|
import android.widget.Switch
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import cn.fkj233.ui.activity.MIUIActivity
|
import cn.fkj233.ui.activity.MIUIActivity
|
||||||
|
import cn.fkj233.ui.activity.OwnSP
|
||||||
import cn.fkj233.ui.activity.data.DefValue
|
import cn.fkj233.ui.activity.data.DefValue
|
||||||
import cn.fkj233.ui.activity.view.SpinnerV
|
import cn.fkj233.ui.activity.view.SpinnerV
|
||||||
import cn.fkj233.ui.activity.view.SwitchV
|
import cn.fkj233.ui.activity.view.SwitchV
|
||||||
@@ -144,29 +145,53 @@ class SettingsActivity : MIUIActivity() {
|
|||||||
TextWithSpinner(
|
TextWithSpinner(
|
||||||
TextV(resId = R.string.status_bar_layout_mode),
|
TextV(resId = R.string.status_bar_layout_mode),
|
||||||
SpinnerV(
|
SpinnerV(
|
||||||
statusBarLayoutMode[safeSP.getInt(
|
statusBarLayoutMode[OwnSP.ownSP.getInt(
|
||||||
"status_bar_layout_mode",
|
"status_bar_layout_mode",
|
||||||
0
|
0
|
||||||
)].toString()
|
)].toString()
|
||||||
) {
|
) {
|
||||||
add(statusBarLayoutMode[0].toString()) {
|
add(statusBarLayoutMode[0].toString()) {
|
||||||
safeSP.putAny("status_bar_layout_mode", 0)
|
OwnSP.ownSP.edit().run {
|
||||||
|
putInt(
|
||||||
|
"status_bar_layout_mode",
|
||||||
|
0
|
||||||
|
)
|
||||||
|
apply()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
add(statusBarLayoutMode[1].toString()) {
|
add(statusBarLayoutMode[1].toString()) {
|
||||||
safeSP.putAny("status_bar_layout_mode", 1)
|
OwnSP.ownSP.edit().run {
|
||||||
|
putInt(
|
||||||
|
"status_bar_layout_mode",
|
||||||
|
1
|
||||||
|
)
|
||||||
|
apply()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
add(statusBarLayoutMode[2].toString()) {
|
add(statusBarLayoutMode[2].toString()) {
|
||||||
safeSP.putAny("status_bar_layout_mode", 2)
|
OwnSP.ownSP.edit().run {
|
||||||
|
putInt(
|
||||||
|
"status_bar_layout_mode",
|
||||||
|
2
|
||||||
|
)
|
||||||
|
apply()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
add(statusBarLayoutMode[3].toString()) {
|
add(statusBarLayoutMode[3].toString()) {
|
||||||
safeSP.putAny("status_bar_layout_mode", 3)
|
OwnSP.ownSP.edit().run {
|
||||||
|
putInt(
|
||||||
|
"status_bar_layout_mode",
|
||||||
|
3
|
||||||
|
)
|
||||||
|
apply()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
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 getSP().getBoolean("layout_compatibility_mode", false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
) { view, flags, data ->
|
) { view, flags, data ->
|
||||||
@@ -211,7 +236,7 @@ class SettingsActivity : MIUIActivity() {
|
|||||||
TitleText(resId = R.string.status_bar_clock_format)
|
TitleText(resId = R.string.status_bar_clock_format)
|
||||||
val customClockBinding = GetDataBinding(object : DefValue {
|
val customClockBinding = GetDataBinding(object : DefValue {
|
||||||
override fun getValue(): Any {
|
override fun getValue(): Any {
|
||||||
return safeSP.getBoolean("custom_clock_switch", false)
|
return getSP().getBoolean("custom_clock_switch", false)
|
||||||
}
|
}
|
||||||
}) { view, flags, data ->
|
}) { view, flags, data ->
|
||||||
when (flags) {
|
when (flags) {
|
||||||
@@ -302,7 +327,7 @@ class SettingsActivity : MIUIActivity() {
|
|||||||
)
|
)
|
||||||
val customMobileTypeTextBinding = GetDataBinding(object : DefValue {
|
val customMobileTypeTextBinding = GetDataBinding(object : DefValue {
|
||||||
override fun getValue(): Any {
|
override fun getValue(): Any {
|
||||||
return safeSP.getBoolean("custom_mobile_type_text_switch", false)
|
return getSP().getBoolean("custom_mobile_type_text_switch", false)
|
||||||
}
|
}
|
||||||
}) { view, flags, data ->
|
}) { view, flags, data ->
|
||||||
when (flags) {
|
when (flags) {
|
||||||
@@ -326,9 +351,11 @@ class SettingsActivity : MIUIActivity() {
|
|||||||
MIUIDialog(activity) {
|
MIUIDialog(activity) {
|
||||||
setTitle(R.string.custom_mobile_type_text)
|
setTitle(R.string.custom_mobile_type_text)
|
||||||
setEditText(
|
setEditText(
|
||||||
safeSP.getString(
|
"${
|
||||||
|
OwnSP.ownSP.getString(
|
||||||
"custom_mobile_type_text", "5G"
|
"custom_mobile_type_text", "5G"
|
||||||
),
|
)
|
||||||
|
}",
|
||||||
""
|
""
|
||||||
)
|
)
|
||||||
setLButton(textId = R.string.cancel) {
|
setLButton(textId = R.string.cancel) {
|
||||||
@@ -337,7 +364,13 @@ class SettingsActivity : MIUIActivity() {
|
|||||||
setRButton(textId = R.string.Done) {
|
setRButton(textId = R.string.Done) {
|
||||||
if (getEditText().isNotEmpty()) {
|
if (getEditText().isNotEmpty()) {
|
||||||
try {
|
try {
|
||||||
safeSP.putAny("custom_mobile_type_text", getEditText())
|
OwnSP.ownSP.edit().run {
|
||||||
|
putString(
|
||||||
|
"custom_mobile_type_text",
|
||||||
|
getEditText()
|
||||||
|
)
|
||||||
|
apply()
|
||||||
|
}
|
||||||
dismiss()
|
dismiss()
|
||||||
return@setRButton
|
return@setRButton
|
||||||
} catch (_: Throwable) {
|
} catch (_: Throwable) {
|
||||||
@@ -354,7 +387,7 @@ class SettingsActivity : MIUIActivity() {
|
|||||||
)
|
)
|
||||||
val bigMobileTypeIconBinding = GetDataBinding(object : DefValue {
|
val bigMobileTypeIconBinding = GetDataBinding(object : DefValue {
|
||||||
override fun getValue(): Any {
|
override fun getValue(): Any {
|
||||||
return safeSP.getBoolean("big_mobile_type_icon", false)
|
return getSP().getBoolean("big_mobile_type_icon", false)
|
||||||
}
|
}
|
||||||
}) { view, flags, data ->
|
}) { view, flags, data ->
|
||||||
when (flags) {
|
when (flags) {
|
||||||
@@ -387,7 +420,7 @@ class SettingsActivity : MIUIActivity() {
|
|||||||
setEditText(
|
setEditText(
|
||||||
"",
|
"",
|
||||||
"${activity.getString(R.string.def)}12.5, ${activity.getString(R.string.current)}${
|
"${activity.getString(R.string.def)}12.5, ${activity.getString(R.string.current)}${
|
||||||
safeSP.getFloat(
|
OwnSP.ownSP.getFloat(
|
||||||
"big_mobile_type_icon_size",
|
"big_mobile_type_icon_size",
|
||||||
12.5f
|
12.5f
|
||||||
)
|
)
|
||||||
@@ -398,10 +431,13 @@ class SettingsActivity : MIUIActivity() {
|
|||||||
}
|
}
|
||||||
setRButton(textId = R.string.Done) {
|
setRButton(textId = R.string.Done) {
|
||||||
if (getEditText() != "") {
|
if (getEditText() != "") {
|
||||||
safeSP.putAny(
|
OwnSP.ownSP.edit().run {
|
||||||
|
putFloat(
|
||||||
"big_mobile_type_icon_size",
|
"big_mobile_type_icon_size",
|
||||||
getEditText().toFloat()
|
getEditText().toFloat()
|
||||||
)
|
)
|
||||||
|
apply()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
dismiss()
|
dismiss()
|
||||||
}
|
}
|
||||||
@@ -418,7 +454,7 @@ class SettingsActivity : MIUIActivity() {
|
|||||||
setEditText(
|
setEditText(
|
||||||
"",
|
"",
|
||||||
"${activity.getString(R.string.def)}0, ${activity.getString(R.string.current)}${
|
"${activity.getString(R.string.def)}0, ${activity.getString(R.string.current)}${
|
||||||
safeSP.getInt(
|
OwnSP.ownSP.getInt(
|
||||||
"big_mobile_type_icon_up_and_down_position",
|
"big_mobile_type_icon_up_and_down_position",
|
||||||
0
|
0
|
||||||
)
|
)
|
||||||
@@ -432,10 +468,13 @@ class SettingsActivity : MIUIActivity() {
|
|||||||
try {
|
try {
|
||||||
val value = getEditText().toInt()
|
val value = getEditText().toInt()
|
||||||
if (value in (-15..15)) {
|
if (value in (-15..15)) {
|
||||||
safeSP.putAny(
|
OwnSP.ownSP.edit().run {
|
||||||
|
putInt(
|
||||||
"big_mobile_type_icon_up_and_down_position",
|
"big_mobile_type_icon_up_and_down_position",
|
||||||
value
|
value
|
||||||
)
|
)
|
||||||
|
apply()
|
||||||
|
}
|
||||||
dismiss()
|
dismiss()
|
||||||
return@setRButton
|
return@setRButton
|
||||||
}
|
}
|
||||||
@@ -461,7 +500,7 @@ class SettingsActivity : MIUIActivity() {
|
|||||||
setEditText(
|
setEditText(
|
||||||
"",
|
"",
|
||||||
"${activity.getString(R.string.def)}0, ${activity.getString(R.string.current)}${
|
"${activity.getString(R.string.def)}0, ${activity.getString(R.string.current)}${
|
||||||
safeSP.getInt(
|
OwnSP.ownSP.getInt(
|
||||||
"big_mobile_type_icon_left_and_right_margins",
|
"big_mobile_type_icon_left_and_right_margins",
|
||||||
0
|
0
|
||||||
)
|
)
|
||||||
@@ -475,10 +514,13 @@ class SettingsActivity : MIUIActivity() {
|
|||||||
try {
|
try {
|
||||||
val value = getEditText().toInt()
|
val value = getEditText().toInt()
|
||||||
if (value in (0..30)) {
|
if (value in (0..30)) {
|
||||||
safeSP.putAny(
|
OwnSP.ownSP.edit().run {
|
||||||
|
putInt(
|
||||||
"big_mobile_type_icon_left_and_right_margins",
|
"big_mobile_type_icon_left_and_right_margins",
|
||||||
value
|
value
|
||||||
)
|
)
|
||||||
|
apply()
|
||||||
|
}
|
||||||
dismiss()
|
dismiss()
|
||||||
return@setRButton
|
return@setRButton
|
||||||
}
|
}
|
||||||
@@ -522,7 +564,7 @@ class SettingsActivity : MIUIActivity() {
|
|||||||
setEditText(
|
setEditText(
|
||||||
"",
|
"",
|
||||||
"${activity.getString(R.string.current)}${
|
"${activity.getString(R.string.current)}${
|
||||||
safeSP.getFloat(
|
OwnSP.ownSP.getFloat(
|
||||||
"battery_percentage_font_size",
|
"battery_percentage_font_size",
|
||||||
0f
|
0f
|
||||||
)
|
)
|
||||||
@@ -533,10 +575,13 @@ class SettingsActivity : MIUIActivity() {
|
|||||||
}
|
}
|
||||||
setRButton(textId = R.string.Done) {
|
setRButton(textId = R.string.Done) {
|
||||||
if (getEditText() != "") {
|
if (getEditText() != "") {
|
||||||
safeSP.putAny(
|
OwnSP.ownSP.edit().run {
|
||||||
|
putFloat(
|
||||||
"battery_percentage_font_size",
|
"battery_percentage_font_size",
|
||||||
getEditText().toFloat()
|
getEditText().toFloat()
|
||||||
)
|
)
|
||||||
|
apply()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
dismiss()
|
dismiss()
|
||||||
}
|
}
|
||||||
@@ -572,7 +617,7 @@ class SettingsActivity : MIUIActivity() {
|
|||||||
)
|
)
|
||||||
val statusBarDualRowNetworkSpeedBinding = GetDataBinding(object : DefValue {
|
val statusBarDualRowNetworkSpeedBinding = GetDataBinding(object : DefValue {
|
||||||
override fun getValue(): Any {
|
override fun getValue(): Any {
|
||||||
return safeSP.getBoolean("status_bar_dual_row_network_speed", false)
|
return getSP().getBoolean("status_bar_dual_row_network_speed", false)
|
||||||
}
|
}
|
||||||
}) { view, flags, data ->
|
}) { view, flags, data ->
|
||||||
when (flags) {
|
when (flags) {
|
||||||
@@ -596,17 +641,28 @@ class SettingsActivity : MIUIActivity() {
|
|||||||
TextWithSpinner(
|
TextWithSpinner(
|
||||||
TextV(resId = R.string.status_bar_network_speed_dual_row_gravity),
|
TextV(resId = R.string.status_bar_network_speed_dual_row_gravity),
|
||||||
SpinnerV(
|
SpinnerV(
|
||||||
align[safeSP.getInt(
|
align[OwnSP.ownSP.getInt(
|
||||||
"status_bar_network_speed_dual_row_gravity",
|
"status_bar_network_speed_dual_row_gravity",
|
||||||
0
|
0
|
||||||
)].toString()
|
)].toString()
|
||||||
) {
|
) {
|
||||||
add(align[0].toString()) {
|
add(align[0].toString()) {
|
||||||
safeSP.putAny("status_bar_network_speed_dual_row_gravity", 0)
|
OwnSP.ownSP.edit().run {
|
||||||
|
putInt(
|
||||||
|
"status_bar_network_speed_dual_row_gravity",
|
||||||
|
0
|
||||||
|
)
|
||||||
|
apply()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
add(align[1].toString()) {
|
add(align[1].toString()) {
|
||||||
safeSP.putAny("status_bar_network_speed_dual_row_gravity", 1)
|
OwnSP.ownSP.edit().run {
|
||||||
|
putInt(
|
||||||
|
"status_bar_network_speed_dual_row_gravity",
|
||||||
|
1
|
||||||
|
)
|
||||||
|
apply()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
dataBindingRecv = statusBarDualRowNetworkSpeedBinding.binding.getRecv(2)
|
dataBindingRecv = statusBarDualRowNetworkSpeedBinding.binding.getRecv(2)
|
||||||
@@ -614,25 +670,39 @@ class SettingsActivity : MIUIActivity() {
|
|||||||
TextWithSpinner(
|
TextWithSpinner(
|
||||||
TextV(resId = R.string.status_bar_network_speed_dual_row_icon),
|
TextV(resId = R.string.status_bar_network_speed_dual_row_icon),
|
||||||
SpinnerV(
|
SpinnerV(
|
||||||
safeSP.getString(
|
"${
|
||||||
|
OwnSP.ownSP.getString(
|
||||||
"status_bar_network_speed_dual_row_icon",
|
"status_bar_network_speed_dual_row_icon",
|
||||||
getString(R.string.none)
|
getString(R.string.none)
|
||||||
)
|
)
|
||||||
|
}"
|
||||||
) {
|
) {
|
||||||
add(getString(R.string.none)) {
|
add(getString(R.string.none)) {
|
||||||
safeSP.putAny(
|
OwnSP.ownSP.edit().run {
|
||||||
|
putString(
|
||||||
"status_bar_network_speed_dual_row_icon",
|
"status_bar_network_speed_dual_row_icon",
|
||||||
getString(R.string.none)
|
getString(R.string.none)
|
||||||
)
|
)
|
||||||
|
apply()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
add("▲▼") {
|
add("▲▼") {
|
||||||
safeSP.putAny("status_bar_network_speed_dual_row_icon", "▲▼")
|
OwnSP.ownSP.edit().run {
|
||||||
|
putString("status_bar_network_speed_dual_row_icon", "▲▼")
|
||||||
|
apply()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
add("△▽") {
|
add("△▽") {
|
||||||
safeSP.putAny("status_bar_network_speed_dual_row_icon", "△▽")
|
OwnSP.ownSP.edit().run {
|
||||||
|
putString("status_bar_network_speed_dual_row_icon", "△▽")
|
||||||
|
apply()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
add("↑↓") {
|
add("↑↓") {
|
||||||
safeSP.putAny("status_bar_network_speed_dual_row_icon", "↑↓")
|
OwnSP.ownSP.edit().run {
|
||||||
|
putString("status_bar_network_speed_dual_row_icon", "↑↓")
|
||||||
|
apply()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@@ -651,7 +721,7 @@ class SettingsActivity : MIUIActivity() {
|
|||||||
TitleText(resId = R.string.notification_center)
|
TitleText(resId = 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 getSP().getBoolean("notification_weather", false)
|
||||||
}
|
}
|
||||||
}) { view, flags, data ->
|
}) { view, flags, data ->
|
||||||
when (flags) {
|
when (flags) {
|
||||||
@@ -686,7 +756,7 @@ class SettingsActivity : MIUIActivity() {
|
|||||||
TitleText(resId = R.string.control_center)
|
TitleText(resId = 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 getSP().getBoolean("control_center_weather", false)
|
||||||
}
|
}
|
||||||
}) { view, flags, data ->
|
}) { view, flags, data ->
|
||||||
when (flags) {
|
when (flags) {
|
||||||
@@ -758,7 +828,7 @@ class SettingsActivity : MIUIActivity() {
|
|||||||
TitleText(resId = R.string.old_quick_settings_panel)
|
TitleText(resId = 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 getSP().getBoolean("old_qs_custom_switch", false)
|
||||||
}
|
}
|
||||||
}) { view, flags, data ->
|
}) { view, flags, data ->
|
||||||
when (flags) {
|
when (flags) {
|
||||||
@@ -890,7 +960,7 @@ class SettingsActivity : MIUIActivity() {
|
|||||||
setEditText(
|
setEditText(
|
||||||
"",
|
"",
|
||||||
"${activity.getString(R.string.def)}1.1, ${activity.getString(R.string.current)}${
|
"${activity.getString(R.string.def)}1.1, ${activity.getString(R.string.current)}${
|
||||||
safeSP.getFloat(
|
OwnSP.ownSP.getFloat(
|
||||||
"max_wallpaper_scale",
|
"max_wallpaper_scale",
|
||||||
1.1f
|
1.1f
|
||||||
)
|
)
|
||||||
@@ -901,10 +971,10 @@ class SettingsActivity : MIUIActivity() {
|
|||||||
}
|
}
|
||||||
setRButton(textId = R.string.Done) {
|
setRButton(textId = R.string.Done) {
|
||||||
if (getEditText() != "") {
|
if (getEditText() != "") {
|
||||||
safeSP.putAny(
|
OwnSP.ownSP.edit().run {
|
||||||
"max_wallpaper_scale",
|
putFloat("max_wallpaper_scale", getEditText().toFloat())
|
||||||
getEditText().toFloat()
|
apply()
|
||||||
)
|
}
|
||||||
}
|
}
|
||||||
dismiss()
|
dismiss()
|
||||||
}
|
}
|
||||||
@@ -923,7 +993,7 @@ class SettingsActivity : MIUIActivity() {
|
|||||||
val mediaVolumeStepsSwitchBinding = GetDataBinding(
|
val mediaVolumeStepsSwitchBinding = GetDataBinding(
|
||||||
object : DefValue {
|
object : DefValue {
|
||||||
override fun getValue(): Any {
|
override fun getValue(): Any {
|
||||||
return safeSP.getBoolean("media_volume_steps_switch", false)
|
return getSP().getBoolean("media_volume_steps_switch", false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
) { view, flags, data ->
|
) { view, flags, data ->
|
||||||
@@ -1103,11 +1173,6 @@ class SettingsActivity : MIUIActivity() {
|
|||||||
TextV(resId = R.string.hide_bluetooth_icon),
|
TextV(resId = R.string.hide_bluetooth_icon),
|
||||||
SwitchV("hide_bluetooth_icon")
|
SwitchV("hide_bluetooth_icon")
|
||||||
)
|
)
|
||||||
|
|
||||||
TextWithSwitch(
|
|
||||||
TextV(resId = R.string.hide_nfc_icon),
|
|
||||||
SwitchV("hide_nfc_icon")
|
|
||||||
)
|
|
||||||
TextWithSwitch(
|
TextWithSwitch(
|
||||||
TextV(resId = R.string.hide_bluetooth_battery_icon),
|
TextV(resId = R.string.hide_bluetooth_battery_icon),
|
||||||
SwitchV("hide_bluetooth_battery_icon")
|
SwitchV("hide_bluetooth_battery_icon")
|
||||||
|
|||||||
@@ -14,11 +14,12 @@ import android.widget.LinearLayout
|
|||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
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.findMethod
|
||||||
import com.github.kyuubiran.ezxhelper.utils.getObjectAs
|
|
||||||
import com.github.kyuubiran.ezxhelper.utils.hookAfter
|
import com.github.kyuubiran.ezxhelper.utils.hookAfter
|
||||||
import com.github.kyuubiran.ezxhelper.utils.hookBefore
|
import com.github.kyuubiran.ezxhelper.utils.hookBefore
|
||||||
|
import com.github.kyuubiran.ezxhelper.utils.loadClass
|
||||||
import com.lt2333.simplicitytools.util.*
|
import com.lt2333.simplicitytools.util.*
|
||||||
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||||
|
import java.lang.reflect.Field
|
||||||
|
|
||||||
object ShowBatteryTemperature : HookRegister() {
|
object ShowBatteryTemperature : HookRegister() {
|
||||||
|
|
||||||
@@ -30,26 +31,15 @@ object ShowBatteryTemperature : HookRegister() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun init() = hasEnable("battery_life_function") {
|
override fun init() = hasEnable("battery_life_function") {
|
||||||
try {
|
|
||||||
findMethod("com.miui.powercenter.a") {
|
findMethod("com.miui.powercenter.a") {
|
||||||
name == "b" && parameterTypes[0] == Context::class.java
|
name == "b" && parameterTypes[0] == Context::class.java
|
||||||
}
|
|
||||||
} catch (e : Exception) {
|
|
||||||
findMethod("com.miui.powercenter.BatteryFragment") {
|
|
||||||
name == "b" && parameterTypes[0] == Context::class.java
|
|
||||||
}
|
|
||||||
}.hookBefore {
|
}.hookBefore {
|
||||||
it.result = getBatteryTemperature(it.args[0] as Context).toString()
|
it.result = getBatteryTemperature(it.args[0] as Context).toString()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
|
||||||
findMethod("com.miui.powercenter.a\$a") {
|
findMethod("com.miui.powercenter.a\$a") {
|
||||||
name == "run"
|
name == "run"
|
||||||
}
|
|
||||||
} catch (e : Exception) {
|
|
||||||
findMethod("com.miui.powercenter.BatteryFragment\$a") {
|
|
||||||
name == "run"
|
|
||||||
}
|
|
||||||
}.hookAfter {
|
}.hookAfter {
|
||||||
val context = AndroidAppHelper.currentApplication().applicationContext
|
val context = AndroidAppHelper.currentApplication().applicationContext
|
||||||
val isDarkMode =
|
val isDarkMode =
|
||||||
@@ -59,43 +49,36 @@ object ShowBatteryTemperature : HookRegister() {
|
|||||||
"id",
|
"id",
|
||||||
"com.miui.securitycenter"
|
"com.miui.securitycenter"
|
||||||
)
|
)
|
||||||
|
val field = loadClass("com.miui.powercenter.a\$a").getDeclaredField("a") as Field
|
||||||
val view = it.thisObject.getObjectAs<View>("a")
|
field.isAccessible = true
|
||||||
|
val view = field.get(it.thisObject) as View
|
||||||
val textView = view.findViewById<TextView>(currentTemperatureValue)
|
val textView = view.findViewById<TextView>(currentTemperatureValue)
|
||||||
textView.apply {
|
(textView.layoutParams as LinearLayout.LayoutParams).marginStart = dp2px(context, 25f)
|
||||||
(layoutParams as LinearLayout.LayoutParams).marginStart = dp2px(context, 25f)
|
(textView.layoutParams as LinearLayout.LayoutParams).topMargin = 0
|
||||||
(layoutParams as LinearLayout.LayoutParams).topMargin = 0
|
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 36.399998f)
|
||||||
setTextSize(TypedValue.COMPLEX_UNIT_DIP, 36.399998f)
|
textView.setPadding(0, 0, 0, 0)
|
||||||
setPadding(0, 0, 0, 0)
|
textView.gravity = Gravity.NO_GRAVITY
|
||||||
gravity = Gravity.NO_GRAVITY
|
textView.typeface = Typeface.defaultFromStyle(Typeface.NORMAL)
|
||||||
typeface = Typeface.defaultFromStyle(Typeface.NORMAL)
|
textView.height = dp2px(context, 49.099983f)
|
||||||
height = dp2px(context, 49.099983f)
|
textView.textAlignment = View.TEXT_ALIGNMENT_VIEW_START
|
||||||
textAlignment = View.TEXT_ALIGNMENT_VIEW_START
|
|
||||||
}
|
|
||||||
|
|
||||||
val tempView = TextView(context)
|
val tempView = TextView(context)
|
||||||
tempView.apply {
|
tempView.layoutParams = LinearLayout.LayoutParams(
|
||||||
layoutParams = LinearLayout.LayoutParams(
|
|
||||||
LinearLayout.LayoutParams.MATCH_PARENT,
|
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||||
dp2px(context, 49.099983f)
|
dp2px(context, 49.099983f)
|
||||||
)
|
)
|
||||||
(layoutParams as LinearLayout.LayoutParams).marginStart =
|
(tempView.layoutParams as LinearLayout.LayoutParams).marginStart =
|
||||||
dp2px(context, 3.599976f)
|
dp2px(context, 3.599976f)
|
||||||
setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13.099977f)
|
tempView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13.099977f)
|
||||||
setTextColor(Color.parseColor(if (isDarkMode) "#e6e6e6" else "#333333"))
|
tempView.setTextColor(Color.parseColor(if (isDarkMode) "#e6e6e6" else "#333333"))
|
||||||
setPadding(0, dp2px(context, 25f), 0, 0)
|
tempView.setPadding(0, dp2px(context, 25f), 0, 0)
|
||||||
text = "℃"
|
tempView.text = "℃"
|
||||||
typeface = Typeface.create(null, 500, false)
|
tempView.typeface = Typeface.create(null, 500, false)
|
||||||
textAlignment = View.TEXT_ALIGNMENT_VIEW_START
|
tempView.textAlignment = View.TEXT_ALIGNMENT_VIEW_START
|
||||||
}
|
|
||||||
|
|
||||||
val tempeValueContainer = context.resources.getIdentifier(
|
val tempeValueContainer = context.resources.getIdentifier(
|
||||||
"tempe_value_container",
|
"tempe_value_container",
|
||||||
"id",
|
"id",
|
||||||
"com.miui.securitycenter"
|
"com.miui.securitycenter"
|
||||||
)
|
)
|
||||||
|
|
||||||
val linearLayout = view.findViewById<LinearLayout>(tempeValueContainer)
|
val linearLayout = view.findViewById<LinearLayout>(tempeValueContainer)
|
||||||
linearLayout.addView(tempView)
|
linearLayout.addView(tempView)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,10 +76,6 @@ object HideStatusBarIcon : HookRegister() {
|
|||||||
"no_sim" -> hasEnable("hide_no_sim_icon") {
|
"no_sim" -> hasEnable("hide_no_sim_icon") {
|
||||||
it.args[1] = false
|
it.args[1] = false
|
||||||
}
|
}
|
||||||
//隐藏NFC图标
|
|
||||||
"nfc" -> hasEnable("hide_nfc_icon") {
|
|
||||||
it.args[1] = false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -26,7 +26,6 @@
|
|||||||
<string name="hide_hotspot_icon">Ocultar icono de punto de accesos inalámbrico</string>
|
<string name="hide_hotspot_icon">Ocultar icono de punto de accesos inalámbrico</string>
|
||||||
<string name="hide_headset_icon">Ocultar icono de audífonos</string>
|
<string name="hide_headset_icon">Ocultar icono de audífonos</string>
|
||||||
<string name="hide_bluetooth_battery_icon">Ocultar icono de batería de Bluetooth</string>
|
<string name="hide_bluetooth_battery_icon">Ocultar icono de batería de Bluetooth</string>
|
||||||
<string name="hide_nfc_icon">Ocultar icono de NFC</string>
|
|
||||||
<string name="hide_big_hd_icon">Ocultar icono grande HD</string>
|
<string name="hide_big_hd_icon">Ocultar icono grande HD</string>
|
||||||
<string name="hide_small_hd_icon">Ocultar icono pequeño HD</string>
|
<string name="hide_small_hd_icon">Ocultar icono pequeño HD</string>
|
||||||
<string name="hide_hd_no_service_icon">Ocultar icono sin servicio HD</string>
|
<string name="hide_hd_no_service_icon">Ocultar icono sin servicio HD</string>
|
||||||
|
|||||||
@@ -26,7 +26,6 @@
|
|||||||
<string name="hide_hotspot_icon">ポータブルホットスポットアイコンを隠す</string>
|
<string name="hide_hotspot_icon">ポータブルホットスポットアイコンを隠す</string>
|
||||||
<string name="hide_headset_icon">ヘッドセットアイコンを隠す</string>
|
<string name="hide_headset_icon">ヘッドセットアイコンを隠す</string>
|
||||||
<string name="hide_bluetooth_battery_icon">Bluetooth機器のバッテリーアイコンを非表示</string>
|
<string name="hide_bluetooth_battery_icon">Bluetooth機器のバッテリーアイコンを非表示</string>
|
||||||
<string name="hide_nfc_icon">NFC アイコンを隠す</string>
|
|
||||||
<string name="hide_big_hd_icon">大きなHDアイコンを隠す</string>
|
<string name="hide_big_hd_icon">大きなHDアイコンを隠す</string>
|
||||||
<string name="hide_small_hd_icon">小さいHDアイコンを隠す</string>
|
<string name="hide_small_hd_icon">小さいHDアイコンを隠す</string>
|
||||||
<string name="hide_hd_no_service_icon">HD サービスなしアイコンを隠す</string>
|
<string name="hide_hd_no_service_icon">HD サービスなしアイコンを隠す</string>
|
||||||
|
|||||||
@@ -26,7 +26,6 @@
|
|||||||
<string name="hide_hotspot_icon">Ascunde pictograma Hotspot mobil</string>
|
<string name="hide_hotspot_icon">Ascunde pictograma Hotspot mobil</string>
|
||||||
<string name="hide_headset_icon">Ascunde pictograma căștilor</string>
|
<string name="hide_headset_icon">Ascunde pictograma căștilor</string>
|
||||||
<string name="hide_bluetooth_battery_icon">Ascunde pictograma Baterie Bluetooth</string>
|
<string name="hide_bluetooth_battery_icon">Ascunde pictograma Baterie Bluetooth</string>
|
||||||
<string name="hide_nfc_icon">Ascunde pictograma NFC</string>
|
|
||||||
<string name="hide_big_hd_icon">Ascunde pictograma HD mare</string>
|
<string name="hide_big_hd_icon">Ascunde pictograma HD mare</string>
|
||||||
<string name="hide_small_hd_icon">Ascunde pictograma HD mic</string>
|
<string name="hide_small_hd_icon">Ascunde pictograma HD mic</string>
|
||||||
<string name="hide_hd_no_service_icon">Ascunde pictograma Fără servicii HD</string>
|
<string name="hide_hd_no_service_icon">Ascunde pictograma Fără servicii HD</string>
|
||||||
|
|||||||
@@ -26,7 +26,6 @@
|
|||||||
<string name="hide_hotspot_icon">Скрыть точку доступа</string>
|
<string name="hide_hotspot_icon">Скрыть точку доступа</string>
|
||||||
<string name="hide_headset_icon">Скрыть гарнитуру</string>
|
<string name="hide_headset_icon">Скрыть гарнитуру</string>
|
||||||
<string name="hide_bluetooth_battery_icon">Скрыть батарею блютуз устройства</string>
|
<string name="hide_bluetooth_battery_icon">Скрыть батарею блютуз устройства</string>
|
||||||
<string name="hide_nfc_icon">Скрыть иконку NFC</string>
|
|
||||||
<string name="hide_big_hd_icon">Скрыть большую иконку HD</string>
|
<string name="hide_big_hd_icon">Скрыть большую иконку HD</string>
|
||||||
<string name="hide_small_hd_icon">Скрыть маленькую иконку HD</string>
|
<string name="hide_small_hd_icon">Скрыть маленькую иконку HD</string>
|
||||||
<string name="hide_hd_no_service_icon">Скрыть HD No Service</string>
|
<string name="hide_hd_no_service_icon">Скрыть HD No Service</string>
|
||||||
|
|||||||
@@ -26,7 +26,6 @@
|
|||||||
<string name="hide_hotspot_icon">隱藏 WIFI熱點 圖示</string>
|
<string name="hide_hotspot_icon">隱藏 WIFI熱點 圖示</string>
|
||||||
<string name="hide_headset_icon">隱藏 耳機 圖示</string>
|
<string name="hide_headset_icon">隱藏 耳機 圖示</string>
|
||||||
<string name="hide_bluetooth_battery_icon">隱藏 藍牙電量 圖示</string>
|
<string name="hide_bluetooth_battery_icon">隱藏 藍牙電量 圖示</string>
|
||||||
<string name="hide_nfc_icon">隱藏 NFC 圖示</string>
|
|
||||||
<string name="hide_big_hd_icon">隱藏 大HD 圖示</string>
|
<string name="hide_big_hd_icon">隱藏 大HD 圖示</string>
|
||||||
<string name="hide_small_hd_icon">隱藏 小HD 圖示</string>
|
<string name="hide_small_hd_icon">隱藏 小HD 圖示</string>
|
||||||
<string name="hide_hd_no_service_icon">隱藏 HD無服務 圖示</string>
|
<string name="hide_hd_no_service_icon">隱藏 HD無服務 圖示</string>
|
||||||
|
|||||||
@@ -28,7 +28,6 @@
|
|||||||
<string name="hide_hotspot_icon">Hide Portable hotspot icon</string>
|
<string name="hide_hotspot_icon">Hide Portable hotspot icon</string>
|
||||||
<string name="hide_headset_icon">Hide Headset icon</string>
|
<string name="hide_headset_icon">Hide Headset icon</string>
|
||||||
<string name="hide_bluetooth_battery_icon">Hide Bluetooth battery icon</string>
|
<string name="hide_bluetooth_battery_icon">Hide Bluetooth battery icon</string>
|
||||||
<string name="hide_nfc_icon">Hide NFC icon</string>
|
|
||||||
<string name="hide_big_hd_icon">Hide big HD icon</string>
|
<string name="hide_big_hd_icon">Hide big HD icon</string>
|
||||||
<string name="hide_small_hd_icon">Hide small HD icon</string>
|
<string name="hide_small_hd_icon">Hide small HD icon</string>
|
||||||
<string name="hide_hd_no_service_icon">Hide HD No Service icon</string>
|
<string name="hide_hd_no_service_icon">Hide HD No Service icon</string>
|
||||||
|
|||||||
Submodule blockmiui updated: dc01818383...bdc40161cb
Reference in New Issue
Block a user