mirror of
https://github.com/LittleTurtle2333/SimplicityTools.git
synced 2026-07-12 19:31:17 +08:00
修复A13状态栏兼容模式横屏
This commit is contained in:
@@ -21,7 +21,6 @@ object StatusBarLayoutForT : HookRegister() {
|
|||||||
private val getMode = XSPUtils.getInt("status_bar_layout_mode", 0)
|
private val getMode = XSPUtils.getInt("status_bar_layout_mode", 0)
|
||||||
private val isCompatibilityMode = XSPUtils.getBoolean("layout_compatibility_mode", false)
|
private val isCompatibilityMode = XSPUtils.getBoolean("layout_compatibility_mode", false)
|
||||||
|
|
||||||
|
|
||||||
private var statusBarLeft = 0
|
private var statusBarLeft = 0
|
||||||
private var statusBarTop = 0
|
private var statusBarTop = 0
|
||||||
private var statusBarRight = 0
|
private var statusBarRight = 0
|
||||||
@@ -43,15 +42,10 @@ object StatusBarLayoutForT : HookRegister() {
|
|||||||
mLeftLayout!!.setPadding(statusBarLeft, 0, 0, 0)
|
mLeftLayout!!.setPadding(statusBarLeft, 0, 0, 0)
|
||||||
mRightLayout!!.setPadding(0, 0, statusBarRight, 0)
|
mRightLayout!!.setPadding(0, 0, statusBarRight, 0)
|
||||||
statusBar!!.setPadding(0, statusBarTop, 0, statusBarBottom)
|
statusBar!!.setPadding(0, statusBarTop, 0, statusBarBottom)
|
||||||
} else {
|
|
||||||
//横屏状态
|
|
||||||
mLeftLayout!!.setPadding(175, 0, 0, 0)
|
|
||||||
mRightLayout!!.setPadding(0, 0, 175, 0)
|
|
||||||
statusBar!!.setPadding(0, statusBarTop, 0, statusBarBottom)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//判断是否开启居中挖孔兼容模式
|
//判断是否开启挖孔兼容模式
|
||||||
if (isCompatibilityMode) {
|
if (isCompatibilityMode) {
|
||||||
findMethod("com.android.systemui.ScreenDecorations") {
|
findMethod("com.android.systemui.ScreenDecorations") {
|
||||||
name == "boundsFromDirection" && parameterCount == 3 && isStatic
|
name == "boundsFromDirection" && parameterCount == 3 && isStatic
|
||||||
@@ -68,40 +62,34 @@ object StatusBarLayoutForT : HookRegister() {
|
|||||||
findMethod("com.android.systemui.statusbar.phone.fragment.CollapsedStatusBarFragment") {
|
findMethod("com.android.systemui.statusbar.phone.fragment.CollapsedStatusBarFragment") {
|
||||||
name == "onViewCreated" && parameterCount == 2
|
name == "onViewCreated" && parameterCount == 2
|
||||||
}.hookAfter { param ->
|
}.hookAfter { param ->
|
||||||
val miuiPhoneStatusBarView =
|
val miuiPhoneStatusBarView = param.thisObject.getObjectAs<ViewGroup>("mStatusBar")
|
||||||
param.thisObject.getObjectAs<ViewGroup>("mStatusBar")
|
|
||||||
val context: Context = miuiPhoneStatusBarView.context
|
val context: Context = miuiPhoneStatusBarView.context
|
||||||
val res: Resources = miuiPhoneStatusBarView.resources
|
val res: Resources = miuiPhoneStatusBarView.resources
|
||||||
val statusBarId: Int =
|
val statusBarId: Int = res.getIdentifier("status_bar", "id", "com.android.systemui")
|
||||||
res.getIdentifier("status_bar", "id", "com.android.systemui")
|
val statusBarContentsId: Int = res.getIdentifier(
|
||||||
val statusBarContentsId: Int =
|
"status_bar_contents",
|
||||||
res.getIdentifier("status_bar_contents", "id", "com.android.systemui")
|
|
||||||
val systemIconAreaId: Int =
|
|
||||||
res.getIdentifier("system_icon_area", "id", "com.android.systemui")
|
|
||||||
val clockId: Int = res.getIdentifier("clock", "id", "com.android.systemui")
|
|
||||||
val phoneStatusBarLeftContainerId: Int =
|
|
||||||
res.getIdentifier(
|
|
||||||
"phone_status_bar_left_container",
|
|
||||||
"id",
|
"id",
|
||||||
"com.android.systemui"
|
"com.android.systemui"
|
||||||
)
|
)
|
||||||
val notificationIconAreaInnerId: Int =
|
val systemIconAreaId: Int = res.getIdentifier("system_icon_area", "id", "com.android.systemui")
|
||||||
res.getIdentifier(
|
val clockId: Int = res.getIdentifier("clock", "id", "com.android.systemui")
|
||||||
"notification_icon_area_inner",
|
val phoneStatusBarLeftContainerId: Int = res.getIdentifier(
|
||||||
"id",
|
"phone_status_bar_left_container", "id", "com.android.systemui"
|
||||||
"com.android.systemui"
|
)
|
||||||
|
val notificationIconAreaInnerId: Int = res.getIdentifier(
|
||||||
|
"notification_icon_area_inner", "id", "com.android.systemui"
|
||||||
)
|
)
|
||||||
statusBar = miuiPhoneStatusBarView.findViewById(statusBarId)
|
statusBar = miuiPhoneStatusBarView.findViewById(statusBarId)
|
||||||
val statusBarContents: ViewGroup =
|
val statusBarContents: ViewGroup = miuiPhoneStatusBarView.findViewById(statusBarContentsId)
|
||||||
miuiPhoneStatusBarView.findViewById(statusBarContentsId)
|
|
||||||
if (statusBar == null) return@hookAfter
|
if (statusBar == null) return@hookAfter
|
||||||
val clock: TextView = miuiPhoneStatusBarView.findViewById(clockId)
|
val clock: TextView = miuiPhoneStatusBarView.findViewById(clockId)
|
||||||
val phoneStatusBarLeftContainer: ViewGroup =
|
val phoneStatusBarLeftContainer: ViewGroup = miuiPhoneStatusBarView.findViewById(
|
||||||
miuiPhoneStatusBarView.findViewById(phoneStatusBarLeftContainerId)
|
phoneStatusBarLeftContainerId
|
||||||
val notificationIconAreaInner: ViewGroup =
|
)
|
||||||
miuiPhoneStatusBarView.findViewById(notificationIconAreaInnerId)
|
val notificationIconAreaInner: ViewGroup = miuiPhoneStatusBarView.findViewById(
|
||||||
val systemIconArea: ViewGroup =
|
notificationIconAreaInnerId
|
||||||
miuiPhoneStatusBarView.findViewById(systemIconAreaId)
|
)
|
||||||
|
val systemIconArea: ViewGroup = miuiPhoneStatusBarView.findViewById(systemIconAreaId)
|
||||||
|
|
||||||
(clock.parent as ViewGroup).removeView(clock)
|
(clock.parent as ViewGroup).removeView(clock)
|
||||||
(phoneStatusBarLeftContainer.parent as ViewGroup).removeView(
|
(phoneStatusBarLeftContainer.parent as ViewGroup).removeView(
|
||||||
@@ -112,41 +100,43 @@ object StatusBarLayoutForT : HookRegister() {
|
|||||||
)
|
)
|
||||||
(systemIconArea.parent as ViewGroup).removeView(systemIconArea)
|
(systemIconArea.parent as ViewGroup).removeView(systemIconArea)
|
||||||
|
|
||||||
val mConstraintLayout =
|
val mConstraintLayout = ConstraintLayout(context).also {
|
||||||
ConstraintLayout(context).also {
|
|
||||||
it.layoutParams = ConstraintLayout.LayoutParams(
|
it.layoutParams = ConstraintLayout.LayoutParams(
|
||||||
ConstraintLayout.LayoutParams.MATCH_PARENT,
|
ConstraintLayout.LayoutParams.MATCH_PARENT, ConstraintLayout.LayoutParams.MATCH_PARENT
|
||||||
ConstraintLayout.LayoutParams.MATCH_PARENT
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
mConstraintLayout.addView(notificationIconAreaInner)
|
mConstraintLayout.addView(notificationIconAreaInner)
|
||||||
|
|
||||||
val fullscreenNotificationIconAreaLp = LinearLayout.LayoutParams(
|
val fullscreenNotificationIconAreaLp = LinearLayout.LayoutParams(
|
||||||
ConstraintLayout.LayoutParams.MATCH_PARENT,
|
ConstraintLayout.LayoutParams.MATCH_PARENT, ConstraintLayout.LayoutParams.MATCH_PARENT
|
||||||
ConstraintLayout.LayoutParams.MATCH_PARENT
|
|
||||||
)
|
)
|
||||||
|
|
||||||
notificationIconAreaInner.layoutParams = fullscreenNotificationIconAreaLp
|
notificationIconAreaInner.layoutParams = fullscreenNotificationIconAreaLp
|
||||||
|
|
||||||
//增加一个左对齐布局
|
//增加一个左对齐布局
|
||||||
mLeftLayout = LinearLayout(context)
|
mLeftLayout = LinearLayout(context)
|
||||||
val leftLp: LinearLayout.LayoutParams =
|
val leftLp: LinearLayout.LayoutParams = LinearLayout.LayoutParams(
|
||||||
LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.MATCH_PARENT, 1.0f)
|
0,
|
||||||
|
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||||
|
1.0f
|
||||||
|
)
|
||||||
mLeftLayout!!.layoutParams = leftLp
|
mLeftLayout!!.layoutParams = leftLp
|
||||||
mLeftLayout!!.gravity = Gravity.START or Gravity.CENTER_VERTICAL
|
mLeftLayout!!.gravity = Gravity.START or Gravity.CENTER_VERTICAL
|
||||||
|
|
||||||
//增加一个居中布局
|
//增加一个居中布局
|
||||||
mCenterLayout = LinearLayout(context)
|
mCenterLayout = LinearLayout(context)
|
||||||
val centerLp: LinearLayout.LayoutParams = LinearLayout.LayoutParams(
|
val centerLp: LinearLayout.LayoutParams = LinearLayout.LayoutParams(
|
||||||
LinearLayout.LayoutParams.WRAP_CONTENT,
|
LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.MATCH_PARENT
|
||||||
LinearLayout.LayoutParams.MATCH_PARENT
|
|
||||||
)
|
)
|
||||||
mCenterLayout!!.layoutParams = centerLp
|
mCenterLayout!!.layoutParams = centerLp
|
||||||
mCenterLayout!!.gravity = Gravity.CENTER or Gravity.CENTER_VERTICAL
|
mCenterLayout!!.gravity = Gravity.CENTER or Gravity.CENTER_VERTICAL
|
||||||
mRightLayout = LinearLayout(context)
|
mRightLayout = LinearLayout(context)
|
||||||
val rightLp: LinearLayout.LayoutParams =
|
val rightLp: LinearLayout.LayoutParams = LinearLayout.LayoutParams(
|
||||||
LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.MATCH_PARENT, 1.0f)
|
0,
|
||||||
|
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||||
|
1.0f
|
||||||
|
)
|
||||||
mRightLayout!!.layoutParams = rightLp
|
mRightLayout!!.layoutParams = rightLp
|
||||||
mRightLayout!!.gravity = Gravity.END or Gravity.CENTER_VERTICAL
|
mRightLayout!!.gravity = Gravity.END or Gravity.CENTER_VERTICAL
|
||||||
mLeftLayout!!.addView(phoneStatusBarLeftContainer)
|
mLeftLayout!!.addView(phoneStatusBarLeftContainer)
|
||||||
@@ -192,14 +182,12 @@ object StatusBarLayoutForT : HookRegister() {
|
|||||||
findMethod("com.android.systemui.statusbar.phone.fragment.CollapsedStatusBarFragment") {
|
findMethod("com.android.systemui.statusbar.phone.fragment.CollapsedStatusBarFragment") {
|
||||||
name == "onViewCreated" && parameterCount == 2
|
name == "onViewCreated" && parameterCount == 2
|
||||||
}.hookAfter { param ->
|
}.hookAfter { param ->
|
||||||
val miuiPhoneStatusBarView =
|
val miuiPhoneStatusBarView = param.thisObject.getObjectAs<ViewGroup>("mStatusBar")
|
||||||
param.thisObject.getObjectAs<ViewGroup>("mStatusBar")
|
|
||||||
val context: Context = miuiPhoneStatusBarView.context
|
val context: Context = miuiPhoneStatusBarView.context
|
||||||
val res: Resources = miuiPhoneStatusBarView.resources
|
val res: Resources = miuiPhoneStatusBarView.resources
|
||||||
|
|
||||||
//组件ID
|
//组件ID
|
||||||
val statusBarId: Int =
|
val statusBarId: Int = res.getIdentifier("status_bar", "id", "com.android.systemui")
|
||||||
res.getIdentifier("status_bar", "id", "com.android.systemui")
|
|
||||||
val clockId: Int = res.getIdentifier("clock", "id", "com.android.systemui")
|
val clockId: Int = res.getIdentifier("clock", "id", "com.android.systemui")
|
||||||
val batteryId: Int = res.getIdentifier("battery", "id", "com.android.systemui")
|
val batteryId: Int = res.getIdentifier("battery", "id", "com.android.systemui")
|
||||||
|
|
||||||
@@ -211,8 +199,7 @@ object StatusBarLayoutForT : HookRegister() {
|
|||||||
|
|
||||||
//新建布局
|
//新建布局
|
||||||
val rightLp = LinearLayout.LayoutParams(
|
val rightLp = LinearLayout.LayoutParams(
|
||||||
LinearLayout.LayoutParams.WRAP_CONTENT,
|
LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.MATCH_PARENT
|
||||||
LinearLayout.LayoutParams.MATCH_PARENT
|
|
||||||
).also {
|
).also {
|
||||||
it.marginStart = dp2px(context, 5f)
|
it.marginStart = dp2px(context, 5f)
|
||||||
}
|
}
|
||||||
@@ -231,65 +218,47 @@ object StatusBarLayoutForT : HookRegister() {
|
|||||||
findMethod("com.android.systemui.statusbar.phone.fragment.CollapsedStatusBarFragment") {
|
findMethod("com.android.systemui.statusbar.phone.fragment.CollapsedStatusBarFragment") {
|
||||||
name == "onViewCreated" && parameterCount == 2
|
name == "onViewCreated" && parameterCount == 2
|
||||||
}.hookAfter { param ->
|
}.hookAfter { param ->
|
||||||
val miuiPhoneStatusBarView =
|
val miuiPhoneStatusBarView = param.thisObject.getObjectAs<ViewGroup>("mStatusBar")
|
||||||
param.thisObject.getObjectAs<ViewGroup>("mStatusBar")
|
|
||||||
val context: Context = miuiPhoneStatusBarView.context
|
val context: Context = miuiPhoneStatusBarView.context
|
||||||
val res: Resources = miuiPhoneStatusBarView.resources
|
val res: Resources = miuiPhoneStatusBarView.resources
|
||||||
val statusBarId: Int =
|
val statusBarId: Int = res.getIdentifier("status_bar", "id", "com.android.systemui")
|
||||||
res.getIdentifier("status_bar", "id", "com.android.systemui")
|
val statusBarContentsId: Int = res.getIdentifier(
|
||||||
val statusBarContentsId: Int =
|
"status_bar_contents",
|
||||||
res.getIdentifier("status_bar_contents", "id", "com.android.systemui")
|
"id",
|
||||||
val systemIconAreaId: Int =
|
"com.android.systemui"
|
||||||
res.getIdentifier("system_icon_area", "id", "com.android.systemui")
|
)
|
||||||
|
val systemIconAreaId: Int = res.getIdentifier("system_icon_area", "id", "com.android.systemui")
|
||||||
val clockId: Int = res.getIdentifier("clock", "id", "com.android.systemui")
|
val clockId: Int = res.getIdentifier("clock", "id", "com.android.systemui")
|
||||||
val phoneStatusBarLeftContainerId: Int =
|
val phoneStatusBarLeftContainerId: Int = res.getIdentifier(
|
||||||
res.getIdentifier(
|
"phone_status_bar_left_container", "id", "com.android.systemui"
|
||||||
"phone_status_bar_left_container",
|
|
||||||
"id",
|
|
||||||
"com.android.systemui"
|
|
||||||
)
|
)
|
||||||
val fullscreenNotificationIconAreaId: Int =
|
val fullscreenNotificationIconAreaId: Int = res.getIdentifier(
|
||||||
res.getIdentifier(
|
"fullscreen_notification_icon_area", "id", "com.android.systemui"
|
||||||
"fullscreen_notification_icon_area",
|
|
||||||
"id",
|
|
||||||
"com.android.systemui"
|
|
||||||
)
|
)
|
||||||
val statusIconsId: Int =
|
val statusIconsId: Int = res.getIdentifier(
|
||||||
res.getIdentifier(
|
"statusIcons", "id", "com.android.systemui"
|
||||||
"statusIcons",
|
|
||||||
"id",
|
|
||||||
"com.android.systemui"
|
|
||||||
)
|
)
|
||||||
val systemIconsId: Int =
|
val systemIconsId: Int = res.getIdentifier(
|
||||||
res.getIdentifier(
|
"system_icons", "id", "com.android.systemui"
|
||||||
"system_icons",
|
|
||||||
"id",
|
|
||||||
"com.android.systemui"
|
|
||||||
)
|
)
|
||||||
val batteryId: Int =
|
val batteryId: Int = res.getIdentifier(
|
||||||
res.getIdentifier(
|
"battery", "id", "com.android.systemui"
|
||||||
"battery",
|
|
||||||
"id",
|
|
||||||
"com.android.systemui"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
statusBar = miuiPhoneStatusBarView.findViewById(statusBarId)
|
statusBar = miuiPhoneStatusBarView.findViewById(statusBarId)
|
||||||
val statusBarContents: ViewGroup =
|
val statusBarContents: ViewGroup = miuiPhoneStatusBarView.findViewById(statusBarContentsId)
|
||||||
miuiPhoneStatusBarView.findViewById(statusBarContentsId)
|
|
||||||
if (statusBar == null) return@hookAfter
|
if (statusBar == null) return@hookAfter
|
||||||
val clock: TextView = miuiPhoneStatusBarView.findViewById(clockId)
|
val clock: TextView = miuiPhoneStatusBarView.findViewById(clockId)
|
||||||
val phoneStatusBarLeftContainer: ViewGroup =
|
val phoneStatusBarLeftContainer: ViewGroup = miuiPhoneStatusBarView.findViewById(
|
||||||
miuiPhoneStatusBarView.findViewById(phoneStatusBarLeftContainerId)
|
phoneStatusBarLeftContainerId
|
||||||
val fullscreenNotificationIconArea: ViewGroup =
|
)
|
||||||
miuiPhoneStatusBarView.findViewById(fullscreenNotificationIconAreaId)
|
val fullscreenNotificationIconArea: ViewGroup = miuiPhoneStatusBarView.findViewById(
|
||||||
val systemIconArea: ViewGroup =
|
fullscreenNotificationIconAreaId
|
||||||
miuiPhoneStatusBarView.findViewById(systemIconAreaId)
|
)
|
||||||
val statusIcons: ViewGroup =
|
val systemIconArea: ViewGroup = miuiPhoneStatusBarView.findViewById(systemIconAreaId)
|
||||||
miuiPhoneStatusBarView.findViewById(statusIconsId)
|
val statusIcons: ViewGroup = miuiPhoneStatusBarView.findViewById(statusIconsId)
|
||||||
val systemIcons: ViewGroup =
|
val systemIcons: ViewGroup = miuiPhoneStatusBarView.findViewById(systemIconsId)
|
||||||
miuiPhoneStatusBarView.findViewById(systemIconsId)
|
val battery: ViewGroup = miuiPhoneStatusBarView.findViewById(batteryId)
|
||||||
val battery: ViewGroup =
|
|
||||||
miuiPhoneStatusBarView.findViewById(batteryId)
|
|
||||||
|
|
||||||
(clock.parent as ViewGroup).removeView(clock)
|
(clock.parent as ViewGroup).removeView(clock)
|
||||||
(phoneStatusBarLeftContainer.parent as ViewGroup).removeView(
|
(phoneStatusBarLeftContainer.parent as ViewGroup).removeView(
|
||||||
@@ -303,11 +272,9 @@ object StatusBarLayoutForT : HookRegister() {
|
|||||||
fullscreenNotificationIconArea
|
fullscreenNotificationIconArea
|
||||||
)
|
)
|
||||||
|
|
||||||
val mConstraintLayout =
|
val mConstraintLayout = ConstraintLayout(context).also {
|
||||||
ConstraintLayout(context).also {
|
|
||||||
it.layoutParams = ConstraintLayout.LayoutParams(
|
it.layoutParams = ConstraintLayout.LayoutParams(
|
||||||
ConstraintLayout.LayoutParams.MATCH_PARENT,
|
ConstraintLayout.LayoutParams.MATCH_PARENT, ConstraintLayout.LayoutParams.MATCH_PARENT
|
||||||
ConstraintLayout.LayoutParams.MATCH_PARENT
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -316,16 +283,14 @@ object StatusBarLayoutForT : HookRegister() {
|
|||||||
|
|
||||||
|
|
||||||
battery.layoutParams = ConstraintLayout.LayoutParams(
|
battery.layoutParams = ConstraintLayout.LayoutParams(
|
||||||
ConstraintLayout.LayoutParams.WRAP_CONTENT,
|
ConstraintLayout.LayoutParams.WRAP_CONTENT, ConstraintLayout.LayoutParams.MATCH_PARENT
|
||||||
ConstraintLayout.LayoutParams.MATCH_PARENT
|
|
||||||
).also {
|
).also {
|
||||||
it.endToEnd = 0
|
it.endToEnd = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fullscreenNotificationIconArea.layoutParams = ConstraintLayout.LayoutParams(
|
fullscreenNotificationIconArea.layoutParams = ConstraintLayout.LayoutParams(
|
||||||
0,
|
0, ConstraintLayout.LayoutParams.MATCH_PARENT
|
||||||
ConstraintLayout.LayoutParams.MATCH_PARENT
|
|
||||||
).also {
|
).also {
|
||||||
it.startToEnd = batteryId
|
it.startToEnd = batteryId
|
||||||
it.endToEnd = 0
|
it.endToEnd = 0
|
||||||
@@ -335,24 +300,29 @@ object StatusBarLayoutForT : HookRegister() {
|
|||||||
|
|
||||||
//增加一个左对齐布局
|
//增加一个左对齐布局
|
||||||
mLeftLayout = LinearLayout(context)
|
mLeftLayout = LinearLayout(context)
|
||||||
val leftLp: LinearLayout.LayoutParams =
|
val leftLp: LinearLayout.LayoutParams = LinearLayout.LayoutParams(
|
||||||
LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.MATCH_PARENT, 1.0f)
|
0,
|
||||||
|
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||||
|
1.0f
|
||||||
|
)
|
||||||
mLeftLayout!!.layoutParams = leftLp
|
mLeftLayout!!.layoutParams = leftLp
|
||||||
mLeftLayout!!.gravity = Gravity.START or Gravity.CENTER_VERTICAL
|
mLeftLayout!!.gravity = Gravity.START or Gravity.CENTER_VERTICAL
|
||||||
|
|
||||||
//增加一个居中布局
|
//增加一个居中布局
|
||||||
mCenterLayout = LinearLayout(context)
|
mCenterLayout = LinearLayout(context)
|
||||||
val centerLp: LinearLayout.LayoutParams = LinearLayout.LayoutParams(
|
val centerLp: LinearLayout.LayoutParams = LinearLayout.LayoutParams(
|
||||||
LinearLayout.LayoutParams.WRAP_CONTENT,
|
LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.MATCH_PARENT
|
||||||
LinearLayout.LayoutParams.MATCH_PARENT
|
|
||||||
)
|
)
|
||||||
mCenterLayout!!.layoutParams = centerLp
|
mCenterLayout!!.layoutParams = centerLp
|
||||||
mCenterLayout!!.gravity = Gravity.CENTER or Gravity.CENTER_VERTICAL
|
mCenterLayout!!.gravity = Gravity.CENTER or Gravity.CENTER_VERTICAL
|
||||||
|
|
||||||
//增加一个右布局
|
//增加一个右布局
|
||||||
mRightLayout = LinearLayout(context)
|
mRightLayout = LinearLayout(context)
|
||||||
val rightLp: LinearLayout.LayoutParams =
|
val rightLp: LinearLayout.LayoutParams = LinearLayout.LayoutParams(
|
||||||
LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.MATCH_PARENT, 1.0f)
|
0,
|
||||||
|
LinearLayout.LayoutParams.MATCH_PARENT,
|
||||||
|
1.0f
|
||||||
|
)
|
||||||
mRightLayout!!.layoutParams = rightLp
|
mRightLayout!!.layoutParams = rightLp
|
||||||
mRightLayout!!.gravity = Gravity.END or Gravity.CENTER_VERTICAL
|
mRightLayout!!.gravity = Gravity.END or Gravity.CENTER_VERTICAL
|
||||||
|
|
||||||
@@ -408,12 +378,10 @@ object StatusBarLayoutForT : HookRegister() {
|
|||||||
}.hookAfter {
|
}.hookAfter {
|
||||||
val miuiPhoneStatusBarView = it.thisObject.getObjectAs<ViewGroup>("mStatusBar")
|
val miuiPhoneStatusBarView = it.thisObject.getObjectAs<ViewGroup>("mStatusBar")
|
||||||
val res = miuiPhoneStatusBarView.resources
|
val res = miuiPhoneStatusBarView.resources
|
||||||
val statusBarId =
|
val statusBarId = res.getIdentifier("status_bar", "id", "com.android.systemui")
|
||||||
res.getIdentifier("status_bar", "id", "com.android.systemui")
|
|
||||||
val statusBar1 = miuiPhoneStatusBarView.findViewById<ViewGroup>(statusBarId)
|
val statusBar1 = miuiPhoneStatusBarView.findViewById<ViewGroup>(statusBarId)
|
||||||
//非锁屏下整个状态栏布局
|
//非锁屏下整个状态栏布局
|
||||||
val keyguardMgr =
|
val keyguardMgr = statusBar1.context.getSystemService(Context.KEYGUARD_SERVICE) as KeyguardManager
|
||||||
statusBar1.context.getSystemService(Context.KEYGUARD_SERVICE) as KeyguardManager
|
|
||||||
if (keyguardMgr.isKeyguardLocked) {
|
if (keyguardMgr.isKeyguardLocked) {
|
||||||
statusBar1!!.visibility = View.GONE
|
statusBar1!!.visibility = View.GONE
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user