mirror of
https://github.com/LittleTurtle2333/SimplicityTools.git
synced 2026-07-14 20:31:19 +08:00
Compare commits
4 Commits
d56d291e51
...
acdbd23248
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
acdbd23248 | ||
|
|
2bed96532f | ||
|
|
314fc7b46f | ||
|
|
ff94fce5d0 |
@@ -48,6 +48,8 @@ Xposed仓库下载:[点击此处下载最新发行版](https://github.com/Xpos
|
||||
[LSPosed/CorePatch](https://github.com/LSPosed/CorePatch)
|
||||
##### GNU Lesser General Public License v2.1
|
||||
[577fkj/blockmiui](https://github.com/577fkj/blockmiui)
|
||||
##### Apache License 2.0
|
||||
[KyuubiRan/EzXHelper](https://github.com/KyuubiRan/EzXHelper)
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -45,6 +45,8 @@ Xposed Repo:[Click here to download the latest release](https://github.com/Xpo
|
||||
[LSPosed/CorePatch](https://github.com/LSPosed/CorePatch)
|
||||
##### GNU Lesser General Public License v2.1
|
||||
[577fkj/blockmiui](https://github.com/577fkj/blockmiui)
|
||||
##### Apache License 2.0
|
||||
[KyuubiRan/EzXHelper](https://github.com/KyuubiRan/EzXHelper)
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -508,13 +508,47 @@ class SettingsActivity : MIUIActivity() {
|
||||
)
|
||||
add(LineV())
|
||||
add(TitleTextV(resId = R.string.status_bar_layout))
|
||||
val statusBarLayoutMode: HashMap<Int, String> = hashMapOf()
|
||||
statusBarLayoutMode[0] = getString(R.string.default1)
|
||||
statusBarLayoutMode[1] = getString(R.string.clock_center)
|
||||
statusBarLayoutMode[2] = getString(R.string.clock_right)
|
||||
add(
|
||||
TextSummaryWithSwitchV(
|
||||
TextSummaryV(
|
||||
textId = R.string.status_bar_time_center,
|
||||
tipsId = R.string.status_bar_layout_summary
|
||||
),
|
||||
SwitchV("status_bar_time_center")
|
||||
TextWithSpinnerV(
|
||||
TextV(resId = R.string.status_bar_layout_mode),
|
||||
SpinnerV(
|
||||
arrayListOf<MIUIPopupData>().apply {
|
||||
add(MIUIPopupData(statusBarLayoutMode[0].toString()) {
|
||||
OwnSP.ownSP.edit().run {
|
||||
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()
|
||||
}
|
||||
})
|
||||
}, currentValue = statusBarLayoutMode[OwnSP.ownSP.getInt(
|
||||
"status_bar_layout_mode",
|
||||
0
|
||||
)].toString()
|
||||
)
|
||||
)
|
||||
)
|
||||
val layoutCompatibilityModeBinding = getDataBinding(
|
||||
|
||||
@@ -12,6 +12,7 @@ import android.widget.FrameLayout
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.TextView
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import cn.fkj233.ui.activity.dp2px
|
||||
import com.lt2333.simplicitytools.util.XSPUtils
|
||||
import com.lt2333.simplicitytools.util.findClass
|
||||
import com.lt2333.simplicitytools.util.getObjectField
|
||||
@@ -19,7 +20,7 @@ import com.lt2333.simplicitytools.util.hookAfterMethod
|
||||
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
|
||||
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
object StatusBarLayout: HookRegister() {
|
||||
object StatusBarLayout : HookRegister() {
|
||||
|
||||
private var mLeftLayout: LinearLayout? = null
|
||||
private var mRightLayout: LinearLayout? = null
|
||||
@@ -32,10 +33,17 @@ object StatusBarLayout: HookRegister() {
|
||||
private var statusBarBottom = 0
|
||||
|
||||
override fun init() {
|
||||
if (!XSPUtils.getBoolean("status_bar_time_center", false)) return
|
||||
val mode = XSPUtils.getInt("status_bar_layout_mode", 0)
|
||||
|
||||
when (mode) {
|
||||
//默认
|
||||
0 -> return
|
||||
//时钟居中
|
||||
1 -> {
|
||||
val collapsedStatusBarFragmentClass =
|
||||
"com.android.systemui.statusbar.phone.CollapsedStatusBarFragment".findClass(getDefaultClassLoader())
|
||||
"com.android.systemui.statusbar.phone.CollapsedStatusBarFragment".findClass(
|
||||
getDefaultClassLoader()
|
||||
)
|
||||
|
||||
collapsedStatusBarFragmentClass.hookAfterMethod(
|
||||
"onViewCreated",
|
||||
@@ -46,16 +54,25 @@ object StatusBarLayout: HookRegister() {
|
||||
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 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")
|
||||
res.getIdentifier(
|
||||
"phone_status_bar_left_container",
|
||||
"id",
|
||||
"com.android.systemui"
|
||||
)
|
||||
val notificationIconAreaInnerId: Int =
|
||||
res.getIdentifier("notification_icon_area_inner", "id", "com.android.systemui")
|
||||
res.getIdentifier(
|
||||
"notification_icon_area_inner",
|
||||
"id",
|
||||
"com.android.systemui"
|
||||
)
|
||||
statusBar = MiuiPhoneStatusBarView.findViewById(statusBarId)
|
||||
val statusBarContents: ViewGroup =
|
||||
MiuiPhoneStatusBarView.findViewById(statusBarContentsId)
|
||||
@@ -141,20 +158,11 @@ object StatusBarLayout: HookRegister() {
|
||||
}
|
||||
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 miuiPhoneStatusBarViewClass =
|
||||
"com.android.systemui.statusbar.phone.MiuiPhoneStatusBarView".findClass(getDefaultClassLoader())
|
||||
"com.android.systemui.statusbar.phone.MiuiPhoneStatusBarView".findClass(
|
||||
getDefaultClassLoader()
|
||||
)
|
||||
|
||||
miuiPhoneStatusBarViewClass.hookAfterMethod("updateNotificationIconAreaInnnerParent") {
|
||||
val viewGroup = it.thisObject as ViewGroup
|
||||
@@ -164,6 +172,51 @@ object StatusBarLayout: HookRegister() {
|
||||
)
|
||||
viewGroup.layoutParams = fullscreen_notification_icon_area_lp
|
||||
}
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
//时钟居右
|
||||
2 -> {
|
||||
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 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)
|
||||
|
||||
(clock.parent as ViewGroup).removeView(clock)
|
||||
battery!!.addView(clock)
|
||||
clock.setPadding(dp2px(context,5f),0,0,0)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ object StatusBarTimeCustomization : HookRegister() {
|
||||
val res: Resources = MiuiPhoneStatusBarView.resources
|
||||
val clockId: Int = res.getIdentifier("clock", "id", "com.android.systemui")
|
||||
val clock: TextView = MiuiPhoneStatusBarView.findViewById(clockId)
|
||||
clock.gravity = Gravity.CENTER_HORIZONTAL
|
||||
clock.gravity = Gravity.CENTER
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name" translatable="false">Simplicity Tools</string>
|
||||
<string name="performance">Performence</string>
|
||||
<string name="performance">Performance</string>
|
||||
<string name="lock_max_fps">Lock the current refresh rate upper limit</string>
|
||||
<string name="ui">Interface</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="menu">Menu</string>
|
||||
<string name="Tips">Tips</string>
|
||||
<string name="skip_waiting_time">Skip 5/10 second warning time</string>
|
||||
<string name="skip_waiting_time">Skip 5/10 seconds warning time</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="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="lock_screen_charging_current">Display current information during charging</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_summary">remove \"Allow XXX to open XXX\" Chain start 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="hide_volume_icon">Hide Volume icon</string>
|
||||
<string name="hide_zen_icon">Hide ZEN icon</string>
|
||||
<string name="hide_icon">Hide Icon</string>
|
||||
@@ -193,4 +193,8 @@
|
||||
<string name="cast">Cast</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="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>
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user