Compare commits

4 Commits

Author SHA1 Message Date
LittleTurtle2333
5e35cfb3e3 新增自定义状态栏通知最大点数 2022-03-31 17:12:53 +08:00
LittleTurtle2333
daa3c02d1a 更改cast hook逻辑 2022-03-31 17:00:57 +08:00
LittleTurtle2333
f83d439374 revert: 在SystemUI 启用 AppCenter (#119) 2022-03-31 17:00:18 +08:00
LittleTurtle2333
176682fa38 修复部分机型时间居中+图标居左横屏FC 2022-03-31 16:59:45 +08:00
7 changed files with 36 additions and 38 deletions

View File

@@ -29,6 +29,12 @@ class SettingsActivity : MIUIActivity() {
private val activity = this private val activity = this
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
if (BuildConfig.BUILD_TYPE != "debug") {
AppCenter.start(
application, "ae2037d3-9914-4e0c-b02b-f9b2bb2574e5",
Analytics::class.java, Crashes::class.java
)
}
checkLSPosed() checkLSPosed()
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
} }
@@ -925,6 +931,19 @@ class SettingsActivity : MIUIActivity() {
3 3
) )
) )
add(
TextV(
resId = R.string.maximum_number_of_notification_dots
)
)
add(
SeekBarWithTextV(
"maximum_number_of_notification_dots",
0,
4,
3
)
)
add( add(
TextSummaryArrowV( TextSummaryArrowV(
TextSummaryV( TextSummaryV(

View File

@@ -13,7 +13,6 @@ object SystemUI: AppRegister() {
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) { override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
XposedBridge.log("Simplicitytools: 成功 Hook "+javaClass.simpleName) XposedBridge.log("Simplicitytools: 成功 Hook "+javaClass.simpleName)
autoInitHooks(lpparam, autoInitHooks(lpparam,
AppCenterService, //AppCenter统计服务
HideStatusBarIcon, //隐藏状态栏图标 HideStatusBarIcon, //隐藏状态栏图标
HideBatteryIcon, //隐藏电池 HideBatteryIcon, //隐藏电池
HideHDIcon, //隐藏HD图标 HideHDIcon, //隐藏HD图标

View File

@@ -5,18 +5,16 @@ import com.github.kyuubiran.ezxhelper.utils.hookMethod
import com.lt2333.simplicitytools.util.hasEnable import com.lt2333.simplicitytools.util.hasEnable
import com.lt2333.simplicitytools.util.xposed.base.HookRegister import com.lt2333.simplicitytools.util.xposed.base.HookRegister
object ForceSupportSendApp: HookRegister() { object ForceSupportSendApp : HookRegister() {
override fun init() { override fun init() {
findMethod("com.xiaomi.mirror.synergy.MiuiSynergySdk") { hasEnable("force_support_send_app") {
name == "isSupportSendApp" findMethod("com.xiaomi.mirror.synergy.MiuiSynergySdk") {
}.hookMethod { name == "isSupportSendApp"
after { param -> }.hookMethod {
hasEnable("force_support_send_app") { after { param ->
param.result = true param.result = true
} }
} }
} }
} }
} }

View File

@@ -1,20 +0,0 @@
package com.lt2333.simplicitytools.hook.app.systemui
import android.app.Application
import android.content.Context
import com.lt2333.simplicitytools.util.hookAfterMethod
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
import com.microsoft.appcenter.AppCenter
import com.microsoft.appcenter.analytics.Analytics
object AppCenterService : HookRegister() {
override fun init() {
Application::class.java.hookAfterMethod("attach", Context::class.java) {
runCatching {
AppCenter.start(it.thisObject as Application, "ae2037d3-9914-4e0c-b02b-f9b2bb2574e5", Analytics::class.java)
}
}
}
}

View File

@@ -6,12 +6,13 @@ import com.lt2333.simplicitytools.util.xposed.base.HookRegister
object MaximumNumberOfNotificationIcons: HookRegister() { object MaximumNumberOfNotificationIcons: HookRegister() {
override fun init() { override fun init() {
val size = XSPUtils.getInt("maximum_number_of_notification_icons",3) val icons = XSPUtils.getInt("maximum_number_of_notification_icons",3)
val dots = XSPUtils.getInt("maximum_number_of_notification_dots",3)
"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", dots)
it.thisObject.setIntField("MAX_STATIC_ICONS", size) it.thisObject.setIntField("MAX_STATIC_ICONS", icons)
it.thisObject.setIntField("MAX_VISIBLE_ICONS_ON_LOCK", size) it.thisObject.setIntField("MAX_VISIBLE_ICONS_ON_LOCK", icons)
} 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)

View File

@@ -305,8 +305,8 @@ object StatusBarLayout : HookRegister() {
(statusIcons.parent as ViewGroup).removeView(statusIcons) (statusIcons.parent as ViewGroup).removeView(statusIcons)
(systemIcons.parent as ViewGroup).removeView(systemIcons) (systemIcons.parent as ViewGroup).removeView(systemIcons)
(battery.parent as ViewGroup).removeView(battery) (battery.parent as ViewGroup).removeView(battery)
(notificationIconAreaInner.parent as ViewGroup).removeView( (fullscreenNotificationIconArea.parent as ViewGroup).removeView(
notificationIconAreaInner fullscreenNotificationIconArea
) )
val mConstraintLayout = val mConstraintLayout =
@@ -317,7 +317,7 @@ object StatusBarLayout : HookRegister() {
) )
} }
mConstraintLayout.addView(notificationIconAreaInner) mConstraintLayout.addView(fullscreenNotificationIconArea)
mConstraintLayout.addView(battery) mConstraintLayout.addView(battery)
@@ -329,14 +329,14 @@ object StatusBarLayout : HookRegister() {
} }
notificationIconAreaInner.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
} }
notificationIconAreaInner.layoutDirection = View.LAYOUT_DIRECTION_RTL fullscreenNotificationIconArea.layoutDirection = View.LAYOUT_DIRECTION_RTL
//增加一个左对齐布局 //增加一个左对齐布局

View File

@@ -199,4 +199,5 @@
<string name="status_bar_layout_mode">Status bar layout mode</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="clock_center_and_icon_left">Clock Center and Icon Left</string>
<string name="maximum_number_of_notification_icons">Maximum number of notification icons</string> <string name="maximum_number_of_notification_icons">Maximum number of notification icons</string>
<string name="maximum_number_of_notification_dots">Maximum number of notification dots</string>
</resources> </resources>