mirror of
https://github.com/LittleTurtle2333/SimplicityTools.git
synced 2026-07-12 19:31:17 +08:00
update blockmiui
This commit is contained in:
@@ -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 ->
|
||||||
|
|||||||
Submodule blockmiui updated: bdc40161cb...dc01818383
Reference in New Issue
Block a user