mirror of
https://github.com/LittleTurtle2333/SimplicityTools.git
synced 2026-07-13 20:01:17 +08:00
Compare commits
14 Commits
a484a3ba04
...
revert-233
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
519ded1f75 | ||
|
|
317340bf6f | ||
|
|
bc26ba512c | ||
|
|
cd28e662a1 | ||
|
|
f67d387020 | ||
|
|
f2354022aa | ||
|
|
d7a1af8846 | ||
|
|
8a1c8a85c3 | ||
|
|
12848808d3 | ||
|
|
7f23f07209 | ||
|
|
54b31ea478 | ||
|
|
44e6995da1 | ||
|
|
12e76869dd | ||
|
|
97212d74d3 |
50
.github/workflows/dev.yml
vendored
Normal file
50
.github/workflows/dev.yml
vendored
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
name: Dev
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ "main" ]
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- name: set up JDK 11
|
||||||
|
uses: actions/setup-java@v3
|
||||||
|
with:
|
||||||
|
java-version: '11'
|
||||||
|
distribution: 'temurin'
|
||||||
|
cache: gradle
|
||||||
|
|
||||||
|
- name: Grant execute permission for gradlew
|
||||||
|
run: chmod +x gradlew
|
||||||
|
|
||||||
|
- name: Clone UI
|
||||||
|
run: |
|
||||||
|
cd blockmiui
|
||||||
|
git submodule init
|
||||||
|
git submodule update
|
||||||
|
|
||||||
|
- name: Build with Gradle
|
||||||
|
run: |
|
||||||
|
bash ./gradlew assembleDebug
|
||||||
|
|
||||||
|
- name: Sign Debug APK
|
||||||
|
if: success()
|
||||||
|
id: sign_debug
|
||||||
|
uses: r0adkll/sign-android-release@v1.0.4
|
||||||
|
with:
|
||||||
|
releaseDirectory: ./app/build/outputs/apk/debug
|
||||||
|
signingKeyBase64: ${{ secrets.SIGNING_KEY }}
|
||||||
|
alias: ${{ secrets.KEY_STORE_ALIAS }}
|
||||||
|
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }}
|
||||||
|
keyPassword: ${{ secrets.KEY_STORE_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Upload Debug APK
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: WooBox_Debug
|
||||||
|
path: ${{ steps.sign_debug.outputs.signedReleaseFile }}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
name: Android CI
|
name: PR Check
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
@@ -15,6 +15,8 @@
|
|||||||
|
|
||||||
开发者:[酷安@乌堆小透明](http://www.coolapk.com/u/883441)
|
开发者:[酷安@乌堆小透明](http://www.coolapk.com/u/883441)
|
||||||
|
|
||||||
|
当前仅基于`Android13`进行开发,`Android12`几乎不再维护。也有基于`Android13`开发,但是能在`Android12`使用的情况,请广大社区使用`Android12`的开发者自行测试和修复后提交`Pull Request`。
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### 模块截图
|
### 模块截图
|
||||||
|
|||||||
@@ -11,6 +11,12 @@
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
### Module Description
|
||||||
|
|
||||||
|
Currently only developed based on `Android13`, `Android12` is almost no longer maintained. There are also cases where the development is based on `Android13`, but it can be used in `Android12`. Developers in the community who use `Android12` are requested to submit `Pull Request` after testing and repairing by themselves.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
### Screenshot
|
### Screenshot
|
||||||
|
|
||||||

|

|
||||||
|
|||||||
@@ -11,8 +11,8 @@ android {
|
|||||||
applicationId = "com.lt2333.simplicitytools"
|
applicationId = "com.lt2333.simplicitytools"
|
||||||
minSdk = 31
|
minSdk = 31
|
||||||
targetSdk = 33
|
targetSdk = 33
|
||||||
versionCode = 74
|
versionCode = 75
|
||||||
versionName = "1.7.4"
|
versionName = "1.7.5"
|
||||||
buildConfigField("String", "BUILD_TIME", "\"${System.currentTimeMillis()}\"")
|
buildConfigField("String", "BUILD_TIME", "\"${System.currentTimeMillis()}\"")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package com.lt2333.simplicitytools.activity.pages.s
|
package com.lt2333.simplicitytools.activity.pages.s
|
||||||
|
|
||||||
|
import android.content.Intent
|
||||||
|
import android.net.Uri
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.widget.Switch
|
import android.widget.Switch
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
@@ -11,8 +13,8 @@ import cn.fkj233.ui.activity.view.SwitchV
|
|||||||
import cn.fkj233.ui.activity.view.TextSummaryV
|
import cn.fkj233.ui.activity.view.TextSummaryV
|
||||||
import cn.fkj233.ui.activity.view.TextV
|
import cn.fkj233.ui.activity.view.TextV
|
||||||
import cn.fkj233.ui.dialog.MIUIDialog
|
import cn.fkj233.ui.dialog.MIUIDialog
|
||||||
|
import cn.fkj233.ui.dialog.NewDialog
|
||||||
import com.lt2333.simplicitytools.R
|
import com.lt2333.simplicitytools.R
|
||||||
import java.util.HashMap
|
|
||||||
|
|
||||||
|
|
||||||
@BMPage("scope_systemui", "System UI", hideMenu = false)
|
@BMPage("scope_systemui", "System UI", hideMenu = false)
|
||||||
@@ -54,11 +56,10 @@ class SystemUIPageForS : BasePage() {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
val layoutCompatibilityModeBinding = GetDataBinding({
|
val layoutCompatibilityBinding = GetDataBinding({
|
||||||
MIUIActivity.safeSP.getInt(
|
MIUIActivity.safeSP.getBoolean(
|
||||||
"screen_hole_location",
|
"layout_compatibility_mode", false
|
||||||
0
|
)
|
||||||
) == 2
|
|
||||||
}) { view, flags, data ->
|
}) { view, flags, data ->
|
||||||
when (flags) {
|
when (flags) {
|
||||||
1 -> (view as Switch).isEnabled = data as Boolean
|
1 -> (view as Switch).isEnabled = data as Boolean
|
||||||
@@ -66,57 +67,23 @@ class SystemUIPageForS : BasePage() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val screenHoleLocation: HashMap<Int, String> = hashMapOf<Int, String>().also {
|
TextSummaryWithSwitch(
|
||||||
it[0] = getString(R.string.off)
|
|
||||||
it[1] = getString(R.string.center)
|
|
||||||
it[2] = getString(R.string.left_or_right)
|
|
||||||
}
|
|
||||||
TextSummaryWithSpinner(
|
|
||||||
TextSummaryV(
|
TextSummaryV(
|
||||||
textId = R.string.layout_compatibility_mode,
|
textId = R.string.layout_compatibility_mode, tipsId = R.string.layout_compatibility_mode_summary
|
||||||
tipsId = R.string.screen_hole_location
|
), SwitchV("layout_compatibility_mode", dataBindingSend = layoutCompatibilityBinding.bindingSend)
|
||||||
),
|
)
|
||||||
SpinnerV(
|
|
||||||
screenHoleLocation[MIUIActivity.safeSP.getInt(
|
|
||||||
"screen_hole_location",
|
|
||||||
0
|
|
||||||
)].toString()
|
|
||||||
) {
|
|
||||||
add(screenHoleLocation[0].toString()) {
|
|
||||||
MIUIActivity.safeSP.putAny("screen_hole_location", 0)
|
|
||||||
layoutCompatibilityModeBinding.binding.Send().send(false)
|
|
||||||
}
|
|
||||||
add(screenHoleLocation[1].toString()) {
|
|
||||||
MIUIActivity.safeSP.putAny("screen_hole_location", 1)
|
|
||||||
layoutCompatibilityModeBinding.binding.Send().send(false)
|
|
||||||
}
|
|
||||||
add(screenHoleLocation[2].toString()) {
|
|
||||||
MIUIActivity.safeSP.putAny("screen_hole_location", 2)
|
|
||||||
layoutCompatibilityModeBinding.binding.Send().send(true)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
Text(
|
Text(
|
||||||
textId = R.string.left_margin,
|
textId = R.string.left_margin, dataBindingRecv = layoutCompatibilityBinding.binding.getRecv(2)
|
||||||
dataBindingRecv = layoutCompatibilityModeBinding.binding.getRecv(2)
|
|
||||||
)
|
)
|
||||||
SeekBarWithText(
|
SeekBarWithText(
|
||||||
"status_bar_left_margin",
|
"status_bar_left_margin", 0, 300, 0, dataBindingRecv = layoutCompatibilityBinding.binding.getRecv(2)
|
||||||
0,
|
|
||||||
300,
|
|
||||||
0,
|
|
||||||
dataBindingRecv = layoutCompatibilityModeBinding.binding.getRecv(2)
|
|
||||||
)
|
)
|
||||||
Text(
|
Text(
|
||||||
textId = R.string.right_margin,
|
textId = R.string.right_margin, dataBindingRecv = layoutCompatibilityBinding.binding.getRecv(2)
|
||||||
dataBindingRecv = layoutCompatibilityModeBinding.binding.getRecv(2)
|
|
||||||
)
|
)
|
||||||
SeekBarWithText(
|
SeekBarWithText(
|
||||||
"status_bar_right_margin",
|
"status_bar_right_margin", 0, 300, 0, dataBindingRecv = layoutCompatibilityBinding.binding.getRecv(2)
|
||||||
0,
|
|
||||||
300,
|
|
||||||
0,
|
|
||||||
dataBindingRecv = layoutCompatibilityModeBinding.binding.getRecv(2)
|
|
||||||
)
|
)
|
||||||
Line()
|
Line()
|
||||||
TitleText(textId = R.string.status_bar_clock_format)
|
TitleText(textId = R.string.status_bar_clock_format)
|
||||||
@@ -246,23 +213,37 @@ class SystemUIPageForS : BasePage() {
|
|||||||
|
|
||||||
//极客模式起始
|
//极客模式起始
|
||||||
TextSummaryWithArrow(TextSummaryV(textId = R.string.custom_clock_format_geek) {
|
TextSummaryWithArrow(TextSummaryV(textId = R.string.custom_clock_format_geek) {
|
||||||
MIUIDialog(activity) {
|
NewDialog(activity) {
|
||||||
setTitle(R.string.custom_clock_format_geek)
|
setTitle(R.string.custom_clock_format_geek)
|
||||||
setEditText(MIUIActivity.safeSP.getString("custom_clock_format_geek", "HH:mm:ss"), "", isSingleLine = false)
|
setEditText(
|
||||||
setLButton(textId = R.string.cancel) {
|
MIUIActivity.safeSP.getString("custom_clock_format_geek", "HH:mm:ss"), "", isSingleLine = false
|
||||||
dismiss()
|
)
|
||||||
|
Button(getString(R.string.click_to_view_use_cases)) {
|
||||||
|
val locale = context.resources.configuration.locale
|
||||||
|
val language = locale.language
|
||||||
|
if (language.endsWith("zh")) {
|
||||||
|
val uri = Uri.parse("https://zhuti.designer.xiaomi.com/docs/grammar/#%E6%97%B6%E9%97%B4%E6%97%A5%E6%9C%9F")
|
||||||
|
val intent = Intent(Intent.ACTION_VIEW, uri)
|
||||||
|
activity.startActivity(intent)
|
||||||
|
} else {
|
||||||
|
val uri = Uri.parse("https://docs.google.com/spreadsheets/d/1ghkT2iFbxB3bT4TKCiKAfmEdGt6kTVKFU3dm4Nz1or8/edit?usp=sharing")
|
||||||
|
val intent = Intent(Intent.ACTION_VIEW, uri)
|
||||||
|
activity.startActivity(intent)
|
||||||
}
|
}
|
||||||
setRButton(textId = R.string.Done) {
|
}
|
||||||
|
Button(getString(R.string.Done)) {
|
||||||
if (getEditText().isNotEmpty()) {
|
if (getEditText().isNotEmpty()) {
|
||||||
try {
|
try {
|
||||||
MIUIActivity.safeSP.putAny("custom_clock_format_geek", getEditText())
|
MIUIActivity.safeSP.putAny("custom_clock_format_geek", getEditText())
|
||||||
dismiss()
|
dismiss()
|
||||||
return@setRButton
|
return@Button
|
||||||
} catch (_: Throwable) {
|
} catch (_: Throwable) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Toast.makeText(activity, R.string.input_error, Toast.LENGTH_SHORT)
|
Toast.makeText(activity, R.string.input_error, Toast.LENGTH_SHORT).show()
|
||||||
.show()
|
}
|
||||||
|
Button(getString(R.string.cancel), cancelStyle = true) {
|
||||||
|
dismiss()
|
||||||
}
|
}
|
||||||
}.show()
|
}.show()
|
||||||
}, dataBindingRecv = customClockGeekBinding.binding.getRecv(2))
|
}, dataBindingRecv = customClockGeekBinding.binding.getRecv(2))
|
||||||
|
|||||||
@@ -566,6 +566,13 @@ import com.lt2333.simplicitytools.R
|
|||||||
)
|
)
|
||||||
Line()
|
Line()
|
||||||
TitleText(textId = R.string.control_center)
|
TitleText(textId = R.string.control_center)
|
||||||
|
TextSummaryWithSwitch(
|
||||||
|
TextSummaryV(
|
||||||
|
textId = R.string.disable_bluetooth_temporarily_off
|
||||||
|
), SwitchV(
|
||||||
|
"disable_bluetooth_temporarily_off"
|
||||||
|
)
|
||||||
|
)
|
||||||
val controlCenterWeatherBinding = GetDataBinding({
|
val controlCenterWeatherBinding = GetDataBinding({
|
||||||
MIUIActivity.safeSP.getBoolean(
|
MIUIActivity.safeSP.getBoolean(
|
||||||
"control_center_weather", false
|
"control_center_weather", false
|
||||||
|
|||||||
@@ -32,37 +32,7 @@ import com.lt2333.simplicitytools.hooks.rules.s.systemui.StatusBarLayoutForS
|
|||||||
import com.lt2333.simplicitytools.hooks.rules.s.systemui.StatusBarNetworkSpeedRefreshSpeedForS
|
import com.lt2333.simplicitytools.hooks.rules.s.systemui.StatusBarNetworkSpeedRefreshSpeedForS
|
||||||
import com.lt2333.simplicitytools.hooks.rules.s.systemui.StatusBarTimeCustomizationForS
|
import com.lt2333.simplicitytools.hooks.rules.s.systemui.StatusBarTimeCustomizationForS
|
||||||
import com.lt2333.simplicitytools.hooks.rules.s.systemui.WaveChargeForS
|
import com.lt2333.simplicitytools.hooks.rules.s.systemui.WaveChargeForS
|
||||||
import com.lt2333.simplicitytools.hooks.rules.t.systemui.BatteryPercentageForT
|
import com.lt2333.simplicitytools.hooks.rules.t.systemui.*
|
||||||
import com.lt2333.simplicitytools.hooks.rules.t.systemui.CanNotificationSlideForT
|
|
||||||
import com.lt2333.simplicitytools.hooks.rules.t.systemui.ControlCenterWeatherForT
|
|
||||||
import com.lt2333.simplicitytools.hooks.rules.t.systemui.CustomMobileTypeTextForT
|
|
||||||
import com.lt2333.simplicitytools.hooks.rules.t.systemui.DoubleLineNetworkSpeedForT
|
|
||||||
import com.lt2333.simplicitytools.hooks.rules.t.systemui.HideBatteryIconForT
|
|
||||||
import com.lt2333.simplicitytools.hooks.rules.t.systemui.HideHDIconForT
|
|
||||||
import com.lt2333.simplicitytools.hooks.rules.t.systemui.HideMobileActivityIconForT
|
|
||||||
import com.lt2333.simplicitytools.hooks.rules.t.systemui.HideMobileTypeIconForT
|
|
||||||
import com.lt2333.simplicitytools.hooks.rules.t.systemui.HideNetworkSpeedSplitterForT
|
|
||||||
import com.lt2333.simplicitytools.hooks.rules.t.systemui.HideSimIconForT
|
|
||||||
import com.lt2333.simplicitytools.hooks.rules.t.systemui.HideStatusBarIconForT
|
|
||||||
import com.lt2333.simplicitytools.hooks.rules.t.systemui.HideStatusBarNetworkSpeedSecondForT
|
|
||||||
import com.lt2333.simplicitytools.hooks.rules.t.systemui.HideWifiActivityIconForT
|
|
||||||
import com.lt2333.simplicitytools.hooks.rules.t.systemui.LockScreenClockDisplaySecondsForT
|
|
||||||
import com.lt2333.simplicitytools.hooks.rules.t.systemui.LockScreenCurrentForT
|
|
||||||
import com.lt2333.simplicitytools.hooks.rules.t.systemui.LockScreenDoubleTapToSleepForT
|
|
||||||
import com.lt2333.simplicitytools.hooks.rules.t.systemui.MaximumNumberOfNotificationIconsForT
|
|
||||||
import com.lt2333.simplicitytools.hooks.rules.t.systemui.NewNotificationWeatherForT
|
|
||||||
import com.lt2333.simplicitytools.hooks.rules.t.systemui.NotificationWeatherForT
|
|
||||||
import com.lt2333.simplicitytools.hooks.rules.t.systemui.OldNotificationWeatherForT
|
|
||||||
import com.lt2333.simplicitytools.hooks.rules.t.systemui.OldQSCustomForT
|
|
||||||
import com.lt2333.simplicitytools.hooks.rules.t.systemui.RemoveLockScreenCameraForT
|
|
||||||
import com.lt2333.simplicitytools.hooks.rules.t.systemui.RemoveTheLeftSideOfTheLockScreenForT
|
|
||||||
import com.lt2333.simplicitytools.hooks.rules.t.systemui.ShowWifiStandardForT
|
|
||||||
import com.lt2333.simplicitytools.hooks.rules.t.systemui.StatusBarBigMobileTypeIconForT
|
|
||||||
import com.lt2333.simplicitytools.hooks.rules.t.systemui.StatusBarDoubleTapToSleepForT
|
|
||||||
import com.lt2333.simplicitytools.hooks.rules.t.systemui.StatusBarLayoutForT
|
|
||||||
import com.lt2333.simplicitytools.hooks.rules.t.systemui.StatusBarNetworkSpeedRefreshSpeedForT
|
|
||||||
import com.lt2333.simplicitytools.hooks.rules.t.systemui.StatusBarTimeCustomizationForT
|
|
||||||
import com.lt2333.simplicitytools.hooks.rules.t.systemui.WaveChargeForT
|
|
||||||
import com.lt2333.simplicitytools.utils.xposed.base.AppRegister
|
import com.lt2333.simplicitytools.utils.xposed.base.AppRegister
|
||||||
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
import de.robv.android.xposed.callbacks.XC_LoadPackage
|
||||||
|
|
||||||
@@ -105,6 +75,7 @@ object SystemUI : AppRegister() {
|
|||||||
CanNotificationSlideForT, //允许下滑通知打开小窗
|
CanNotificationSlideForT, //允许下滑通知打开小窗
|
||||||
LockScreenClockDisplaySecondsForT, // 锁屏时钟显示秒
|
LockScreenClockDisplaySecondsForT, // 锁屏时钟显示秒
|
||||||
ShowWifiStandardForT, // 显示 WIFI 角标
|
ShowWifiStandardForT, // 显示 WIFI 角标
|
||||||
|
DisableBluetoothTemporarilyOffForT, //禁用临时蓝牙关闭
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.lt2333.simplicitytools.hooks.rules.s.systemui
|
package com.lt2333.simplicitytools.hooks.rules.s.systemui
|
||||||
|
|
||||||
|
|
||||||
import android.app.KeyguardManager
|
import android.app.KeyguardManager
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.res.Configuration
|
import android.content.res.Configuration
|
||||||
@@ -16,10 +17,11 @@ 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
|
||||||
|
|
||||||
|
|
||||||
object StatusBarLayoutForS : HookRegister() {
|
object StatusBarLayoutForS : HookRegister() {
|
||||||
|
|
||||||
private val getMode = XSPUtils.getInt("status_bar_layout_mode", 0)
|
private val getMode = XSPUtils.getInt("status_bar_layout_mode", 0)
|
||||||
private val getHoleLocation = XSPUtils.getInt("screen_hole_location", 0)
|
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
|
||||||
@@ -32,23 +34,31 @@ object StatusBarLayoutForS : HookRegister() {
|
|||||||
var mCenterLayout: LinearLayout?
|
var mCenterLayout: LinearLayout?
|
||||||
var statusBar: ViewGroup? = null
|
var statusBar: ViewGroup? = null
|
||||||
|
|
||||||
fun updateLayout(context: Context) {
|
//判断屏幕状态更新布局 mode: 1正常布局 2居中布局
|
||||||
//判断屏幕方向
|
fun updateLayout(context: Context,mode: Int) {
|
||||||
|
when(mode){
|
||||||
|
1->{
|
||||||
val mConfiguration: Configuration = context.resources.configuration
|
val mConfiguration: Configuration = context.resources.configuration
|
||||||
if (mConfiguration.orientation == Configuration.ORIENTATION_PORTRAIT) {
|
if (mConfiguration.orientation == Configuration.ORIENTATION_PORTRAIT) { //横屏
|
||||||
|
statusBar!!.setPadding(statusBarLeft, statusBarTop, statusBarRight, statusBarBottom)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
2->{
|
||||||
|
val mConfiguration: Configuration = context.resources.configuration
|
||||||
|
if (mConfiguration.orientation == Configuration.ORIENTATION_PORTRAIT) { //横屏
|
||||||
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 {
|
}else{ //竖屏
|
||||||
//横屏状态
|
mLeftLayout!!.setPadding(0, 0, 0, 0)
|
||||||
mLeftLayout!!.setPadding(175, 0, 0, 0)
|
mRightLayout!!.setPadding(0, 0, 0, 0)
|
||||||
mRightLayout!!.setPadding(0, 0, 175, 0)
|
}
|
||||||
statusBar!!.setPadding(0, statusBarTop, 0, statusBarBottom)
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//判断是否开启居中挖孔兼容模式
|
//判断是否开启挖孔兼容模式
|
||||||
if (getHoleLocation == 1) {
|
if (isCompatibilityMode) {
|
||||||
findMethod("com.android.systemui.ScreenDecorations\$DisplayCutoutView") {
|
findMethod("com.android.systemui.ScreenDecorations\$DisplayCutoutView") {
|
||||||
name == "boundsFromDirection" && parameterCount == 3 && isStatic
|
name == "boundsFromDirection" && parameterCount == 3 && isStatic
|
||||||
}.hookBefore {
|
}.hookBefore {
|
||||||
@@ -56,48 +66,83 @@ object StatusBarLayoutForS : HookRegister() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//修改对应布局
|
||||||
when (getMode) {
|
when (getMode) {
|
||||||
//默认
|
//默认
|
||||||
0 -> return
|
0 -> {
|
||||||
|
|
||||||
|
findMethod("com.android.systemui.statusbar.phone.CollapsedStatusBarFragment") {
|
||||||
|
name == "onViewCreated" && parameterCount == 2
|
||||||
|
}.hookAfter { param ->
|
||||||
|
val miuiPhoneStatusBarView = param.thisObject.getObjectAs<ViewGroup>("mStatusBar")
|
||||||
|
val context: Context = miuiPhoneStatusBarView.context
|
||||||
|
val res: Resources = miuiPhoneStatusBarView.resources
|
||||||
|
val statusBarId: Int = res.getIdentifier("status_bar", "id", "com.android.systemui")
|
||||||
|
statusBar = miuiPhoneStatusBarView.findViewById(statusBarId)
|
||||||
|
if (statusBar == null) return@hookAfter
|
||||||
|
|
||||||
|
statusBarLeft = statusBar!!.paddingLeft
|
||||||
|
statusBarTop = statusBar!!.paddingTop
|
||||||
|
statusBarRight = statusBar!!.paddingRight
|
||||||
|
statusBarBottom = statusBar!!.paddingBottom
|
||||||
|
|
||||||
|
|
||||||
|
if (isCompatibilityMode) {
|
||||||
|
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,1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//兼容模式
|
||||||
|
findMethod("com.android.systemui.statusbar.phone.PhoneStatusBarView") {
|
||||||
|
name == "updateLayoutForCutout"
|
||||||
|
}.hookAfter {
|
||||||
|
if (isCompatibilityMode) {
|
||||||
|
val context = (it.thisObject as ViewGroup).context
|
||||||
|
updateLayout(context,1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
//时钟居中
|
//时钟居中
|
||||||
1 -> {
|
1 -> {
|
||||||
findMethod("com.android.systemui.statusbar.phone.CollapsedStatusBarFragment") {
|
findMethod("com.android.systemui.statusbar.phone.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", "id", "com.android.systemui"
|
||||||
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 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(
|
||||||
@@ -108,41 +153,39 @@ object StatusBarLayoutForS : 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)
|
||||||
@@ -160,7 +203,7 @@ object StatusBarLayoutForS : HookRegister() {
|
|||||||
statusBarBottom = statusBar!!.paddingBottom
|
statusBarBottom = statusBar!!.paddingBottom
|
||||||
|
|
||||||
|
|
||||||
if (getHoleLocation == 2) {
|
if (isCompatibilityMode) {
|
||||||
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
|
||||||
@@ -170,7 +213,7 @@ object StatusBarLayoutForS : HookRegister() {
|
|||||||
if (customRightMargin != 0) {
|
if (customRightMargin != 0) {
|
||||||
statusBarRight = customRightMargin
|
statusBarRight = customRightMargin
|
||||||
}
|
}
|
||||||
updateLayout(context)
|
updateLayout(context,2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -179,7 +222,7 @@ object StatusBarLayoutForS : HookRegister() {
|
|||||||
}.hookAfter {
|
}.hookAfter {
|
||||||
hasEnable("layout_compatibility_mode") {
|
hasEnable("layout_compatibility_mode") {
|
||||||
val context = (it.thisObject as ViewGroup).context
|
val context = (it.thisObject as ViewGroup).context
|
||||||
updateLayout(context)
|
updateLayout(context,2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -188,14 +231,12 @@ object StatusBarLayoutForS : HookRegister() {
|
|||||||
findMethod("com.android.systemui.statusbar.phone.CollapsedStatusBarFragment") {
|
findMethod("com.android.systemui.statusbar.phone.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")
|
||||||
|
|
||||||
@@ -207,8 +248,7 @@ object StatusBarLayoutForS : 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)
|
||||||
}
|
}
|
||||||
@@ -220,6 +260,36 @@ object StatusBarLayoutForS : HookRegister() {
|
|||||||
battery.addView(mRightLayout)
|
battery.addView(mRightLayout)
|
||||||
(clock.parent as ViewGroup).removeView(clock)
|
(clock.parent as ViewGroup).removeView(clock)
|
||||||
mRightLayout!!.addView(clock)
|
mRightLayout!!.addView(clock)
|
||||||
|
|
||||||
|
|
||||||
|
statusBarLeft = statusBar!!.paddingLeft
|
||||||
|
statusBarTop = statusBar!!.paddingTop
|
||||||
|
statusBarRight = statusBar!!.paddingRight
|
||||||
|
statusBarBottom = statusBar!!.paddingBottom
|
||||||
|
|
||||||
|
|
||||||
|
if (isCompatibilityMode) {
|
||||||
|
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,1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//兼容模式
|
||||||
|
findMethod("com.android.systemui.statusbar.phone.PhoneStatusBarView") {
|
||||||
|
name == "updateLayoutForCutout"
|
||||||
|
}.hookAfter {
|
||||||
|
if (isCompatibilityMode) {
|
||||||
|
val context = (it.thisObject as ViewGroup).context
|
||||||
|
updateLayout(context,1)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//时钟居中+图标居左
|
//时钟居中+图标居左
|
||||||
@@ -227,65 +297,45 @@ object StatusBarLayoutForS : HookRegister() {
|
|||||||
findMethod("com.android.systemui.statusbar.phone.CollapsedStatusBarFragment") {
|
findMethod("com.android.systemui.statusbar.phone.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", "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 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(
|
||||||
@@ -299,11 +349,9 @@ object StatusBarLayoutForS : 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
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -312,16 +360,14 @@ object StatusBarLayoutForS : 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
|
||||||
@@ -331,24 +377,25 @@ object StatusBarLayoutForS : 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
|
||||||
|
|
||||||
@@ -375,7 +422,7 @@ object StatusBarLayoutForS : HookRegister() {
|
|||||||
statusBarBottom = statusBar!!.paddingBottom
|
statusBarBottom = statusBar!!.paddingBottom
|
||||||
|
|
||||||
|
|
||||||
if (getHoleLocation == 2) {
|
if (isCompatibilityMode) {
|
||||||
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
|
||||||
@@ -385,16 +432,16 @@ object StatusBarLayoutForS : HookRegister() {
|
|||||||
if (customRightMargin != 0) {
|
if (customRightMargin != 0) {
|
||||||
statusBarRight = customRightMargin
|
statusBarRight = customRightMargin
|
||||||
}
|
}
|
||||||
updateLayout(context)
|
updateLayout(context,2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//兼容模式
|
//兼容模式
|
||||||
findMethod("com.android.systemui.statusbar.phone.PhoneStatusBarView") {
|
findMethod("com.android.systemui.statusbar.phone.PhoneStatusBarView") {
|
||||||
name == "updateLayoutForCutout"
|
name == "updateLayoutForCutout"
|
||||||
}.hookAfter {
|
}.hookAfter {
|
||||||
if (getHoleLocation == 2) {
|
if (isCompatibilityMode) {
|
||||||
val context = (it.thisObject as ViewGroup).context
|
val context = (it.thisObject as ViewGroup).context
|
||||||
updateLayout(context)
|
updateLayout(context,2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -404,12 +451,10 @@ object StatusBarLayoutForS : 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 {
|
||||||
|
|||||||
@@ -2,12 +2,10 @@ package com.lt2333.simplicitytools.hooks.rules.s.systemui
|
|||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.res.Resources
|
|
||||||
import android.os.Handler
|
import android.os.Handler
|
||||||
import android.provider.Settings
|
import android.provider.Settings
|
||||||
import android.util.TypedValue
|
import android.util.TypedValue
|
||||||
import android.view.Gravity
|
import android.view.Gravity
|
||||||
import android.view.ViewGroup
|
|
||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import com.github.kyuubiran.ezxhelper.utils.*
|
import com.github.kyuubiran.ezxhelper.utils.*
|
||||||
import com.lt2333.simplicitytools.utils.XSPUtils
|
import com.lt2333.simplicitytools.utils.XSPUtils
|
||||||
@@ -16,6 +14,7 @@ import java.lang.reflect.Method
|
|||||||
import java.text.SimpleDateFormat
|
import java.text.SimpleDateFormat
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
|
|
||||||
object StatusBarTimeCustomizationForS : HookRegister() {
|
object StatusBarTimeCustomizationForS : HookRegister() {
|
||||||
|
|
||||||
private val getMode = XSPUtils.getInt("custom_clock_mode", 0)
|
private val getMode = XSPUtils.getInt("custom_clock_mode", 0)
|
||||||
@@ -30,14 +29,12 @@ object StatusBarTimeCustomizationForS : HookRegister() {
|
|||||||
private val isSecond = XSPUtils.getBoolean("status_bar_time_seconds", false)
|
private val isSecond = XSPUtils.getBoolean("status_bar_time_seconds", false)
|
||||||
private val isDoubleHour = XSPUtils.getBoolean("status_bar_time_double_hour", false)
|
private val isDoubleHour = XSPUtils.getBoolean("status_bar_time_double_hour", false)
|
||||||
private val isPeriod = XSPUtils.getBoolean("status_bar_time_period", true)
|
private val isPeriod = XSPUtils.getBoolean("status_bar_time_period", true)
|
||||||
private val isCenterAlign =
|
private val isCenterAlign = XSPUtils.getBoolean("status_bar_time_double_line_center_align", false)
|
||||||
XSPUtils.getBoolean("status_bar_time_double_line_center_align", false)
|
|
||||||
|
|
||||||
//极客模式
|
//极客模式
|
||||||
private val getGeekClockSize = XSPUtils.getInt("status_bar_clock_size_geek", 0)
|
private val getGeekClockSize = XSPUtils.getInt("status_bar_clock_size_geek", 0)
|
||||||
private val getGeekFormat = XSPUtils.getString("custom_clock_format_geek", "HH:mm:ss")
|
private val getGeekFormat = XSPUtils.getString("custom_clock_format_geek", "HH:mm:ss")
|
||||||
private val isGeekCenterAlign =
|
private val isGeekCenterAlign = XSPUtils.getBoolean("status_bar_time_center_align_geek", false)
|
||||||
XSPUtils.getBoolean("status_bar_time_center_align_geek", false)
|
|
||||||
|
|
||||||
private lateinit var nowTime: Date
|
private lateinit var nowTime: Date
|
||||||
private var str = ""
|
private var str = ""
|
||||||
@@ -83,9 +80,7 @@ object StatusBarTimeCustomizationForS : HookRegister() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Timer().scheduleAtFixedRate(
|
Timer().scheduleAtFixedRate(
|
||||||
T(),
|
T(), 1000 - System.currentTimeMillis() % 1000, 1000
|
||||||
1000 - System.currentTimeMillis() % 1000,
|
|
||||||
1000
|
|
||||||
)
|
)
|
||||||
} catch (_: Exception) {
|
} catch (_: Exception) {
|
||||||
}
|
}
|
||||||
@@ -98,8 +93,7 @@ object StatusBarTimeCustomizationForS : HookRegister() {
|
|||||||
val textV = it.thisObject as TextView
|
val textV = it.thisObject as TextView
|
||||||
if (textV.resources.getResourceEntryName(textV.id) == "clock") {
|
if (textV.resources.getResourceEntryName(textV.id) == "clock") {
|
||||||
val t = Settings.System.getString(
|
val t = Settings.System.getString(
|
||||||
c!!.contentResolver,
|
c!!.contentResolver, Settings.System.TIME_12_24
|
||||||
Settings.System.TIME_12_24
|
|
||||||
)
|
)
|
||||||
val is24 = t == "24"
|
val is24 = t == "24"
|
||||||
nowTime = Calendar.getInstance().time
|
nowTime = Calendar.getInstance().time
|
||||||
@@ -110,15 +104,18 @@ object StatusBarTimeCustomizationForS : HookRegister() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isCenterAlign) {
|
if (isCenterAlign) {
|
||||||
findMethod("com.android.systemui.statusbar.phone.CollapsedStatusBarFragment") {
|
findConstructor("com.android.systemui.statusbar.views.MiuiClock") {
|
||||||
name == "onViewCreated" && parameterCount == 2
|
paramCount == 3
|
||||||
}.hookAfter {
|
}.hookAfter {
|
||||||
val miuiPhoneStatusBarView =
|
try {
|
||||||
it.thisObject.getObject("mStatusBar") as ViewGroup
|
val textV = it.thisObject as TextView
|
||||||
val res: Resources = miuiPhoneStatusBarView.resources
|
if (textV.resources.getResourceEntryName(textV.id) == "clock") {
|
||||||
val clockId: Int = res.getIdentifier("clock", "id", "com.android.systemui")
|
c = it.args[0] as Context
|
||||||
val clock: TextView = miuiPhoneStatusBarView.findViewById(clockId)
|
val textV = it.thisObject as TextView
|
||||||
clock.gravity = Gravity.CENTER
|
textV.gravity = Gravity.CENTER
|
||||||
|
}
|
||||||
|
} catch (_: Exception) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -152,9 +149,7 @@ object StatusBarTimeCustomizationForS : HookRegister() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Timer().scheduleAtFixedRate(
|
Timer().scheduleAtFixedRate(
|
||||||
T(),
|
T(), 1000 - System.currentTimeMillis() % 1000, 1000
|
||||||
1000 - System.currentTimeMillis() % 1000,
|
|
||||||
1000
|
|
||||||
)
|
)
|
||||||
} catch (_: Exception) {
|
} catch (_: Exception) {
|
||||||
}
|
}
|
||||||
@@ -162,27 +157,38 @@ object StatusBarTimeCustomizationForS : HookRegister() {
|
|||||||
|
|
||||||
findMethod("com.android.systemui.statusbar.views.MiuiClock") {
|
findMethod("com.android.systemui.statusbar.views.MiuiClock") {
|
||||||
name == "updateTime"
|
name == "updateTime"
|
||||||
}.hookAfter {
|
}.hookBefore {
|
||||||
try {
|
try {
|
||||||
val textV = it.thisObject as TextView
|
val textV = it.thisObject as TextView
|
||||||
if (textV.resources.getResourceEntryName(textV.id) == "clock") {
|
if (textV.resources.getResourceEntryName(textV.id) == "clock") {
|
||||||
nowTime = Calendar.getInstance().time
|
val mMiuiStatusBarClockController = textV.getObject("mMiuiStatusBarClockController")
|
||||||
textV.text = SimpleDateFormat(getGeekFormat).format(nowTime)
|
val mCalendar = mMiuiStatusBarClockController.invokeMethodAuto("getCalendar")
|
||||||
|
mCalendar?.invokeMethodAuto(
|
||||||
|
"setTimeInMillis", System.currentTimeMillis()
|
||||||
|
)
|
||||||
|
val textSb = StringBuilder()
|
||||||
|
val formatSb = StringBuilder(getGeekFormat.toString())
|
||||||
|
mCalendar?.invokeMethodAuto("format", c, textSb, formatSb)
|
||||||
|
textV.text = textSb.toString()
|
||||||
|
it.result = null
|
||||||
}
|
}
|
||||||
} catch (_: Exception) {
|
} catch (_: Exception) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isGeekCenterAlign) {
|
if (isGeekCenterAlign) {
|
||||||
findMethod("com.android.systemui.statusbar.phone.CollapsedStatusBarFragment") {
|
findConstructor("com.android.systemui.statusbar.views.MiuiClock") {
|
||||||
name == "onViewCreated" && parameterCount == 2
|
paramCount == 3
|
||||||
}.hookAfter {
|
}.hookAfter {
|
||||||
val miuiPhoneStatusBarView =
|
try {
|
||||||
it.thisObject.getObject("mStatusBar") as ViewGroup
|
val textV = it.thisObject as TextView
|
||||||
val res: Resources = miuiPhoneStatusBarView.resources
|
if (textV.resources.getResourceEntryName(textV.id) == "clock") {
|
||||||
val clockId: Int = res.getIdentifier("clock", "id", "com.android.systemui")
|
c = it.args[0] as Context
|
||||||
val clock: TextView = miuiPhoneStatusBarView.findViewById(clockId)
|
val textV = it.thisObject as TextView
|
||||||
clock.gravity = Gravity.CENTER
|
textV.gravity = Gravity.CENTER
|
||||||
|
}
|
||||||
|
} catch (_: Exception) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -197,7 +203,6 @@ object StatusBarTimeCustomizationForS : HookRegister() {
|
|||||||
if (isYear) {
|
if (isYear) {
|
||||||
if (isZh) {
|
if (isZh) {
|
||||||
datePattern += "YY年"
|
datePattern += "YY年"
|
||||||
// if (!isHideSpace) datePattern = "$datePattern "
|
|
||||||
} else {
|
} else {
|
||||||
datePattern += "YY"
|
datePattern += "YY"
|
||||||
if (isMonth || isDay) datePattern += "/"
|
if (isMonth || isDay) datePattern += "/"
|
||||||
@@ -206,7 +211,6 @@ object StatusBarTimeCustomizationForS : HookRegister() {
|
|||||||
if (isMonth) {
|
if (isMonth) {
|
||||||
if (isZh) {
|
if (isZh) {
|
||||||
datePattern += "M月"
|
datePattern += "M月"
|
||||||
// if (!isHideSpace) datePattern = "$datePattern "
|
|
||||||
} else {
|
} else {
|
||||||
datePattern += "M"
|
datePattern += "M"
|
||||||
if (isDay) datePattern += "/"
|
if (isDay) datePattern += "/"
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.lt2333.simplicitytools.hooks.rules.t.systemui
|
||||||
|
|
||||||
|
import com.github.kyuubiran.ezxhelper.utils.findMethod
|
||||||
|
import com.github.kyuubiran.ezxhelper.utils.hookBefore
|
||||||
|
import com.lt2333.simplicitytools.utils.hasEnable
|
||||||
|
import com.lt2333.simplicitytools.utils.xposed.base.HookRegister
|
||||||
|
|
||||||
|
object DisableBluetoothTemporarilyOffForT: HookRegister() {
|
||||||
|
override fun init()= hasEnable("disable_bluetooth_temporarily_off") {
|
||||||
|
findMethod("com.android.settingslib.bluetooth.LocalBluetoothAdapter"){
|
||||||
|
name == "isSupportBluetoothRestrict" && parameterCount==1
|
||||||
|
}.hookBefore {
|
||||||
|
it.result = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -28,21 +28,31 @@ object StatusBarLayoutForT : HookRegister() {
|
|||||||
private var statusBarBottom = 0
|
private var statusBarBottom = 0
|
||||||
|
|
||||||
override fun init() {
|
override fun init() {
|
||||||
|
|
||||||
// TODO: Android13状态栏布局不可用
|
|
||||||
|
|
||||||
var mLeftLayout: LinearLayout? = null
|
var mLeftLayout: LinearLayout? = null
|
||||||
var mRightLayout: LinearLayout? = null
|
var mRightLayout: LinearLayout? = null
|
||||||
var mCenterLayout: LinearLayout?
|
var mCenterLayout: LinearLayout?
|
||||||
var statusBar: ViewGroup? = null
|
var statusBar: ViewGroup? = null
|
||||||
|
|
||||||
fun updateLayout(context: Context) {
|
//判断屏幕状态更新布局 mode: 1正常布局 2居中布局
|
||||||
//判断屏幕方向
|
fun updateLayout(context: Context,mode: Int) {
|
||||||
|
when(mode){
|
||||||
|
1->{
|
||||||
val mConfiguration: Configuration = context.resources.configuration
|
val mConfiguration: Configuration = context.resources.configuration
|
||||||
if (mConfiguration.orientation == Configuration.ORIENTATION_PORTRAIT) {
|
if (mConfiguration.orientation == Configuration.ORIENTATION_PORTRAIT) { //横屏
|
||||||
|
statusBar!!.setPadding(statusBarLeft, statusBarTop, statusBarRight, statusBarBottom)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
2->{
|
||||||
|
val mConfiguration: Configuration = context.resources.configuration
|
||||||
|
if (mConfiguration.orientation == Configuration.ORIENTATION_PORTRAIT) { //横屏
|
||||||
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(0, 0, 0, 0)
|
||||||
|
mRightLayout!!.setPadding(0, 0, 0, 0)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,9 +65,52 @@ object StatusBarLayoutForT : HookRegister() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//修改对应布局
|
||||||
when (getMode) {
|
when (getMode) {
|
||||||
//默认
|
//默认
|
||||||
0 -> return
|
0 -> {
|
||||||
|
|
||||||
|
findMethod("com.android.systemui.statusbar.phone.fragment.CollapsedStatusBarFragment") {
|
||||||
|
name == "onViewCreated" && parameterCount == 2
|
||||||
|
}.hookAfter { param ->
|
||||||
|
val miuiPhoneStatusBarView = param.thisObject.getObjectAs<ViewGroup>("mStatusBar")
|
||||||
|
val context: Context = miuiPhoneStatusBarView.context
|
||||||
|
val res: Resources = miuiPhoneStatusBarView.resources
|
||||||
|
val statusBarId: Int = res.getIdentifier("status_bar", "id", "com.android.systemui")
|
||||||
|
statusBar = miuiPhoneStatusBarView.findViewById(statusBarId)
|
||||||
|
if (statusBar == null) return@hookAfter
|
||||||
|
|
||||||
|
statusBarLeft = statusBar!!.paddingLeft
|
||||||
|
statusBarTop = statusBar!!.paddingTop
|
||||||
|
statusBarRight = statusBar!!.paddingRight
|
||||||
|
statusBarBottom = statusBar!!.paddingBottom
|
||||||
|
|
||||||
|
|
||||||
|
if (isCompatibilityMode) {
|
||||||
|
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,1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//兼容模式
|
||||||
|
findMethod("com.android.systemui.statusbar.phone.PhoneStatusBarView") {
|
||||||
|
name == "updateLayoutForCutout"
|
||||||
|
}.hookAfter {
|
||||||
|
if (isCompatibilityMode) {
|
||||||
|
val context = (it.thisObject as ViewGroup).context
|
||||||
|
updateLayout(context,1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
//时钟居中
|
//时钟居中
|
||||||
1 -> {
|
1 -> {
|
||||||
findMethod("com.android.systemui.statusbar.phone.fragment.CollapsedStatusBarFragment") {
|
findMethod("com.android.systemui.statusbar.phone.fragment.CollapsedStatusBarFragment") {
|
||||||
@@ -159,7 +212,7 @@ object StatusBarLayoutForT : HookRegister() {
|
|||||||
if (customRightMargin != 0) {
|
if (customRightMargin != 0) {
|
||||||
statusBarRight = customRightMargin
|
statusBarRight = customRightMargin
|
||||||
}
|
}
|
||||||
updateLayout(context)
|
updateLayout(context,2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -168,7 +221,7 @@ object StatusBarLayoutForT : HookRegister() {
|
|||||||
}.hookAfter {
|
}.hookAfter {
|
||||||
hasEnable("layout_compatibility_mode") {
|
hasEnable("layout_compatibility_mode") {
|
||||||
val context = (it.thisObject as ViewGroup).context
|
val context = (it.thisObject as ViewGroup).context
|
||||||
updateLayout(context)
|
updateLayout(context,2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -206,6 +259,36 @@ object StatusBarLayoutForT : HookRegister() {
|
|||||||
battery.addView(mRightLayout)
|
battery.addView(mRightLayout)
|
||||||
(clock.parent as ViewGroup).removeView(clock)
|
(clock.parent as ViewGroup).removeView(clock)
|
||||||
mRightLayout!!.addView(clock)
|
mRightLayout!!.addView(clock)
|
||||||
|
|
||||||
|
|
||||||
|
statusBarLeft = statusBar!!.paddingLeft
|
||||||
|
statusBarTop = statusBar!!.paddingTop
|
||||||
|
statusBarRight = statusBar!!.paddingRight
|
||||||
|
statusBarBottom = statusBar!!.paddingBottom
|
||||||
|
|
||||||
|
|
||||||
|
if (isCompatibilityMode) {
|
||||||
|
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,1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//兼容模式
|
||||||
|
findMethod("com.android.systemui.statusbar.phone.PhoneStatusBarView") {
|
||||||
|
name == "updateLayoutForCutout"
|
||||||
|
}.hookAfter {
|
||||||
|
if (isCompatibilityMode) {
|
||||||
|
val context = (it.thisObject as ViewGroup).context
|
||||||
|
updateLayout(context,1)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//时钟居中+图标居左
|
//时钟居中+图标居左
|
||||||
@@ -348,7 +431,7 @@ object StatusBarLayoutForT : HookRegister() {
|
|||||||
if (customRightMargin != 0) {
|
if (customRightMargin != 0) {
|
||||||
statusBarRight = customRightMargin
|
statusBarRight = customRightMargin
|
||||||
}
|
}
|
||||||
updateLayout(context)
|
updateLayout(context,2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//兼容模式
|
//兼容模式
|
||||||
@@ -357,7 +440,7 @@ object StatusBarLayoutForT : HookRegister() {
|
|||||||
}.hookAfter {
|
}.hookAfter {
|
||||||
if (isCompatibilityMode) {
|
if (isCompatibilityMode) {
|
||||||
val context = (it.thisObject as ViewGroup).context
|
val context = (it.thisObject as ViewGroup).context
|
||||||
updateLayout(context)
|
updateLayout(context,2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -247,5 +247,4 @@
|
|||||||
<string name="miuihome_shortcut_add_small_window_summary">Mantener presionando el icono del escritorio para añadir a una ventana de acceso rápido</string>
|
<string name="miuihome_shortcut_add_small_window_summary">Mantener presionando el icono del escritorio para añadir a una ventana de acceso rápido</string>
|
||||||
<string name="miuihome_shortcut_add_small_window_title">Ventana pequeña </string>
|
<string name="miuihome_shortcut_add_small_window_title">Ventana pequeña </string>
|
||||||
<string name="click_to_view_use_cases">Clic para ver casos de uso</string>
|
<string name="click_to_view_use_cases">Clic para ver casos de uso</string>
|
||||||
<string name="disable_bluetooth_temporarily_off" comment="This function is used to completely close Bluetooth">Deshabilitar Bluetooth temporalmente apagado</string>
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -247,5 +247,4 @@
|
|||||||
<string name="miuihome_shortcut_add_small_window_summary">ホーム画面のアイコンを長押しすると、素早く開けるウィンドウを追加できます</string>
|
<string name="miuihome_shortcut_add_small_window_summary">ホーム画面のアイコンを長押しすると、素早く開けるウィンドウを追加できます</string>
|
||||||
<string name="miuihome_shortcut_add_small_window_title">小さいウィンドウ</string>
|
<string name="miuihome_shortcut_add_small_window_title">小さいウィンドウ</string>
|
||||||
<string name="click_to_view_use_cases">クリックして使用例を表示</string>
|
<string name="click_to_view_use_cases">クリックして使用例を表示</string>
|
||||||
<string name="disable_bluetooth_temporarily_off" comment="This function is used to completely close Bluetooth">Bluetooth を一時的に無効にする</string>
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -1,4 +1,11 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<resources>
|
<resources>
|
||||||
|
<string name="performance">Desempenho</string>
|
||||||
|
<string name="lock_max_fps">Bloqueie o limite superior da taxa de atualização atual</string>
|
||||||
|
<string name="ui">‘Interface’</string>
|
||||||
|
<string name="delete_on_post_notification">Remover exibição sobre notificação</string>
|
||||||
|
<string name="delete_on_post_notification_summary">Remover a notificação \"este aplicativo é exibido sobre outros aplicativos\"</string>
|
||||||
|
<string name="other">Outros</string>
|
||||||
|
<string name="disable_flag_secure">Permitir captura de ecrã</string>
|
||||||
<!--Status bar icons-->
|
<!--Status bar icons-->
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -247,5 +247,4 @@
|
|||||||
<string name="miuihome_shortcut_add_small_window_summary">Nhấn và giữ biểu tượng màn hình chính để thêm cửa sổ mở nhanh</string>
|
<string name="miuihome_shortcut_add_small_window_summary">Nhấn và giữ biểu tượng màn hình chính để thêm cửa sổ mở nhanh</string>
|
||||||
<string name="miuihome_shortcut_add_small_window_title">Cửa sổ nhỏ</string>
|
<string name="miuihome_shortcut_add_small_window_title">Cửa sổ nhỏ</string>
|
||||||
<string name="click_to_view_use_cases">Nhấp để xem các trường hợp sử dụng</string>
|
<string name="click_to_view_use_cases">Nhấp để xem các trường hợp sử dụng</string>
|
||||||
<string name="disable_bluetooth_temporarily_off" comment="This function is used to completely close Bluetooth">Vô hiệu hóa bluetooth tạm thời tắt</string>
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -52,7 +52,7 @@
|
|||||||
<string name="skip_waiting_time">跳過 5/10 秒警告時間</string>
|
<string name="skip_waiting_time">跳過 5/10 秒警告時間</string>
|
||||||
<string name="unlock_unlimited_cropping">移除裁剪圖片/螢幕截圖的限制</string>
|
<string name="unlock_unlimited_cropping">移除裁剪圖片/螢幕截圖的限制</string>
|
||||||
<string name="hide_slave_wifi_icon">隱藏「WIFI 次要」圖示</string>
|
<string name="hide_slave_wifi_icon">隱藏「WIFI 次要」圖示</string>
|
||||||
<string name="HideLauncherIcon">隱藏桌面圖示</string>
|
<string name="HideLauncherIcon">隱藏「桌面」圖示</string>
|
||||||
<string name="hide_battery_percentage_icon">隱藏電量 (%)</string>
|
<string name="hide_battery_percentage_icon">隱藏電量 (%)</string>
|
||||||
<string name="hide_battery_icon">隱藏「電池」圖示</string>
|
<string name="hide_battery_icon">隱藏「電池」圖示</string>
|
||||||
<string name="status_bar_clock_format">狀態列時鐘格式</string>
|
<string name="status_bar_clock_format">狀態列時鐘格式</string>
|
||||||
@@ -247,5 +247,4 @@
|
|||||||
<string name="miuihome_shortcut_add_small_window_summary">長按桌面圖示以快速開啟小窗應用程式</string>
|
<string name="miuihome_shortcut_add_small_window_summary">長按桌面圖示以快速開啟小窗應用程式</string>
|
||||||
<string name="miuihome_shortcut_add_small_window_title">小窗應用程式</string>
|
<string name="miuihome_shortcut_add_small_window_title">小窗應用程式</string>
|
||||||
<string name="click_to_view_use_cases">按一下以檢視案例</string>
|
<string name="click_to_view_use_cases">按一下以檢視案例</string>
|
||||||
<string name="disable_bluetooth_temporarily_off" comment="This function is used to completely close Bluetooth">停用暫時關閉藍牙</string>
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
@@ -43,7 +43,7 @@
|
|||||||
<string name="github_url">Welcome more developers to participate in the development</string>
|
<string name="github_url">Welcome more developers to participate in the development</string>
|
||||||
<string name="issues">Feedback/Proposal</string>
|
<string name="issues">Feedback/Proposal</string>
|
||||||
<string name="issues_url">Click to view GitHub Issues</string>
|
<string name="issues_url">Click to view GitHub Issues</string>
|
||||||
<string name="xposeddescription">Customization tool for MIUI13(Android 12)</string>
|
<string name="xposeddescription">Customization tool for MIUI13+(Android 12+)</string>
|
||||||
<string name="statusbar">Status bar</string>
|
<string name="statusbar">Status bar</string>
|
||||||
<string name="status_bar_time_seconds">Display seconds</string>
|
<string name="status_bar_time_seconds">Display seconds</string>
|
||||||
<string name="status_bar_network_speed_refresh_speed">Network speed refresh in seconds</string>
|
<string name="status_bar_network_speed_refresh_speed">Network speed refresh in seconds</string>
|
||||||
@@ -251,4 +251,5 @@
|
|||||||
<string name="miuihome_shortcut_add_small_window_summary">Press and hold the desktop icon to add a quick open window</string>
|
<string name="miuihome_shortcut_add_small_window_summary">Press and hold the desktop icon to add a quick open window</string>
|
||||||
<string name="miuihome_shortcut_add_small_window_title">Small window</string>
|
<string name="miuihome_shortcut_add_small_window_title">Small window</string>
|
||||||
<string name="click_to_view_use_cases">Click to view use cases</string>
|
<string name="click_to_view_use_cases">Click to view use cases</string>
|
||||||
|
<string name="disable_bluetooth_temporarily_off">Disable bluetooth temporarily off</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|||||||
Reference in New Issue
Block a user