mirror of
https://github.com/LittleTurtle2333/SimplicityTools.git
synced 2026-07-14 04:11:17 +08:00
Compare commits
27 Commits
9af50d9dd5
...
ca784bd7d6
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ca784bd7d6 | ||
|
|
25e4b220c0 | ||
|
|
19b6d62f5e | ||
|
|
dd8e6dc02f | ||
|
|
402e229f97 | ||
|
|
98fce140e1 | ||
|
|
963c7e0676 | ||
|
|
efca81e54b | ||
|
|
a053b755d1 | ||
|
|
18a3847a11 | ||
|
|
0b0c9b30b8 | ||
|
|
d3bb187335 | ||
|
|
2912d84506 | ||
|
|
ca556ce911 | ||
|
|
9f2db07bc7 | ||
|
|
fbce83bb89 | ||
|
|
dad590c8b7 | ||
|
|
2a49368008 | ||
|
|
c37e50c191 | ||
|
|
08fb9080eb | ||
|
|
04825e1e30 | ||
|
|
9e32d9c91c | ||
|
|
1dc527c30e | ||
|
|
439a7e9cf2 | ||
|
|
1af19eb7ea | ||
|
|
aa5704864d | ||
|
|
761998072f |
@@ -48,8 +48,6 @@ Xposed仓库下载:[点击此处下载最新发行版](https://github.com/Xpos
|
|||||||
[LSPosed/CorePatch](https://github.com/LSPosed/CorePatch)
|
[LSPosed/CorePatch](https://github.com/LSPosed/CorePatch)
|
||||||
##### GNU Lesser General Public License v2.1
|
##### GNU Lesser General Public License v2.1
|
||||||
[577fkj/blockmiui](https://github.com/577fkj/blockmiui)
|
[577fkj/blockmiui](https://github.com/577fkj/blockmiui)
|
||||||
##### Apache License 2.0
|
|
||||||
[KyuubiRan/EzXHelper](https://github.com/KyuubiRan/EzXHelper)
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -45,8 +45,6 @@ Xposed Repo:[Click here to download the latest release](https://github.com/Xpo
|
|||||||
[LSPosed/CorePatch](https://github.com/LSPosed/CorePatch)
|
[LSPosed/CorePatch](https://github.com/LSPosed/CorePatch)
|
||||||
##### GNU Lesser General Public License v2.1
|
##### GNU Lesser General Public License v2.1
|
||||||
[577fkj/blockmiui](https://github.com/577fkj/blockmiui)
|
[577fkj/blockmiui](https://github.com/577fkj/blockmiui)
|
||||||
##### Apache License 2.0
|
|
||||||
[KyuubiRan/EzXHelper](https://github.com/KyuubiRan/EzXHelper)
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -12,8 +12,8 @@ android {
|
|||||||
applicationId = "com.lt2333.simplicitytools"
|
applicationId = "com.lt2333.simplicitytools"
|
||||||
minSdk = 31
|
minSdk = 31
|
||||||
targetSdk = 32
|
targetSdk = 32
|
||||||
versionCode = 57
|
versionCode = 56
|
||||||
versionName = "1.5.6"
|
versionName = "1.5.5"
|
||||||
}
|
}
|
||||||
|
|
||||||
buildTypes {
|
buildTypes {
|
||||||
|
|||||||
@@ -508,58 +508,13 @@ class SettingsActivity : MIUIActivity() {
|
|||||||
)
|
)
|
||||||
add(LineV())
|
add(LineV())
|
||||||
add(TitleTextV(resId = R.string.status_bar_layout))
|
add(TitleTextV(resId = R.string.status_bar_layout))
|
||||||
val statusBarLayoutMode: HashMap<Int, String> = hashMapOf<Int, String>().also {
|
|
||||||
it[0] = getString(R.string.default1)
|
|
||||||
it[1] = getString(R.string.clock_center)
|
|
||||||
it[2] = getString(R.string.clock_right)
|
|
||||||
it[3] = getString(R.string.clock_center_and_icon_left)
|
|
||||||
}
|
|
||||||
add(
|
add(
|
||||||
TextWithSpinnerV(
|
TextSummaryWithSwitchV(
|
||||||
TextV(resId = R.string.status_bar_layout_mode),
|
TextSummaryV(
|
||||||
SpinnerV(
|
textId = R.string.status_bar_time_center,
|
||||||
arrayListOf<MIUIPopupData>().apply {
|
tipsId = R.string.status_bar_layout_summary
|
||||||
add(MIUIPopupData(statusBarLayoutMode[0].toString()) {
|
),
|
||||||
OwnSP.ownSP.edit().run {
|
SwitchV("status_bar_time_center")
|
||||||
putInt(
|
|
||||||
"status_bar_layout_mode",
|
|
||||||
0
|
|
||||||
)
|
|
||||||
apply()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
add(MIUIPopupData(statusBarLayoutMode[1].toString()) {
|
|
||||||
OwnSP.ownSP.edit().run {
|
|
||||||
putInt(
|
|
||||||
"status_bar_layout_mode",
|
|
||||||
1
|
|
||||||
)
|
|
||||||
apply()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
add(MIUIPopupData(statusBarLayoutMode[2].toString()) {
|
|
||||||
OwnSP.ownSP.edit().run {
|
|
||||||
putInt(
|
|
||||||
"status_bar_layout_mode",
|
|
||||||
2
|
|
||||||
)
|
|
||||||
apply()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
add(MIUIPopupData(statusBarLayoutMode[3].toString()) {
|
|
||||||
OwnSP.ownSP.edit().run {
|
|
||||||
putInt(
|
|
||||||
"status_bar_layout_mode",
|
|
||||||
3
|
|
||||||
)
|
|
||||||
apply()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}, currentValue = statusBarLayoutMode[OwnSP.ownSP.getInt(
|
|
||||||
"status_bar_layout_mode",
|
|
||||||
0
|
|
||||||
)].toString()
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
val layoutCompatibilityModeBinding = getDataBinding(
|
val layoutCompatibilityModeBinding = getDataBinding(
|
||||||
@@ -919,16 +874,12 @@ class SettingsActivity : MIUIActivity() {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
add(
|
add(
|
||||||
TextV(
|
TextSummaryWithSwitchV(
|
||||||
resId = R.string.maximum_number_of_notification_icons
|
TextSummaryV(
|
||||||
)
|
textId = R.string.remove_the_maximum_number_of_notification_icons,
|
||||||
)
|
tipsId = R.string.remove_the_maximum_number_of_notification_icons_summary
|
||||||
add(
|
),
|
||||||
SeekBarWithTextV(
|
SwitchV("remove_the_maximum_number_of_notification_icons")
|
||||||
"maximum_number_of_notification_icons",
|
|
||||||
1,
|
|
||||||
30,
|
|
||||||
3
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
add(
|
add(
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ object SystemUI: AppRegister() {
|
|||||||
HideMobileTypeIcon, //隐藏移动类型图标
|
HideMobileTypeIcon, //隐藏移动类型图标
|
||||||
HideStatusBarNetworkSpeedSecond, //隐藏状态栏网速/s
|
HideStatusBarNetworkSpeedSecond, //隐藏状态栏网速/s
|
||||||
HideWifiActivityIcon, //隐藏WIFI活动箭头图标
|
HideWifiActivityIcon, //隐藏WIFI活动箭头图标
|
||||||
MaximumNumberOfNotificationIcons, //通知图标上限
|
RemoveTheMaximumNumberOfNotificationIcons, //移除通知图标上限
|
||||||
StatusBarNetworkSpeedRefreshSpeed, //状态栏网速秒刷新
|
StatusBarNetworkSpeedRefreshSpeed, //状态栏网速秒刷新
|
||||||
StatusBarTimeCustomization, //状态栏时钟自定义
|
StatusBarTimeCustomization, //状态栏时钟自定义
|
||||||
RemoveTheLeftSideOfTheLockScreen, //移除锁屏负一屏功能
|
RemoveTheLeftSideOfTheLockScreen, //移除锁屏负一屏功能
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ object HideStatusBarNetworkSpeedSecond: HookRegister() {
|
|||||||
.replace("/", "")
|
.replace("/", "")
|
||||||
.replace("s", "")
|
.replace("s", "")
|
||||||
.replace("'", "")
|
.replace("'", "")
|
||||||
.replace("วิ", "")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +1,20 @@
|
|||||||
package com.lt2333.simplicitytools.hook.app.systemui
|
package com.lt2333.simplicitytools.hook.app.systemui
|
||||||
|
|
||||||
import com.lt2333.simplicitytools.util.*
|
import com.lt2333.simplicitytools.util.callMethod
|
||||||
|
import com.lt2333.simplicitytools.util.hasEnable
|
||||||
|
import com.lt2333.simplicitytools.util.replaceMethod
|
||||||
|
import com.lt2333.simplicitytools.util.setIntField
|
||||||
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||||
|
|
||||||
object MaximumNumberOfNotificationIcons: HookRegister() {
|
object RemoveTheMaximumNumberOfNotificationIcons: HookRegister() {
|
||||||
|
|
||||||
override fun init() {
|
override fun init() {
|
||||||
val size = XSPUtils.getInt("maximum_number_of_notification_icons",3)
|
hasEnable("remove_the_maximum_number_of_notification_icons") {
|
||||||
"com.android.systemui.statusbar.phone.NotificationIconContainer".replaceMethod(getDefaultClassLoader(), "miuiShowNotificationIcons", Boolean::class.java) {
|
"com.android.systemui.statusbar.phone.NotificationIconContainer".replaceMethod(getDefaultClassLoader(), "miuiShowNotificationIcons", Boolean::class.java) {
|
||||||
if (it.args[0] as Boolean) {
|
if (it.args[0] as Boolean) {
|
||||||
it.thisObject.setIntField("MAX_DOTS", size)
|
it.thisObject.setIntField("MAX_DOTS", 30)
|
||||||
it.thisObject.setIntField("MAX_STATIC_ICONS", size)
|
it.thisObject.setIntField("MAX_STATIC_ICONS", 30)
|
||||||
it.thisObject.setIntField("MAX_VISIBLE_ICONS_ON_LOCK", size)
|
it.thisObject.setIntField("MAX_VISIBLE_ICONS_ON_LOCK", 30)
|
||||||
} else {
|
} else {
|
||||||
it.thisObject.setIntField("MAX_DOTS", 0)
|
it.thisObject.setIntField("MAX_DOTS", 0)
|
||||||
it.thisObject.setIntField("MAX_STATIC_ICONS", 0)
|
it.thisObject.setIntField("MAX_STATIC_ICONS", 0)
|
||||||
@@ -20,5 +23,6 @@ object MaximumNumberOfNotificationIcons: HookRegister() {
|
|||||||
it.thisObject.callMethod("updateState")
|
it.thisObject.callMethod("updateState")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.lt2333.simplicitytools.hook.app.systemui
|
package com.lt2333.simplicitytools.hook.app.systemui
|
||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.app.KeyguardManager
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.res.Configuration
|
import android.content.res.Configuration
|
||||||
import android.content.res.Resources
|
import android.content.res.Resources
|
||||||
@@ -9,20 +8,18 @@ import android.os.Bundle
|
|||||||
import android.view.Gravity
|
import android.view.Gravity
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
|
import android.widget.FrameLayout
|
||||||
import android.widget.LinearLayout
|
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 com.lt2333.simplicitytools.util.XSPUtils
|
import com.lt2333.simplicitytools.util.XSPUtils
|
||||||
import com.lt2333.simplicitytools.util.findClass
|
import com.lt2333.simplicitytools.util.findClass
|
||||||
import com.lt2333.simplicitytools.util.getObjectField
|
import com.lt2333.simplicitytools.util.getObjectField
|
||||||
import com.lt2333.simplicitytools.util.hookAfterMethod
|
import com.lt2333.simplicitytools.util.hookAfterMethod
|
||||||
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||||
import de.robv.android.xposed.XposedHelpers
|
|
||||||
|
|
||||||
|
|
||||||
@SuppressLint("StaticFieldLeak")
|
@SuppressLint("StaticFieldLeak")
|
||||||
object StatusBarLayout : HookRegister() {
|
object StatusBarLayout: HookRegister() {
|
||||||
|
|
||||||
private var mLeftLayout: LinearLayout? = null
|
private var mLeftLayout: LinearLayout? = null
|
||||||
private var mRightLayout: LinearLayout? = null
|
private var mRightLayout: LinearLayout? = null
|
||||||
@@ -35,15 +32,10 @@ object StatusBarLayout : HookRegister() {
|
|||||||
private var statusBarBottom = 0
|
private var statusBarBottom = 0
|
||||||
|
|
||||||
override fun init() {
|
override fun init() {
|
||||||
when (XSPUtils.getInt("status_bar_layout_mode", 0)) {
|
if (!XSPUtils.getBoolean("status_bar_time_center", false)) return
|
||||||
//默认
|
|
||||||
0 -> return
|
|
||||||
//时钟居中
|
|
||||||
1 -> {
|
|
||||||
val collapsedStatusBarFragmentClass =
|
val collapsedStatusBarFragmentClass =
|
||||||
"com.android.systemui.statusbar.phone.CollapsedStatusBarFragment".findClass(
|
"com.android.systemui.statusbar.phone.CollapsedStatusBarFragment".findClass(getDefaultClassLoader())
|
||||||
getDefaultClassLoader()
|
|
||||||
)
|
|
||||||
|
|
||||||
collapsedStatusBarFragmentClass.hookAfterMethod(
|
collapsedStatusBarFragmentClass.hookAfterMethod(
|
||||||
"onViewCreated",
|
"onViewCreated",
|
||||||
@@ -54,25 +46,16 @@ object StatusBarLayout : HookRegister() {
|
|||||||
param.thisObject.getObjectField("mStatusBar") as ViewGroup
|
param.thisObject.getObjectField("mStatusBar") as ViewGroup
|
||||||
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 =
|
val statusBarContentsId: Int =
|
||||||
res.getIdentifier("status_bar_contents", "id", "com.android.systemui")
|
res.getIdentifier("status_bar_contents", "id", "com.android.systemui")
|
||||||
val systemIconAreaId: Int =
|
val systemIconAreaId: Int =
|
||||||
res.getIdentifier("system_icon_area", "id", "com.android.systemui")
|
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 notificationIconAreaInnerId: Int =
|
val notificationIconAreaInnerId: Int =
|
||||||
res.getIdentifier(
|
res.getIdentifier("notification_icon_area_inner", "id", "com.android.systemui")
|
||||||
"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)
|
||||||
@@ -94,13 +77,13 @@ object StatusBarLayout : HookRegister() {
|
|||||||
)
|
)
|
||||||
(systemIconArea.parent as ViewGroup).removeView(systemIconArea)
|
(systemIconArea.parent as ViewGroup).removeView(systemIconArea)
|
||||||
|
|
||||||
val mConstraintLayout =
|
val mConstraintLayoutLp = ConstraintLayout.LayoutParams(
|
||||||
ConstraintLayout(context).also {
|
|
||||||
it.layoutParams = ConstraintLayout.LayoutParams(
|
|
||||||
ConstraintLayout.LayoutParams.MATCH_PARENT,
|
ConstraintLayout.LayoutParams.MATCH_PARENT,
|
||||||
ConstraintLayout.LayoutParams.MATCH_PARENT
|
ConstraintLayout.LayoutParams.MATCH_PARENT
|
||||||
)
|
)
|
||||||
}
|
|
||||||
|
val mConstraintLayout =
|
||||||
|
ConstraintLayout(context).also { it.layoutParams = mConstraintLayoutLp }
|
||||||
|
|
||||||
mConstraintLayout.addView(notificationIconAreaInner)
|
mConstraintLayout.addView(notificationIconAreaInner)
|
||||||
|
|
||||||
@@ -158,11 +141,11 @@ object StatusBarLayout : HookRegister() {
|
|||||||
}
|
}
|
||||||
updateLayout(context)
|
updateLayout(context)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val phoneStatusBarViewClass =
|
val phoneStatusBarViewClass =
|
||||||
"com.android.systemui.statusbar.phone.PhoneStatusBarView".findClass(
|
"com.android.systemui.statusbar.phone.PhoneStatusBarView".findClass(getDefaultClassLoader())
|
||||||
getDefaultClassLoader()
|
|
||||||
)
|
|
||||||
|
|
||||||
phoneStatusBarViewClass.hookAfterMethod("updateLayoutForCutout") {
|
phoneStatusBarViewClass.hookAfterMethod("updateLayoutForCutout") {
|
||||||
if (XSPUtils.getBoolean("layout_compatibility_mode", false)) {
|
if (XSPUtils.getBoolean("layout_compatibility_mode", false)) {
|
||||||
@@ -170,273 +153,19 @@ object StatusBarLayout : HookRegister() {
|
|||||||
updateLayout(context)
|
updateLayout(context)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
val miuiPhoneStatusBarViewClass =
|
||||||
//时钟居右
|
"com.android.systemui.statusbar.phone.MiuiPhoneStatusBarView".findClass(getDefaultClassLoader())
|
||||||
2 -> {
|
|
||||||
val collapsedStatusBarFragmentClass =
|
|
||||||
"com.android.systemui.statusbar.phone.CollapsedStatusBarFragment".findClass(
|
|
||||||
getDefaultClassLoader()
|
|
||||||
)
|
|
||||||
|
|
||||||
collapsedStatusBarFragmentClass.hookAfterMethod(
|
miuiPhoneStatusBarViewClass.hookAfterMethod("updateNotificationIconAreaInnnerParent") {
|
||||||
"onViewCreated",
|
val viewGroup = it.thisObject as ViewGroup
|
||||||
View::class.java,
|
val fullscreen_notification_icon_area_lp = FrameLayout.LayoutParams(
|
||||||
Bundle::class.java
|
|
||||||
) { param ->
|
|
||||||
val MiuiPhoneStatusBarView: ViewGroup =
|
|
||||||
param.thisObject.getObjectField("mStatusBar") as ViewGroup
|
|
||||||
val context: Context = MiuiPhoneStatusBarView.context
|
|
||||||
val res: Resources = MiuiPhoneStatusBarView.resources
|
|
||||||
|
|
||||||
//组件ID
|
|
||||||
val statusBarId: Int =
|
|
||||||
res.getIdentifier("status_bar", "id", "com.android.systemui")
|
|
||||||
val clockId: Int = res.getIdentifier("clock", "id", "com.android.systemui")
|
|
||||||
val batteryId: Int = res.getIdentifier("battery", "id", "com.android.systemui")
|
|
||||||
|
|
||||||
//查找组件
|
|
||||||
statusBar = MiuiPhoneStatusBarView.findViewById(statusBarId)
|
|
||||||
if (statusBar == null) return@hookAfterMethod
|
|
||||||
val clock: TextView = MiuiPhoneStatusBarView.findViewById(clockId)
|
|
||||||
val battery: ViewGroup = MiuiPhoneStatusBarView.findViewById(batteryId)
|
|
||||||
|
|
||||||
//新建布局
|
|
||||||
val RightLp = LinearLayout.LayoutParams(
|
|
||||||
LinearLayout.LayoutParams.WRAP_CONTENT,
|
|
||||||
LinearLayout.LayoutParams.MATCH_PARENT
|
|
||||||
).also {
|
|
||||||
it.marginStart = dp2px(context, 5f)
|
|
||||||
}
|
|
||||||
mRightLayout = LinearLayout(context).also {
|
|
||||||
it.layoutParams = RightLp
|
|
||||||
}
|
|
||||||
|
|
||||||
//添加布局与组件
|
|
||||||
battery.addView(mRightLayout)
|
|
||||||
(clock.parent as ViewGroup).removeView(clock)
|
|
||||||
mRightLayout!!.addView(clock)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//时钟居中+图标居左
|
|
||||||
3 -> {
|
|
||||||
val collapsedStatusBarFragmentClass =
|
|
||||||
"com.android.systemui.statusbar.phone.CollapsedStatusBarFragment".findClass(
|
|
||||||
getDefaultClassLoader()
|
|
||||||
)
|
|
||||||
|
|
||||||
collapsedStatusBarFragmentClass.hookAfterMethod(
|
|
||||||
"onViewCreated",
|
|
||||||
View::class.java,
|
|
||||||
Bundle::class.java
|
|
||||||
) { param ->
|
|
||||||
val MiuiPhoneStatusBarView: ViewGroup =
|
|
||||||
param.thisObject.getObjectField("mStatusBar") as ViewGroup
|
|
||||||
val context: Context = MiuiPhoneStatusBarView.context
|
|
||||||
val res: Resources = MiuiPhoneStatusBarView.resources
|
|
||||||
val statusBarId: Int =
|
|
||||||
res.getIdentifier("status_bar", "id", "com.android.systemui")
|
|
||||||
val statusBarContentsId: Int =
|
|
||||||
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",
|
|
||||||
"com.android.systemui"
|
|
||||||
)
|
|
||||||
val fullscreenNotificationIconAreaId: Int =
|
|
||||||
res.getIdentifier(
|
|
||||||
"fullscreen_notification_icon_area",
|
|
||||||
"id",
|
|
||||||
"com.android.systemui"
|
|
||||||
)
|
|
||||||
val statusIconsId: Int =
|
|
||||||
res.getIdentifier(
|
|
||||||
"statusIcons",
|
|
||||||
"id",
|
|
||||||
"com.android.systemui"
|
|
||||||
)
|
|
||||||
val systemIconsId: Int =
|
|
||||||
res.getIdentifier(
|
|
||||||
"system_icons",
|
|
||||||
"id",
|
|
||||||
"com.android.systemui"
|
|
||||||
)
|
|
||||||
val batteryId: Int =
|
|
||||||
res.getIdentifier(
|
|
||||||
"battery",
|
|
||||||
"id",
|
|
||||||
"com.android.systemui"
|
|
||||||
)
|
|
||||||
val notificationIconAreaInnerId: Int =
|
|
||||||
res.getIdentifier(
|
|
||||||
"notification_icon_area_inner",
|
|
||||||
"id",
|
|
||||||
"com.android.systemui"
|
|
||||||
)
|
|
||||||
|
|
||||||
statusBar = MiuiPhoneStatusBarView.findViewById(statusBarId)
|
|
||||||
val statusBarContents: ViewGroup =
|
|
||||||
MiuiPhoneStatusBarView.findViewById(statusBarContentsId)
|
|
||||||
if (statusBar == null) return@hookAfterMethod
|
|
||||||
val clock: TextView = MiuiPhoneStatusBarView.findViewById(clockId)
|
|
||||||
val phoneStatusBarLeftContainer: ViewGroup =
|
|
||||||
MiuiPhoneStatusBarView.findViewById(phoneStatusBarLeftContainerId)
|
|
||||||
val fullscreenNotificationIconArea: ViewGroup =
|
|
||||||
MiuiPhoneStatusBarView.findViewById(fullscreenNotificationIconAreaId)
|
|
||||||
val systemIconArea: ViewGroup =
|
|
||||||
MiuiPhoneStatusBarView.findViewById(systemIconAreaId)
|
|
||||||
val statusIcons: ViewGroup =
|
|
||||||
MiuiPhoneStatusBarView.findViewById(statusIconsId)
|
|
||||||
val systemIcons: ViewGroup =
|
|
||||||
MiuiPhoneStatusBarView.findViewById(systemIconsId)
|
|
||||||
val battery: ViewGroup =
|
|
||||||
MiuiPhoneStatusBarView.findViewById(batteryId)
|
|
||||||
val notificationIconAreaInner: ViewGroup =
|
|
||||||
MiuiPhoneStatusBarView.findViewById(notificationIconAreaInnerId)
|
|
||||||
|
|
||||||
(clock.parent as ViewGroup).removeView(clock)
|
|
||||||
(phoneStatusBarLeftContainer.parent as ViewGroup).removeView(
|
|
||||||
phoneStatusBarLeftContainer
|
|
||||||
)
|
|
||||||
(systemIconArea.parent as ViewGroup).removeView(systemIconArea)
|
|
||||||
(statusIcons.parent as ViewGroup).removeView(statusIcons)
|
|
||||||
(systemIcons.parent as ViewGroup).removeView(systemIcons)
|
|
||||||
(battery.parent as ViewGroup).removeView(battery)
|
|
||||||
(notificationIconAreaInner.parent as ViewGroup).removeView(
|
|
||||||
notificationIconAreaInner
|
|
||||||
)
|
|
||||||
|
|
||||||
val mConstraintLayout =
|
|
||||||
ConstraintLayout(context).also {
|
|
||||||
it.layoutParams = ConstraintLayout.LayoutParams(
|
|
||||||
ConstraintLayout.LayoutParams.MATCH_PARENT,
|
ConstraintLayout.LayoutParams.MATCH_PARENT,
|
||||||
ConstraintLayout.LayoutParams.MATCH_PARENT
|
ConstraintLayout.LayoutParams.MATCH_PARENT
|
||||||
)
|
)
|
||||||
}
|
viewGroup.layoutParams = fullscreen_notification_icon_area_lp
|
||||||
|
|
||||||
mConstraintLayout.addView(notificationIconAreaInner)
|
|
||||||
mConstraintLayout.addView(battery)
|
|
||||||
|
|
||||||
|
|
||||||
battery.layoutParams = ConstraintLayout.LayoutParams(
|
|
||||||
ConstraintLayout.LayoutParams.WRAP_CONTENT,
|
|
||||||
ConstraintLayout.LayoutParams.MATCH_PARENT
|
|
||||||
).also {
|
|
||||||
it.endToEnd = 0
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
notificationIconAreaInner.layoutParams = ConstraintLayout.LayoutParams(
|
|
||||||
0,
|
|
||||||
ConstraintLayout.LayoutParams.MATCH_PARENT
|
|
||||||
).also {
|
|
||||||
it.startToEnd = batteryId
|
|
||||||
it.endToEnd = 0
|
|
||||||
}
|
|
||||||
notificationIconAreaInner.layoutDirection = View.LAYOUT_DIRECTION_RTL
|
|
||||||
|
|
||||||
|
|
||||||
//增加一个左对齐布局
|
|
||||||
mLeftLayout = LinearLayout(context)
|
|
||||||
val LeftLp: LinearLayout.LayoutParams =
|
|
||||||
LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.MATCH_PARENT, 1.0f)
|
|
||||||
mLeftLayout!!.layoutParams = LeftLp
|
|
||||||
mLeftLayout!!.gravity = Gravity.START or Gravity.CENTER_VERTICAL
|
|
||||||
|
|
||||||
//增加一个居中布局
|
|
||||||
mCenterLayout = LinearLayout(context)
|
|
||||||
val CenterLp: LinearLayout.LayoutParams = LinearLayout.LayoutParams(
|
|
||||||
LinearLayout.LayoutParams.WRAP_CONTENT,
|
|
||||||
LinearLayout.LayoutParams.MATCH_PARENT
|
|
||||||
)
|
|
||||||
mCenterLayout!!.layoutParams = CenterLp
|
|
||||||
mCenterLayout!!.gravity = Gravity.CENTER or Gravity.CENTER_VERTICAL
|
|
||||||
|
|
||||||
//增加一个右布局
|
|
||||||
mRightLayout = LinearLayout(context)
|
|
||||||
val RightLp: LinearLayout.LayoutParams =
|
|
||||||
LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.MATCH_PARENT, 1.0f)
|
|
||||||
mRightLayout!!.layoutParams = RightLp
|
|
||||||
mRightLayout!!.gravity = Gravity.END or Gravity.CENTER_VERTICAL
|
|
||||||
|
|
||||||
|
|
||||||
mLeftLayout!!.addView(phoneStatusBarLeftContainer)
|
|
||||||
mLeftLayout!!.addView(statusIcons)
|
|
||||||
statusIcons.layoutDirection = View.LAYOUT_DIRECTION_RTL
|
|
||||||
|
|
||||||
mCenterLayout!!.addView(clock)
|
|
||||||
|
|
||||||
mRightLayout!!.addView(mConstraintLayout)
|
|
||||||
fullscreenNotificationIconArea.layoutDirection = View.LAYOUT_DIRECTION_RTL
|
|
||||||
|
|
||||||
|
|
||||||
statusBarContents.addView(mLeftLayout, 0)
|
|
||||||
statusBarContents.addView(mCenterLayout)
|
|
||||||
statusBarContents.addView(mRightLayout)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
statusBarLeft = statusBar!!.paddingLeft
|
|
||||||
statusBarTop = statusBar!!.paddingTop
|
|
||||||
statusBarRight = statusBar!!.paddingRight
|
|
||||||
statusBarBottom = statusBar!!.paddingBottom
|
|
||||||
|
|
||||||
|
|
||||||
if (XSPUtils.getBoolean("layout_compatibility_mode", false)) {
|
|
||||||
val customLeftMargin = XSPUtils.getInt("status_bar_left_margin", 0)
|
|
||||||
if (customLeftMargin != 0) {
|
|
||||||
statusBarLeft = customLeftMargin
|
|
||||||
}
|
|
||||||
|
|
||||||
val customRightMargin = XSPUtils.getInt("status_bar_right_margin", 0)
|
|
||||||
if (customRightMargin != 0) {
|
|
||||||
statusBarRight = customRightMargin
|
|
||||||
}
|
|
||||||
updateLayout(context)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//兼容模式
|
|
||||||
val phoneStatusBarViewClass =
|
|
||||||
"com.android.systemui.statusbar.phone.PhoneStatusBarView".findClass(
|
|
||||||
getDefaultClassLoader()
|
|
||||||
)
|
|
||||||
phoneStatusBarViewClass.hookAfterMethod("updateLayoutForCutout") {
|
|
||||||
if (XSPUtils.getBoolean("layout_compatibility_mode", false)) {
|
|
||||||
val context = (it.thisObject as ViewGroup).context
|
|
||||||
updateLayout(context)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//解决重叠
|
|
||||||
val miuiCollapsedStatusBarFragmentClass =
|
|
||||||
"com.android.systemui.statusbar.phone.MiuiCollapsedStatusBarFragment".findClass(
|
|
||||||
getDefaultClassLoader()
|
|
||||||
)
|
|
||||||
|
|
||||||
miuiCollapsedStatusBarFragmentClass.hookAfterMethod(
|
|
||||||
"showClock",
|
|
||||||
Boolean::class.java
|
|
||||||
) {
|
|
||||||
val MiuiPhoneStatusBarView =
|
|
||||||
XposedHelpers.getObjectField(it.thisObject, "mStatusBar") as ViewGroup
|
|
||||||
val res = MiuiPhoneStatusBarView.resources
|
|
||||||
val status_bar_ID =
|
|
||||||
res.getIdentifier("status_bar", "id", "com.android.systemui")
|
|
||||||
val status_bar = MiuiPhoneStatusBarView.findViewById<ViewGroup>(status_bar_ID)
|
|
||||||
//非锁屏下整个状态栏布局
|
|
||||||
val keyguardMgr =
|
|
||||||
status_bar.context.getSystemService(Context.KEYGUARD_SERVICE) as KeyguardManager
|
|
||||||
if (keyguardMgr.isKeyguardLocked) {
|
|
||||||
status_bar!!.visibility = View.GONE
|
|
||||||
} else {
|
|
||||||
status_bar!!.visibility = View.VISIBLE
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun updateLayout(context: Context) {
|
private fun updateLayout(context: Context) {
|
||||||
//判断屏幕方向
|
//判断屏幕方向
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ object StatusBarTimeCustomization : HookRegister() {
|
|||||||
val res: Resources = MiuiPhoneStatusBarView.resources
|
val res: Resources = MiuiPhoneStatusBarView.resources
|
||||||
val clockId: Int = res.getIdentifier("clock", "id", "com.android.systemui")
|
val clockId: Int = res.getIdentifier("clock", "id", "com.android.systemui")
|
||||||
val clock: TextView = MiuiPhoneStatusBarView.findViewById(clockId)
|
val clock: TextView = MiuiPhoneStatusBarView.findViewById(clockId)
|
||||||
clock.gravity = Gravity.CENTER
|
clock.gravity = Gravity.CENTER_HORIZONTAL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -194,5 +194,4 @@
|
|||||||
<string name="clock_right">Ceas la dreapta</string>
|
<string name="clock_right">Ceas la dreapta</string>
|
||||||
<string name="status_bar_layout_mode">Aspect bară de stare</string>
|
<string name="status_bar_layout_mode">Aspect bară de stare</string>
|
||||||
<string name="clock_center_and_icon_left">Ceas la centru și pictograme în stânga</string>
|
<string name="clock_center_and_icon_left">Ceas la centru și pictograme în stânga</string>
|
||||||
<string name="maximum_number_of_notification_icons">Numărul maxim de pictograme de notificare</string>
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -198,5 +198,4 @@
|
|||||||
<string name="clock_right">Часы справа</string>
|
<string name="clock_right">Часы справа</string>
|
||||||
<string name="status_bar_layout_mode">Стиль строки состояния</string>
|
<string name="status_bar_layout_mode">Стиль строки состояния</string>
|
||||||
<string name="clock_center_and_icon_left">Часы по центру и иконки слева</string>
|
<string name="clock_center_and_icon_left">Часы по центру и иконки слева</string>
|
||||||
<string name="maximum_number_of_notification_icons">Максимальное количество значков уведомлений</string>
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -193,6 +193,4 @@
|
|||||||
<string name="clock_center">时钟居中</string>
|
<string name="clock_center">时钟居中</string>
|
||||||
<string name="clock_right">时钟居右</string>
|
<string name="clock_right">时钟居右</string>
|
||||||
<string name="status_bar_layout_mode">状态栏布局模式</string>
|
<string name="status_bar_layout_mode">状态栏布局模式</string>
|
||||||
<string name="clock_center_and_icon_left">时间居中+左侧图标</string>
|
|
||||||
<string name="maximum_number_of_notification_icons">通知图标最大数量</string>
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -66,7 +66,7 @@
|
|||||||
<string name="status_bar_time_period">顯示時段</string>
|
<string name="status_bar_time_period">顯示時段</string>
|
||||||
<string name="status_bar_time_double_line">雙行顯示</string>
|
<string name="status_bar_time_double_line">雙行顯示</string>
|
||||||
<string name="status_bar_clock_size">時鐘大小(0:不更改)</string>
|
<string name="status_bar_clock_size">時鐘大小(0:不更改)</string>
|
||||||
<string name="status_bar_clock_double_line_size">雙行大小(0:不更改)</string>
|
<string name="status_bar_clock_double_line_size">雙排大小(0:不更改)</string>
|
||||||
<string name="matters_needing_attention">功能無法生效?</string>
|
<string name="matters_needing_attention">功能無法生效?</string>
|
||||||
<string name="Done">確定</string>
|
<string name="Done">確定</string>
|
||||||
<string name="about_module_summary">查看模組相關訊息</string>
|
<string name="about_module_summary">查看模組相關訊息</string>
|
||||||
@@ -170,7 +170,7 @@
|
|||||||
<string name="status_bar_dual_row_network_speed">雙行網路速度</string>
|
<string name="status_bar_dual_row_network_speed">雙行網路速度</string>
|
||||||
<string name="status_bar_dual_row_network_speed_summary">上下行網路速度顯示</string>
|
<string name="status_bar_dual_row_network_speed_summary">上下行網路速度顯示</string>
|
||||||
<string name="status_bar_network_speed">狀態欄網路速度</string>
|
<string name="status_bar_network_speed">狀態欄網路速度</string>
|
||||||
<string name="status_bar_network_speed_dual_row_size">雙行大小(0:不更改)</string>
|
<string name="status_bar_network_speed_dual_row_size">雙排大小(0:不更改)</string>
|
||||||
<string name="status_bar_network_speed_dual_row_icon">雙行圖示</string>
|
<string name="status_bar_network_speed_dual_row_icon">雙行圖示</string>
|
||||||
<string name="none">無</string>
|
<string name="none">無</string>
|
||||||
<string name="status_bar_network_speed_dual_row_gravity">雙行網速對齊</string>
|
<string name="status_bar_network_speed_dual_row_gravity">雙行網速對齊</string>
|
||||||
@@ -188,11 +188,9 @@
|
|||||||
<string name="big_mobile_type_icon_left_and_right_margins">大行動網路圖示左右邊距</string>
|
<string name="big_mobile_type_icon_left_and_right_margins">大行動網路圖示左右邊距</string>
|
||||||
<string name="cast">接力</string>
|
<string name="cast">接力</string>
|
||||||
<string name="force_support_send_app">允許所有應用使用接力</string>
|
<string name="force_support_send_app">允許所有應用使用接力</string>
|
||||||
<string name="status_bar_time_double_line_center_align">雙行居中對齊</string>
|
<string name="status_bar_time_double_line_center_align">雙排居中對齊</string>
|
||||||
<string name="default1">預設值</string>
|
<string name="default1">預設值</string>
|
||||||
<string name="clock_center">時鐘置中</string>
|
<string name="clock_center">時鐘置中</string>
|
||||||
<string name="clock_right">時鐘置右</string>
|
<string name="clock_right">時鐘置右</string>
|
||||||
<string name="status_bar_layout_mode">狀態欄布局模式</string>
|
<string name="status_bar_layout_mode">狀態欄布局模式</string>
|
||||||
<string name="clock_center_and_icon_left">時間居中+圖示置左</string>
|
|
||||||
<string name="maximum_number_of_notification_icons">通知圖示最大數量</string>
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
<string name="app_name" translatable="false">Simplicity Tools</string>
|
<string name="app_name" translatable="false">Simplicity Tools</string>
|
||||||
<string name="performance">Performance</string>
|
<string name="performance">Performence</string>
|
||||||
<string name="lock_max_fps">Lock the current refresh rate upper limit</string>
|
<string name="lock_max_fps">Lock the current refresh rate upper limit</string>
|
||||||
<string name="ui">Interface</string>
|
<string name="ui">Interface</string>
|
||||||
<string name="delete_on_post_notification">Remove display over notification</string>
|
<string name="delete_on_post_notification">Remove display over notification</string>
|
||||||
@@ -51,7 +51,7 @@
|
|||||||
<string name="hide_status_bar_network_speed_second">Hide network speed (/s) units</string>
|
<string name="hide_status_bar_network_speed_second">Hide network speed (/s) units</string>
|
||||||
<string name="menu">Menu</string>
|
<string name="menu">Menu</string>
|
||||||
<string name="Tips">Tips</string>
|
<string name="Tips">Tips</string>
|
||||||
<string name="skip_waiting_time">Skip 5/10 seconds warning time</string>
|
<string name="skip_waiting_time">Skip 5/10 second warning time</string>
|
||||||
<string name="unlock_unlimited_cropping">Remove restriction on cropping pictures/screenshots</string>
|
<string name="unlock_unlimited_cropping">Remove restriction on cropping pictures/screenshots</string>
|
||||||
<string name="hide_slave_wifi_icon">Hide WIFI secondary icon</string>
|
<string name="hide_slave_wifi_icon">Hide WIFI secondary icon</string>
|
||||||
<string name="HideLauncherIcon">Hide Launcher icon</string>
|
<string name="HideLauncherIcon">Hide Launcher icon</string>
|
||||||
@@ -158,8 +158,8 @@
|
|||||||
<string name="participate_in_translation_summary">Help us translate the app into your language</string>
|
<string name="participate_in_translation_summary">Help us translate the app into your language</string>
|
||||||
<string name="lock_screen_charging_current">Display current information during charging</string>
|
<string name="lock_screen_charging_current">Display current information during charging</string>
|
||||||
<string name="current_current">Current</string>
|
<string name="current_current">Current</string>
|
||||||
<string name="remove_open_app_confirmation_popup">Remove open app popup</string>
|
<string name="remove_open_app_confirmation_popup">remove open app popup</string>
|
||||||
<string name="remove_open_app_confirmation_popup_summary">Remove \"Allow XXX to open XXX\" Chain start popup</string>
|
<string name="remove_open_app_confirmation_popup_summary">remove \"Allow XXX to open XXX\" Chain start popup</string>
|
||||||
<string name="hide_volume_icon">Hide Volume icon</string>
|
<string name="hide_volume_icon">Hide Volume icon</string>
|
||||||
<string name="hide_zen_icon">Hide ZEN icon</string>
|
<string name="hide_zen_icon">Hide ZEN icon</string>
|
||||||
<string name="hide_icon">Hide Icon</string>
|
<string name="hide_icon">Hide Icon</string>
|
||||||
@@ -193,10 +193,4 @@
|
|||||||
<string name="cast">Cast</string>
|
<string name="cast">Cast</string>
|
||||||
<string name="force_support_send_app">Force all apps support open on another device</string>
|
<string name="force_support_send_app">Force all apps support open on another device</string>
|
||||||
<string name="status_bar_time_double_line_center_align">Dual row center align</string>
|
<string name="status_bar_time_double_line_center_align">Dual row center align</string>
|
||||||
<string name="default1">Default</string>
|
|
||||||
<string name="clock_center">Clock Center</string>
|
|
||||||
<string name="clock_right">Clock Right</string>
|
|
||||||
<string name="status_bar_layout_mode">Status bar layout mode</string>
|
|
||||||
<string name="clock_center_and_icon_left">Clock Center and Icon Left</string>
|
|
||||||
<string name="maximum_number_of_notification_icons">Maximum number of notification icons</string>
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
Reference in New Issue
Block a user