mirror of
https://github.com/LittleTurtle2333/SimplicityTools.git
synced 2026-07-14 12:21:18 +08:00
Compare commits
22 Commits
93b39c9bdb
...
068eab0cc8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
068eab0cc8 | ||
|
|
2fc199c7f2 | ||
|
|
aa59a61588 | ||
|
|
dfc217d67f | ||
|
|
a20a36674a | ||
|
|
48d9de0535 | ||
|
|
9efa453a25 | ||
|
|
8b076cc349 | ||
|
|
df2dbb7270 | ||
|
|
910861722b | ||
|
|
4d8b748711 | ||
|
|
fd4952e41d | ||
|
|
45f97315a2 | ||
|
|
9dc6f4f447 | ||
|
|
cb16367bb9 | ||
|
|
421d073d67 | ||
|
|
deb8103352 | ||
|
|
e6e3321110 | ||
|
|
62f6814ee8 | ||
|
|
2a94e1da69 | ||
|
|
94beae5f45 | ||
|
|
a63fd5510a |
@@ -10,7 +10,6 @@ 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
|
||||||
@@ -145,53 +144,29 @@ class SettingsActivity : MIUIActivity() {
|
|||||||
TextWithSpinner(
|
TextWithSpinner(
|
||||||
TextV(resId = R.string.status_bar_layout_mode),
|
TextV(resId = R.string.status_bar_layout_mode),
|
||||||
SpinnerV(
|
SpinnerV(
|
||||||
statusBarLayoutMode[OwnSP.ownSP.getInt(
|
statusBarLayoutMode[safeSP.getInt(
|
||||||
"status_bar_layout_mode",
|
"status_bar_layout_mode",
|
||||||
0
|
0
|
||||||
)].toString()
|
)].toString()
|
||||||
) {
|
) {
|
||||||
add(statusBarLayoutMode[0].toString()) {
|
add(statusBarLayoutMode[0].toString()) {
|
||||||
OwnSP.ownSP.edit().run {
|
safeSP.putAny("status_bar_layout_mode", 0)
|
||||||
putInt(
|
|
||||||
"status_bar_layout_mode",
|
|
||||||
0
|
|
||||||
)
|
|
||||||
apply()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
add(statusBarLayoutMode[1].toString()) {
|
add(statusBarLayoutMode[1].toString()) {
|
||||||
OwnSP.ownSP.edit().run {
|
safeSP.putAny("status_bar_layout_mode", 1)
|
||||||
putInt(
|
|
||||||
"status_bar_layout_mode",
|
|
||||||
1
|
|
||||||
)
|
|
||||||
apply()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
add(statusBarLayoutMode[2].toString()) {
|
add(statusBarLayoutMode[2].toString()) {
|
||||||
OwnSP.ownSP.edit().run {
|
safeSP.putAny("status_bar_layout_mode", 2)
|
||||||
putInt(
|
|
||||||
"status_bar_layout_mode",
|
|
||||||
2
|
|
||||||
)
|
|
||||||
apply()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
add(statusBarLayoutMode[3].toString()) {
|
add(statusBarLayoutMode[3].toString()) {
|
||||||
OwnSP.ownSP.edit().run {
|
safeSP.putAny("status_bar_layout_mode", 3)
|
||||||
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 getSP().getBoolean("layout_compatibility_mode", false)
|
return safeSP.getBoolean("layout_compatibility_mode", false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
) { view, flags, data ->
|
) { view, flags, data ->
|
||||||
@@ -236,7 +211,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 getSP().getBoolean("custom_clock_switch", false)
|
return safeSP.getBoolean("custom_clock_switch", false)
|
||||||
}
|
}
|
||||||
}) { view, flags, data ->
|
}) { view, flags, data ->
|
||||||
when (flags) {
|
when (flags) {
|
||||||
@@ -327,7 +302,7 @@ class SettingsActivity : MIUIActivity() {
|
|||||||
)
|
)
|
||||||
val customMobileTypeTextBinding = GetDataBinding(object : DefValue {
|
val customMobileTypeTextBinding = GetDataBinding(object : DefValue {
|
||||||
override fun getValue(): Any {
|
override fun getValue(): Any {
|
||||||
return getSP().getBoolean("custom_mobile_type_text_switch", false)
|
return safeSP.getBoolean("custom_mobile_type_text_switch", false)
|
||||||
}
|
}
|
||||||
}) { view, flags, data ->
|
}) { view, flags, data ->
|
||||||
when (flags) {
|
when (flags) {
|
||||||
@@ -351,11 +326,9 @@ 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) {
|
||||||
@@ -364,13 +337,7 @@ class SettingsActivity : MIUIActivity() {
|
|||||||
setRButton(textId = R.string.Done) {
|
setRButton(textId = R.string.Done) {
|
||||||
if (getEditText().isNotEmpty()) {
|
if (getEditText().isNotEmpty()) {
|
||||||
try {
|
try {
|
||||||
OwnSP.ownSP.edit().run {
|
safeSP.putAny("custom_mobile_type_text", getEditText())
|
||||||
putString(
|
|
||||||
"custom_mobile_type_text",
|
|
||||||
getEditText()
|
|
||||||
)
|
|
||||||
apply()
|
|
||||||
}
|
|
||||||
dismiss()
|
dismiss()
|
||||||
return@setRButton
|
return@setRButton
|
||||||
} catch (_: Throwable) {
|
} catch (_: Throwable) {
|
||||||
@@ -387,7 +354,7 @@ class SettingsActivity : MIUIActivity() {
|
|||||||
)
|
)
|
||||||
val bigMobileTypeIconBinding = GetDataBinding(object : DefValue {
|
val bigMobileTypeIconBinding = GetDataBinding(object : DefValue {
|
||||||
override fun getValue(): Any {
|
override fun getValue(): Any {
|
||||||
return getSP().getBoolean("big_mobile_type_icon", false)
|
return safeSP.getBoolean("big_mobile_type_icon", false)
|
||||||
}
|
}
|
||||||
}) { view, flags, data ->
|
}) { view, flags, data ->
|
||||||
when (flags) {
|
when (flags) {
|
||||||
@@ -420,7 +387,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)}${
|
||||||
OwnSP.ownSP.getFloat(
|
safeSP.getFloat(
|
||||||
"big_mobile_type_icon_size",
|
"big_mobile_type_icon_size",
|
||||||
12.5f
|
12.5f
|
||||||
)
|
)
|
||||||
@@ -431,13 +398,10 @@ class SettingsActivity : MIUIActivity() {
|
|||||||
}
|
}
|
||||||
setRButton(textId = R.string.Done) {
|
setRButton(textId = R.string.Done) {
|
||||||
if (getEditText() != "") {
|
if (getEditText() != "") {
|
||||||
OwnSP.ownSP.edit().run {
|
safeSP.putAny(
|
||||||
putFloat(
|
"big_mobile_type_icon_size",
|
||||||
"big_mobile_type_icon_size",
|
getEditText().toFloat()
|
||||||
getEditText().toFloat()
|
)
|
||||||
)
|
|
||||||
apply()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
dismiss()
|
dismiss()
|
||||||
}
|
}
|
||||||
@@ -454,7 +418,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)}${
|
||||||
OwnSP.ownSP.getInt(
|
safeSP.getInt(
|
||||||
"big_mobile_type_icon_up_and_down_position",
|
"big_mobile_type_icon_up_and_down_position",
|
||||||
0
|
0
|
||||||
)
|
)
|
||||||
@@ -468,13 +432,10 @@ class SettingsActivity : MIUIActivity() {
|
|||||||
try {
|
try {
|
||||||
val value = getEditText().toInt()
|
val value = getEditText().toInt()
|
||||||
if (value in (-15..15)) {
|
if (value in (-15..15)) {
|
||||||
OwnSP.ownSP.edit().run {
|
safeSP.putAny(
|
||||||
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
|
||||||
}
|
}
|
||||||
@@ -500,7 +461,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)}${
|
||||||
OwnSP.ownSP.getInt(
|
safeSP.getInt(
|
||||||
"big_mobile_type_icon_left_and_right_margins",
|
"big_mobile_type_icon_left_and_right_margins",
|
||||||
0
|
0
|
||||||
)
|
)
|
||||||
@@ -514,13 +475,10 @@ class SettingsActivity : MIUIActivity() {
|
|||||||
try {
|
try {
|
||||||
val value = getEditText().toInt()
|
val value = getEditText().toInt()
|
||||||
if (value in (0..30)) {
|
if (value in (0..30)) {
|
||||||
OwnSP.ownSP.edit().run {
|
safeSP.putAny(
|
||||||
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
|
||||||
}
|
}
|
||||||
@@ -564,7 +522,7 @@ class SettingsActivity : MIUIActivity() {
|
|||||||
setEditText(
|
setEditText(
|
||||||
"",
|
"",
|
||||||
"${activity.getString(R.string.current)}${
|
"${activity.getString(R.string.current)}${
|
||||||
OwnSP.ownSP.getFloat(
|
safeSP.getFloat(
|
||||||
"battery_percentage_font_size",
|
"battery_percentage_font_size",
|
||||||
0f
|
0f
|
||||||
)
|
)
|
||||||
@@ -575,13 +533,10 @@ class SettingsActivity : MIUIActivity() {
|
|||||||
}
|
}
|
||||||
setRButton(textId = R.string.Done) {
|
setRButton(textId = R.string.Done) {
|
||||||
if (getEditText() != "") {
|
if (getEditText() != "") {
|
||||||
OwnSP.ownSP.edit().run {
|
safeSP.putAny(
|
||||||
putFloat(
|
"battery_percentage_font_size",
|
||||||
"battery_percentage_font_size",
|
getEditText().toFloat()
|
||||||
getEditText().toFloat()
|
)
|
||||||
)
|
|
||||||
apply()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
dismiss()
|
dismiss()
|
||||||
}
|
}
|
||||||
@@ -617,7 +572,7 @@ class SettingsActivity : MIUIActivity() {
|
|||||||
)
|
)
|
||||||
val statusBarDualRowNetworkSpeedBinding = GetDataBinding(object : DefValue {
|
val statusBarDualRowNetworkSpeedBinding = GetDataBinding(object : DefValue {
|
||||||
override fun getValue(): Any {
|
override fun getValue(): Any {
|
||||||
return getSP().getBoolean("status_bar_dual_row_network_speed", false)
|
return safeSP.getBoolean("status_bar_dual_row_network_speed", false)
|
||||||
}
|
}
|
||||||
}) { view, flags, data ->
|
}) { view, flags, data ->
|
||||||
when (flags) {
|
when (flags) {
|
||||||
@@ -641,28 +596,17 @@ 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[OwnSP.ownSP.getInt(
|
align[safeSP.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()) {
|
||||||
OwnSP.ownSP.edit().run {
|
safeSP.putAny("status_bar_network_speed_dual_row_gravity", 0)
|
||||||
putInt(
|
|
||||||
"status_bar_network_speed_dual_row_gravity",
|
|
||||||
0
|
|
||||||
)
|
|
||||||
apply()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
add(align[1].toString()) {
|
add(align[1].toString()) {
|
||||||
OwnSP.ownSP.edit().run {
|
safeSP.putAny("status_bar_network_speed_dual_row_gravity", 1)
|
||||||
putInt(
|
|
||||||
"status_bar_network_speed_dual_row_gravity",
|
|
||||||
1
|
|
||||||
)
|
|
||||||
apply()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
dataBindingRecv = statusBarDualRowNetworkSpeedBinding.binding.getRecv(2)
|
dataBindingRecv = statusBarDualRowNetworkSpeedBinding.binding.getRecv(2)
|
||||||
@@ -670,39 +614,25 @@ 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",
|
||||||
|
getString(R.string.none)
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
add(getString(R.string.none)) {
|
||||||
|
safeSP.putAny(
|
||||||
"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)) {
|
|
||||||
OwnSP.ownSP.edit().run {
|
|
||||||
putString(
|
|
||||||
"status_bar_network_speed_dual_row_icon",
|
|
||||||
getString(R.string.none)
|
|
||||||
)
|
|
||||||
apply()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
add("▲▼") {
|
add("▲▼") {
|
||||||
OwnSP.ownSP.edit().run {
|
safeSP.putAny("status_bar_network_speed_dual_row_icon", "▲▼")
|
||||||
putString("status_bar_network_speed_dual_row_icon", "▲▼")
|
|
||||||
apply()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
add("△▽") {
|
add("△▽") {
|
||||||
OwnSP.ownSP.edit().run {
|
safeSP.putAny("status_bar_network_speed_dual_row_icon", "△▽")
|
||||||
putString("status_bar_network_speed_dual_row_icon", "△▽")
|
|
||||||
apply()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
add("↑↓") {
|
add("↑↓") {
|
||||||
OwnSP.ownSP.edit().run {
|
safeSP.putAny("status_bar_network_speed_dual_row_icon", "↑↓")
|
||||||
putString("status_bar_network_speed_dual_row_icon", "↑↓")
|
|
||||||
apply()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
@@ -721,7 +651,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 getSP().getBoolean("notification_weather", false)
|
return safeSP.getBoolean("notification_weather", false)
|
||||||
}
|
}
|
||||||
}) { view, flags, data ->
|
}) { view, flags, data ->
|
||||||
when (flags) {
|
when (flags) {
|
||||||
@@ -756,7 +686,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 getSP().getBoolean("control_center_weather", false)
|
return safeSP.getBoolean("control_center_weather", false)
|
||||||
}
|
}
|
||||||
}) { view, flags, data ->
|
}) { view, flags, data ->
|
||||||
when (flags) {
|
when (flags) {
|
||||||
@@ -828,7 +758,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 getSP().getBoolean("old_qs_custom_switch", false)
|
return safeSP.getBoolean("old_qs_custom_switch", false)
|
||||||
}
|
}
|
||||||
}) { view, flags, data ->
|
}) { view, flags, data ->
|
||||||
when (flags) {
|
when (flags) {
|
||||||
@@ -960,7 +890,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)}${
|
||||||
OwnSP.ownSP.getFloat(
|
safeSP.getFloat(
|
||||||
"max_wallpaper_scale",
|
"max_wallpaper_scale",
|
||||||
1.1f
|
1.1f
|
||||||
)
|
)
|
||||||
@@ -971,10 +901,10 @@ class SettingsActivity : MIUIActivity() {
|
|||||||
}
|
}
|
||||||
setRButton(textId = R.string.Done) {
|
setRButton(textId = R.string.Done) {
|
||||||
if (getEditText() != "") {
|
if (getEditText() != "") {
|
||||||
OwnSP.ownSP.edit().run {
|
safeSP.putAny(
|
||||||
putFloat("max_wallpaper_scale", getEditText().toFloat())
|
"max_wallpaper_scale",
|
||||||
apply()
|
getEditText().toFloat()
|
||||||
}
|
)
|
||||||
}
|
}
|
||||||
dismiss()
|
dismiss()
|
||||||
}
|
}
|
||||||
@@ -993,7 +923,7 @@ class SettingsActivity : MIUIActivity() {
|
|||||||
val mediaVolumeStepsSwitchBinding = GetDataBinding(
|
val mediaVolumeStepsSwitchBinding = GetDataBinding(
|
||||||
object : DefValue {
|
object : DefValue {
|
||||||
override fun getValue(): Any {
|
override fun getValue(): Any {
|
||||||
return getSP().getBoolean("media_volume_steps_switch", false)
|
return safeSP.getBoolean("media_volume_steps_switch", false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
) { view, flags, data ->
|
) { view, flags, data ->
|
||||||
@@ -1173,6 +1103,11 @@ 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,12 +14,11 @@ 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() {
|
||||||
|
|
||||||
@@ -31,15 +30,26 @@ object ShowBatteryTemperature : HookRegister() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun init() = hasEnable("battery_life_function") {
|
override fun init() = hasEnable("battery_life_function") {
|
||||||
findMethod("com.miui.powercenter.a") {
|
try {
|
||||||
name == "b" && parameterTypes[0] == Context::class.java
|
findMethod("com.miui.powercenter.a") {
|
||||||
|
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()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
findMethod("com.miui.powercenter.a\$a") {
|
try {
|
||||||
name == "run"
|
findMethod("com.miui.powercenter.a\$a") {
|
||||||
|
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 =
|
||||||
@@ -49,36 +59,43 @@ object ShowBatteryTemperature : HookRegister() {
|
|||||||
"id",
|
"id",
|
||||||
"com.miui.securitycenter"
|
"com.miui.securitycenter"
|
||||||
)
|
)
|
||||||
val field = loadClass("com.miui.powercenter.a\$a").getDeclaredField("a") as Field
|
|
||||||
field.isAccessible = true
|
val view = it.thisObject.getObjectAs<View>("a")
|
||||||
val view = field.get(it.thisObject) as View
|
|
||||||
val textView = view.findViewById<TextView>(currentTemperatureValue)
|
val textView = view.findViewById<TextView>(currentTemperatureValue)
|
||||||
(textView.layoutParams as LinearLayout.LayoutParams).marginStart = dp2px(context, 25f)
|
textView.apply {
|
||||||
(textView.layoutParams as LinearLayout.LayoutParams).topMargin = 0
|
(layoutParams as LinearLayout.LayoutParams).marginStart = dp2px(context, 25f)
|
||||||
textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 36.399998f)
|
(layoutParams as LinearLayout.LayoutParams).topMargin = 0
|
||||||
textView.setPadding(0, 0, 0, 0)
|
setTextSize(TypedValue.COMPLEX_UNIT_DIP, 36.399998f)
|
||||||
textView.gravity = Gravity.NO_GRAVITY
|
setPadding(0, 0, 0, 0)
|
||||||
textView.typeface = Typeface.defaultFromStyle(Typeface.NORMAL)
|
gravity = Gravity.NO_GRAVITY
|
||||||
textView.height = dp2px(context, 49.099983f)
|
typeface = Typeface.defaultFromStyle(Typeface.NORMAL)
|
||||||
textView.textAlignment = View.TEXT_ALIGNMENT_VIEW_START
|
height = dp2px(context, 49.099983f)
|
||||||
|
textAlignment = View.TEXT_ALIGNMENT_VIEW_START
|
||||||
|
}
|
||||||
|
|
||||||
val tempView = TextView(context)
|
val tempView = TextView(context)
|
||||||
tempView.layoutParams = LinearLayout.LayoutParams(
|
tempView.apply {
|
||||||
LinearLayout.LayoutParams.MATCH_PARENT,
|
layoutParams = LinearLayout.LayoutParams(
|
||||||
dp2px(context, 49.099983f)
|
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||||
)
|
dp2px(context, 49.099983f)
|
||||||
(tempView.layoutParams as LinearLayout.LayoutParams).marginStart =
|
)
|
||||||
dp2px(context, 3.599976f)
|
(layoutParams as LinearLayout.LayoutParams).marginStart =
|
||||||
tempView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13.099977f)
|
dp2px(context, 3.599976f)
|
||||||
tempView.setTextColor(Color.parseColor(if (isDarkMode) "#e6e6e6" else "#333333"))
|
setTextSize(TypedValue.COMPLEX_UNIT_DIP, 13.099977f)
|
||||||
tempView.setPadding(0, dp2px(context, 25f), 0, 0)
|
setTextColor(Color.parseColor(if (isDarkMode) "#e6e6e6" else "#333333"))
|
||||||
tempView.text = "℃"
|
setPadding(0, dp2px(context, 25f), 0, 0)
|
||||||
tempView.typeface = Typeface.create(null, 500, false)
|
text = "℃"
|
||||||
tempView.textAlignment = View.TEXT_ALIGNMENT_VIEW_START
|
typeface = Typeface.create(null, 500, false)
|
||||||
|
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,6 +76,10 @@ 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,6 +26,7 @@
|
|||||||
<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,6 +26,7 @@
|
|||||||
<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,6 +26,7 @@
|
|||||||
<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,6 +26,7 @@
|
|||||||
<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,6 +26,7 @@
|
|||||||
<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,6 +28,7 @@
|
|||||||
<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: bdc40161cb...dc01818383
Reference in New Issue
Block a user