新增A13大移动类型图标仅显示上网卡

This commit is contained in:
LittleTurtle2333
2023-02-15 22:00:39 +08:00
parent 179c82d563
commit 2f69115907

View File

@@ -3,13 +3,12 @@ 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.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.findMethod
import com.github.kyuubiran.ezxhelper.utils.hookAfter
import com.github.kyuubiran.ezxhelper.utils.hookBefore
import com.github.kyuubiran.ezxhelper.utils.putObject
import com.lt2333.simplicitytools.utils.XSPUtils import com.lt2333.simplicitytools.utils.XSPUtils
import com.lt2333.simplicitytools.utils.hasEnable import com.lt2333.simplicitytools.utils.hasEnable
import com.lt2333.simplicitytools.utils.xposed.base.HookRegister import com.lt2333.simplicitytools.utils.xposed.base.HookRegister
@@ -18,10 +17,10 @@ import com.lt2333.simplicitytools.utils.xposed.base.HookRegister
object StatusBarBigMobileTypeIconForT : HookRegister() { object StatusBarBigMobileTypeIconForT : HookRegister() {
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") {
//使网络类型单独显示 //使网络类型单独显示
@@ -30,6 +29,7 @@ object StatusBarBigMobileTypeIconForT : HookRegister() {
}.hookBefore { }.hookBefore {
val mobileIconState = it.args[0] val mobileIconState = it.args[0]
mobileIconState.putObject("showMobileDataTypeSingle", true) mobileIconState.putObject("showMobileDataTypeSingle", true)
if (!isOnlyShowNetwork) mobileIconState.putObject("dataConnected", true)
} }
findMethod("com.android.systemui.statusbar.StatusBarMobileView") { findMethod("com.android.systemui.statusbar.StatusBarMobileView") {
@@ -66,8 +66,10 @@ object StatusBarBigMobileTypeIconForT : HookRegister() {
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
)
} }
} }