mirror of
https://github.com/LittleTurtle2333/SimplicityTools.git
synced 2026-07-12 19:31:17 +08:00
更新居中挖孔兼容模式(网速右显)
This commit is contained in:
@@ -11,15 +11,16 @@ import android.widget.LinearLayout
|
|||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import androidx.constraintlayout.widget.ConstraintLayout
|
import androidx.constraintlayout.widget.ConstraintLayout
|
||||||
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.*
|
||||||
import com.github.kyuubiran.ezxhelper.utils.getObjectAs
|
|
||||||
import com.github.kyuubiran.ezxhelper.utils.hookAfter
|
|
||||||
import com.lt2333.simplicitytools.util.XSPUtils
|
import com.lt2333.simplicitytools.util.XSPUtils
|
||||||
import com.lt2333.simplicitytools.util.hasEnable
|
import com.lt2333.simplicitytools.util.hasEnable
|
||||||
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||||
|
|
||||||
object StatusBarLayout : HookRegister() {
|
object StatusBarLayout : HookRegister() {
|
||||||
|
|
||||||
|
private val getMode = XSPUtils.getInt("status_bar_layout_mode", 0)
|
||||||
|
private val getHoleLocation = XSPUtils.getInt("screen_hole_location", 0)
|
||||||
|
|
||||||
private var statusBarLeft = 0
|
private var statusBarLeft = 0
|
||||||
private var statusBarTop = 0
|
private var statusBarTop = 0
|
||||||
private var statusBarRight = 0
|
private var statusBarRight = 0
|
||||||
@@ -46,7 +47,16 @@ object StatusBarLayout : HookRegister() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
when (XSPUtils.getInt("status_bar_layout_mode", 0)) {
|
//判断是否开启居中挖孔兼容模式
|
||||||
|
if (getHoleLocation == 1) {
|
||||||
|
findMethod("com.android.systemui.ScreenDecorations\$DisplayCutoutView") {
|
||||||
|
name == "boundsFromDirection" && parameterCount == 3 && isStatic
|
||||||
|
}.hookBefore {
|
||||||
|
it.args[1] = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
when (getMode) {
|
||||||
//默认
|
//默认
|
||||||
0 -> return
|
0 -> return
|
||||||
//时钟居中
|
//时钟居中
|
||||||
@@ -150,7 +160,7 @@ object StatusBarLayout : HookRegister() {
|
|||||||
statusBarBottom = statusBar!!.paddingBottom
|
statusBarBottom = statusBar!!.paddingBottom
|
||||||
|
|
||||||
|
|
||||||
if (XSPUtils.getBoolean("layout_compatibility_mode", false)) {
|
if (getHoleLocation == 2) {
|
||||||
val customLeftMargin = XSPUtils.getInt("status_bar_left_margin", 0)
|
val customLeftMargin = XSPUtils.getInt("status_bar_left_margin", 0)
|
||||||
if (customLeftMargin != 0) {
|
if (customLeftMargin != 0) {
|
||||||
statusBarLeft = customLeftMargin
|
statusBarLeft = customLeftMargin
|
||||||
@@ -365,7 +375,7 @@ object StatusBarLayout : HookRegister() {
|
|||||||
statusBarBottom = statusBar!!.paddingBottom
|
statusBarBottom = statusBar!!.paddingBottom
|
||||||
|
|
||||||
|
|
||||||
if (XSPUtils.getBoolean("layout_compatibility_mode", false)) {
|
if (getHoleLocation == 2) {
|
||||||
val customLeftMargin = XSPUtils.getInt("status_bar_left_margin", 0)
|
val customLeftMargin = XSPUtils.getInt("status_bar_left_margin", 0)
|
||||||
if (customLeftMargin != 0) {
|
if (customLeftMargin != 0) {
|
||||||
statusBarLeft = customLeftMargin
|
statusBarLeft = customLeftMargin
|
||||||
@@ -382,7 +392,7 @@ object StatusBarLayout : HookRegister() {
|
|||||||
findMethod("com.android.systemui.statusbar.phone.PhoneStatusBarView") {
|
findMethod("com.android.systemui.statusbar.phone.PhoneStatusBarView") {
|
||||||
name == "updateLayoutForCutout"
|
name == "updateLayoutForCutout"
|
||||||
}.hookAfter {
|
}.hookAfter {
|
||||||
if (XSPUtils.getBoolean("layout_compatibility_mode", false)) {
|
if (getHoleLocation == 2) {
|
||||||
val context = (it.thisObject as ViewGroup).context
|
val context = (it.thisObject as ViewGroup).context
|
||||||
updateLayout(context)
|
updateLayout(context)
|
||||||
}
|
}
|
||||||
@@ -409,5 +419,4 @@ object StatusBarLayout : HookRegister() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user