Compare commits

5 Commits

Author SHA1 Message Date
LittleTurtle2333
2b36ad29d8 修复A13开启大移动类型图标后非上网卡显示箭头 2023-02-16 00:37:08 +08:00
LittleTurtle2333
3e0d94ab81 更新版本号至1.7.1 2023-02-15 22:04:27 +08:00
LittleTurtle2333
7914d51168 新增A13大移动类型图标显示位置 2023-02-15 22:01:30 +08:00
LittleTurtle2333
d8cf1bdc34 Merge remote-tracking branch 'origin/main' 2023-02-15 22:01:03 +08:00
LittleTurtle2333
2f69115907 新增A13大移动类型图标仅显示上网卡 2023-02-15 22:00:39 +08:00
5 changed files with 91 additions and 26 deletions

View File

@@ -11,8 +11,8 @@ android {
applicationId = "com.lt2333.simplicitytools" applicationId = "com.lt2333.simplicitytools"
minSdk = 31 minSdk = 31
targetSdk = 33 targetSdk = 33
versionCode = 70 versionCode = 71
versionName = "1.7.0" versionName = "1.7.1"
buildConfigField("String", "BUILD_TIME", "\"${System.currentTimeMillis()}\"") buildConfigField("String", "BUILD_TIME", "\"${System.currentTimeMillis()}\"")
} }

View File

@@ -12,7 +12,6 @@ import cn.fkj233.ui.activity.view.TextSummaryV
import cn.fkj233.ui.activity.view.TextV import cn.fkj233.ui.activity.view.TextV
import cn.fkj233.ui.dialog.MIUIDialog import cn.fkj233.ui.dialog.MIUIDialog
import com.lt2333.simplicitytools.R import com.lt2333.simplicitytools.R
import java.util.HashMap
@BMPage("scope_systemui", "System UI", hideMenu = false) @BMPage("scope_systemui", "System UI", hideMenu = false)
@@ -151,7 +150,12 @@ class SystemUIPageForT : BasePage() {
} }
TextWithSpinner( TextWithSpinner(
TextV(textId = R.string.custom_clock_mode), TextV(textId = R.string.custom_clock_mode),
SpinnerV(customClockMode[MIUIActivity.safeSP.getInt("custom_clock_mode", 0)].toString()) { SpinnerV(
customClockMode[MIUIActivity.safeSP.getInt(
"custom_clock_mode",
0
)].toString()
) {
add(customClockMode[0].toString()) { add(customClockMode[0].toString()) {
MIUIActivity.safeSP.putAny("custom_clock_mode", 0) MIUIActivity.safeSP.putAny("custom_clock_mode", 0)
customClockPresetBinding.binding.Send().send(false) customClockPresetBinding.binding.Send().send(false)
@@ -248,7 +252,11 @@ class SystemUIPageForT : BasePage() {
TextSummaryArrow(TextSummaryV(textId = R.string.custom_clock_format_geek) { TextSummaryArrow(TextSummaryV(textId = R.string.custom_clock_format_geek) {
MIUIDialog(activity) { MIUIDialog(activity) {
setTitle(R.string.custom_clock_format_geek) setTitle(R.string.custom_clock_format_geek)
setEditText(MIUIActivity.safeSP.getString("custom_clock_format_geek", "HH:mm:ss"), "", isSingleLine = false) setEditText(
MIUIActivity.safeSP.getString("custom_clock_format_geek", "HH:mm:ss"),
"",
isSingleLine = false
)
setLButton(textId = R.string.cancel) { setLButton(textId = R.string.cancel) {
dismiss() dismiss()
} }
@@ -353,6 +361,32 @@ class SystemUIPageForT : BasePage() {
dataBindingSend = bigMobileTypeIconBinding.bindingSend dataBindingSend = bigMobileTypeIconBinding.bindingSend
) )
) )
val bigMobileTypeLocation: HashMap<Int, String> = hashMapOf<Int, String>().also {
it[0] = getString(R.string.left)
it[1] = getString(R.string.right)
}
TextWithSpinner(
TextV(textId = R.string.big_mobile_type_location),
SpinnerV(
bigMobileTypeLocation[MIUIActivity.safeSP.getInt(
"big_mobile_type_location",
1
)].toString()
) {
add(bigMobileTypeLocation[0].toString()) {
MIUIActivity.safeSP.putAny("big_mobile_type_location", 0)
}
add(bigMobileTypeLocation[1].toString()) {
MIUIActivity.safeSP.putAny("big_mobile_type_location", 1)
}
},
dataBindingRecv = bigMobileTypeIconBinding.binding.getRecv(2)
)
TextSummaryWithSwitch(
TextSummaryV(textId = R.string.big_mobile_type_only_show_network_card),
SwitchV("big_mobile_type_only_show_network_card", false),
dataBindingRecv = bigMobileTypeIconBinding.binding.getRecv(2)
)
TextSummaryWithSwitch( TextSummaryWithSwitch(
TextSummaryV(textId = R.string.big_mobile_type_icon_bold), TextSummaryV(textId = R.string.big_mobile_type_icon_bold),
SwitchV("big_mobile_type_icon_bold", true), SwitchV("big_mobile_type_icon_bold", true),

View File

@@ -3,11 +3,8 @@ package com.lt2333.simplicitytools.hooks.rules.t.systemui
import android.content.Context import android.content.Context
import android.content.res.Resources import android.content.res.Resources
import android.graphics.Typeface import android.graphics.Typeface
import android.util.TypedValue import android.view.View
import android.view.Gravity
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.ImageView
import android.widget.LinearLayout
import android.widget.TextView import android.widget.TextView
import com.github.kyuubiran.ezxhelper.utils.* import com.github.kyuubiran.ezxhelper.utils.*
import com.lt2333.simplicitytools.utils.XSPUtils import com.lt2333.simplicitytools.utils.XSPUtils
@@ -17,11 +14,14 @@ import com.lt2333.simplicitytools.utils.xposed.base.HookRegister
object StatusBarBigMobileTypeIconForT : HookRegister() { object StatusBarBigMobileTypeIconForT : HookRegister() {
private val getLocation = XSPUtils.getInt("big_mobile_type_location", 1)
private val upAndDownPosition = XSPUtils.getInt("big_mobile_type_icon_up_and_down_position", 0) private val upAndDownPosition = XSPUtils.getInt("big_mobile_type_icon_up_and_down_position", 0)
private val leftAndRightMargin = private val leftAndRightMargin =
XSPUtils.getInt("big_mobile_type_icon_left_and_right_margins", 0) XSPUtils.getInt("big_mobile_type_icon_left_and_right_margins", 0)
private val isBold = XSPUtils.getBoolean("big_mobile_type_icon_bold", true) private val isBold = XSPUtils.getBoolean("big_mobile_type_icon_bold", true)
private val size = XSPUtils.getFloat("big_mobile_type_icon_size", 12.5f) private val size = XSPUtils.getFloat("big_mobile_type_icon_size", 12.5f)
private val isOnlyShowNetwork =
XSPUtils.getBoolean("big_mobile_type_only_show_network_card", false)
override fun init() = hasEnable("big_mobile_type_icon") { override fun init() = hasEnable("big_mobile_type_icon") {
//使网络类型单独显示 //使网络类型单独显示
@@ -33,42 +33,68 @@ object StatusBarBigMobileTypeIconForT : HookRegister() {
} }
findMethod("com.android.systemui.statusbar.StatusBarMobileView") { findMethod("com.android.systemui.statusbar.StatusBarMobileView") {
name == "init" name == "initViewState"
}.hookAfter { }.hookAfter {
val mobileIconState = it.args[0]
val statusBarMobileView = it.thisObject as ViewGroup val statusBarMobileView = it.thisObject as ViewGroup
val context: Context = statusBarMobileView.context val context: Context = statusBarMobileView.context
val res: Resources = context.resources val res: Resources = context.resources
//获取组件 //获取组件
val mobileContainerLeftId: Int = val mobileContainerLeftId: Int =
res.getIdentifier("mobile_container_left", "id", "com.android.systemui") res.getIdentifier("mobile_container_left", "id", "com.android.systemui")
val mobileContainerLeft = val mobileContainerLeft =
statusBarMobileView.findViewById<ViewGroup>(mobileContainerLeftId) statusBarMobileView.findViewById<ViewGroup>(mobileContainerLeftId)
val mobileGroupId: Int = val mobileGroupId: Int = res.getIdentifier("mobile_group", "id", "com.android.systemui")
res.getIdentifier("mobile_group", "id", "com.android.systemui") val mobileGroup = statusBarMobileView.findViewById<ViewGroup>(mobileGroupId)
val mobileGroup =
statusBarMobileView.findViewById<ViewGroup>(mobileGroupId)
val mobileTypeSingleId: Int = val mobileTypeSingleId: Int =
res.getIdentifier("mobile_type_single", "id", "com.android.systemui") res.getIdentifier("mobile_type_single", "id", "com.android.systemui")
val mobileTypeSingle = statusBarMobileView.findViewById<TextView>(mobileTypeSingleId) val mobileTypeSingle = statusBarMobileView.findViewById<TextView>(mobileTypeSingleId)
//更改顺序 //更改顺序
if (getLocation == 1) {
mobileGroup.removeView(mobileTypeSingle) mobileGroup.removeView(mobileTypeSingle)
mobileGroup.addView(mobileTypeSingle) mobileGroup.addView(mobileTypeSingle)
mobileGroup.removeView(mobileContainerLeft) mobileGroup.removeView(mobileContainerLeft)
mobileGroup.addView(mobileContainerLeft) mobileGroup.addView(mobileContainerLeft)
}
//更改样式 //更改样式
mobileTypeSingle.textSize = size mobileTypeSingle.textSize = size
if (isBold) { if (isBold) {
mobileTypeSingle.typeface = Typeface.DEFAULT_BOLD mobileTypeSingle.typeface = Typeface.DEFAULT_BOLD
} }
mobileTypeSingle.setPadding(leftAndRightMargin, upAndDownPosition, mobileTypeSingle.setPadding(
leftAndRightMargin,0) leftAndRightMargin, upAndDownPosition, leftAndRightMargin, 0
)
//显示非上网卡的大图标
if (!isOnlyShowNetwork) {
if (!mobileIconState.getObjectAs<Boolean>("dataConnected")) {
mobileTypeSingle.visibility = View.VISIBLE
} }
} }
}
//显示非上网卡的大图标
if (!isOnlyShowNetwork) {
findMethod("com.android.systemui.statusbar.StatusBarMobileView") {
name == "updateState"
}.hookAfter {
val mobileIconState = it.args[0]
val statusBarMobileView = it.thisObject as ViewGroup
val context: Context = statusBarMobileView.context
val res: Resources = context.resources
val mobileTypeSingleId: Int =
res.getIdentifier("mobile_type_single", "id", "com.android.systemui")
val mobileTypeSingle =
statusBarMobileView.findViewById<TextView>(mobileTypeSingleId)
if (!mobileIconState.getObjectAs<Boolean>("dataConnected")) {
mobileTypeSingle.visibility = View.VISIBLE
}
}
}
}
} }

View File

@@ -235,4 +235,7 @@
<string name="make_millet_ignore_active_summary">非常激进,可能会影响应用运行</string> <string name="make_millet_ignore_active_summary">非常激进,可能会影响应用运行</string>
<string name="pkg_installer">应用包管理组件</string> <string name="pkg_installer">应用包管理组件</string>
<string name="pkg_installer_summary">禁用频繁安装应用检查</string> <string name="pkg_installer_summary">禁用频繁安装应用检查</string>
<string name="big_mobile_type_only_show_network_card">大移动类型图标仅显示上网卡</string>
<string name="big_mobile_type_location">大移动类型图标位置</string>
</resources> </resources>

View File

@@ -239,4 +239,6 @@
<string name="make_millet_ignore_active_summary">Very aggressive and may affect application running</string> <string name="make_millet_ignore_active_summary">Very aggressive and may affect application running</string>
<string name="pkg_installer">Package Installer</string> <string name="pkg_installer">Package Installer</string>
<string name="pkg_installer_summary">Disable the app installation\'s count checking</string> <string name="pkg_installer_summary">Disable the app installation\'s count checking</string>
<string name="big_mobile_type_only_show_network_card">Big mobile type only show network card</string>
<string name="big_mobile_type_location">Big mobile type location</string>
</resources> </resources>