修复连接WiFi时非上网卡显示大移动类型

This commit is contained in:
LittleTurtle2333
2023-02-17 17:31:49 +08:00
parent 90294a1599
commit f2a4f06301

View File

@@ -16,12 +16,10 @@ object StatusBarBigMobileTypeIconForT : HookRegister() {
private val getLocation = XSPUtils.getInt("big_mobile_type_location", 1) 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 = private val isOnlyShowNetwork = XSPUtils.getBoolean("big_mobile_type_only_show_network_card", false)
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") {
//使网络类型单独显示 //使网络类型单独显示
@@ -41,16 +39,13 @@ object StatusBarBigMobileTypeIconForT : HookRegister() {
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 = statusBarMobileView.findViewById<ViewGroup>(mobileContainerLeftId)
val mobileContainerLeft =
statusBarMobileView.findViewById<ViewGroup>(mobileContainerLeftId)
val mobileGroupId: Int = res.getIdentifier("mobile_group", "id", "com.android.systemui") val mobileGroupId: Int = 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)
//更改顺序 //更改顺序
@@ -70,10 +65,8 @@ object StatusBarBigMobileTypeIconForT : HookRegister() {
leftAndRightMargin, upAndDownPosition, leftAndRightMargin, 0 leftAndRightMargin, upAndDownPosition, leftAndRightMargin, 0
) )
//显示非上网卡的大图标 //显示非上网卡的大图标
if (!isOnlyShowNetwork) { if (!mobileIconState.getObjectAs<Boolean>("dataConnected") && !mobileIconState.getObjectAs<Boolean>("wifiAvailable")) {
if (!mobileIconState.getObjectAs<Boolean>("dataConnected")) { mobileTypeSingle.visibility = View.VISIBLE
mobileTypeSingle.visibility = View.VISIBLE
}
} }
} }
//显示非上网卡的大图标 //显示非上网卡的大图标
@@ -86,12 +79,10 @@ object StatusBarBigMobileTypeIconForT : HookRegister() {
val context: Context = statusBarMobileView.context val context: Context = statusBarMobileView.context
val res: Resources = context.resources val res: Resources = context.resources
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 (!mobileIconState.getObjectAs<Boolean>("dataConnected")) { if (!mobileIconState.getObjectAs<Boolean>("dataConnected") && !mobileIconState.getObjectAs<Boolean>("wifiAvailable")) {
mobileTypeSingle.visibility = View.VISIBLE mobileTypeSingle.visibility = View.VISIBLE
} }
} }