mirror of
https://github.com/fankes/ColorOSNotifyIcon.git
synced 2025-09-08 11:34:26 +08:00
Compare commits
11 Commits
Author | SHA1 | Date | |
---|---|---|---|
8de1abf679
|
|||
b97de07843
|
|||
b497189549
|
|||
1ca659dd6a
|
|||
117b37b5cf
|
|||
967186bd00
|
|||
eea7b6d897
|
|||
dd75a13970
|
|||
66ed43f5ad
|
|||
399cfafd29 | |||
6ae1d3e726 |
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@@ -11,7 +11,7 @@
|
||||
<entry key="app/src/main/res/drawable/ic_notify_icon.xml" value="0.232" />
|
||||
<entry key="app/src/main/res/drawable/ic_system_clock.xml" value="0.232" />
|
||||
<entry key="app/src/main/res/layout/activity_config.xml" value="0.4375" />
|
||||
<entry key="app/src/main/res/layout/activity_main.xml" value="0.31423220973782773" />
|
||||
<entry key="app/src/main/res/layout/activity_main.xml" value="0.3060926669098869" />
|
||||
<entry key="app/src/main/res/layout/adapter_config.xml" value="0.4375" />
|
||||
<entry key="app/src/main/res/layout/dia_icon_filter.xml" value="0.4375" />
|
||||
<entry key="app/src/main/res/layout/dia_source_from.xml" value="0.4375" />
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
[](https://github.com/fankes/ColorOSNotifyIcon)
|
||||
[](https://github.com/fankes/ColorOSNotifyIcon/blob/master/LICENSE)
|
||||
[](https://github.com/fankes/ColorOSNotifyIcon/releases)
|
||||
[](https://github.com/fankes/ColorOSNotifyIcon/releases)
|
||||
[](https://github.com/fankes/ColorOSNotifyIcon/releases)
|
||||
[](https://github.com/Xposed-Modules-Repo/com.fankes.coloros.notify/releases)
|
||||
[](https://t.me/XiaofangInternet)
|
||||
|
@@ -69,8 +69,8 @@ tasks.whenTaskAdded {
|
||||
|
||||
dependencies {
|
||||
compileOnly 'de.robv.android.xposed:api:82'
|
||||
implementation 'com.highcapable.yukihookapi:api:1.0.85'
|
||||
ksp 'com.highcapable.yukihookapi:ksp-xposed:1.0.85'
|
||||
implementation 'com.highcapable.yukihookapi:api:1.0.86'
|
||||
ksp 'com.highcapable.yukihookapi:ksp-xposed:1.0.86'
|
||||
implementation "com.github.topjohnwu.libsu:core:3.1.2"
|
||||
implementation 'androidx.annotation:annotation:1.3.0'
|
||||
implementation 'com.geyifeng.immersionbar:immersionbar:3.2.0'
|
||||
@@ -78,7 +78,7 @@ dependencies {
|
||||
implementation 'com.squareup.okhttp3:okhttp:4.9.3'
|
||||
implementation 'androidx.core:core-ktx:1.7.0'
|
||||
implementation 'androidx.appcompat:appcompat:1.4.1'
|
||||
implementation 'com.google.android.material:material:1.5.0'
|
||||
implementation 'com.google.android.material:material:1.6.0'
|
||||
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
|
||||
testImplementation 'junit:junit:4.13.2'
|
||||
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
|
||||
|
@@ -41,7 +41,7 @@ object Const {
|
||||
const val MODULE_VERSION_CODE = BuildConfig.VERSION_CODE
|
||||
|
||||
/** 当前模块的版本校验 */
|
||||
const val MODULE_VERSION_VERIFY = "${MODULE_VERSION_NAME}_${MODULE_VERSION_CODE}_202205051512"
|
||||
const val MODULE_VERSION_VERIFY = "${MODULE_VERSION_NAME}_${MODULE_VERSION_CODE}_202205091602"
|
||||
|
||||
/** 当前模块的版本校验标签 */
|
||||
const val MODULE_VERSION_VERIFY_TAG = "module_version_verify"
|
||||
|
@@ -39,7 +39,8 @@ object DataConst {
|
||||
val REMOVE_DNDALERT_NOTIFY = PrefsData("_remove_dndalert_notify", false)
|
||||
val ENABLE_NOTIFY_ICON_FIX_AUTO = PrefsData("_enable_notify_icon_fix_auto", true)
|
||||
val ENABLE_NOTIFY_PANEL_ALPHA = PrefsData("_enable_notify_panel_alpha", false)
|
||||
val NOTIFY_PANEL_ALPHA = PrefsData("_notify_panel_alpha", 185)
|
||||
val ENABLE_NOTIFY_MEDIA_PANEL_AUTO_EXP = PrefsData("_enable_notify_media_panel_auto_exp", false)
|
||||
val NOTIFY_PANEL_ALPHA = PrefsData("_notify_panel_alpha_pst", 75)
|
||||
val NOTIFY_ICON_DATAS = PrefsData("_notify_icon_datas", "")
|
||||
val NOTIFY_ICON_FIX_AUTO_TIME = PrefsData("_notify_icon_fix_auto_time", "07:00")
|
||||
|
||||
|
@@ -47,7 +47,7 @@ class HookEntry : IYukiHookXposedInit {
|
||||
/** Hook 被手动关闭停止 Hook */
|
||||
prefs.get(DataConst.ENABLE_MODULE).not() -> loggerW(msg = "Aborted Hook -> Hook Closed")
|
||||
/** 开始 Hook */
|
||||
else -> loadApp(SYSTEMUI_PACKAGE_NAME, SystemUIHooker())
|
||||
else -> loadApp(SYSTEMUI_PACKAGE_NAME, SystemUIHooker)
|
||||
}
|
||||
}
|
||||
}
|
@@ -20,6 +20,8 @@
|
||||
*
|
||||
* This file is Created by fankes on 2022/3/25.
|
||||
*/
|
||||
@file:Suppress("StaticFieldLeak")
|
||||
|
||||
package com.fankes.coloros.notify.hook.entity
|
||||
|
||||
import android.app.WallpaperManager
|
||||
@@ -27,6 +29,7 @@ import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.IntentFilter
|
||||
import android.content.res.ColorStateList
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.Color
|
||||
import android.graphics.Outline
|
||||
@@ -71,111 +74,123 @@ import com.highcapable.yukihookapi.hook.type.java.LongType
|
||||
/**
|
||||
* 系统界面核心 Hook 类
|
||||
*/
|
||||
class SystemUIHooker : YukiBaseHooker() {
|
||||
object SystemUIHooker : YukiBaseHooker() {
|
||||
|
||||
companion object {
|
||||
/** 原生存在的类 */
|
||||
private const val ContrastColorUtilClass = "com.android.internal.util.ContrastColorUtil"
|
||||
|
||||
/** 原生存在的类 */
|
||||
private const val ContrastColorUtilClass = "com.android.internal.util.ContrastColorUtil"
|
||||
/** 原生存在的类 */
|
||||
private const val NotificationUtilsClass = "$SYSTEMUI_PACKAGE_NAME.statusbar.notification.NotificationUtils"
|
||||
|
||||
/** 原生存在的类 */
|
||||
private const val NotificationUtilsClass = "$SYSTEMUI_PACKAGE_NAME.statusbar.notification.NotificationUtils"
|
||||
/** 原生存在的类 */
|
||||
private const val NotificationEntryClass = "$SYSTEMUI_PACKAGE_NAME.statusbar.notification.collection.NotificationEntry"
|
||||
|
||||
/** 原生存在的类 */
|
||||
private const val NotificationEntryClass = "$SYSTEMUI_PACKAGE_NAME.statusbar.notification.collection.NotificationEntry"
|
||||
/** 原生存在的类 */
|
||||
private const val StatusBarIconClass = "com.android.internal.statusbar.StatusBarIcon"
|
||||
|
||||
/** 原生存在的类 */
|
||||
private const val StatusBarIconClass = "com.android.internal.statusbar.StatusBarIcon"
|
||||
/** 原生存在的类 */
|
||||
private const val StatusBarIconViewClass = "$SYSTEMUI_PACKAGE_NAME.statusbar.StatusBarIconView"
|
||||
|
||||
/** 原生存在的类 */
|
||||
private const val StatusBarIconViewClass = "$SYSTEMUI_PACKAGE_NAME.statusbar.StatusBarIconView"
|
||||
/** 原生存在的类 */
|
||||
private const val IconBuilderClass = "$SYSTEMUI_PACKAGE_NAME.statusbar.notification.icon.IconBuilder"
|
||||
|
||||
/** 原生存在的类 */
|
||||
private const val IconBuilderClass = "$SYSTEMUI_PACKAGE_NAME.statusbar.notification.icon.IconBuilder"
|
||||
/** 原生存在的类 */
|
||||
private const val IconManagerClass = "$SYSTEMUI_PACKAGE_NAME.statusbar.notification.icon.IconManager"
|
||||
|
||||
/** 原生存在的类 */
|
||||
private const val IconManagerClass = "$SYSTEMUI_PACKAGE_NAME.statusbar.notification.icon.IconManager"
|
||||
/** 原生存在的类 */
|
||||
private const val PluginManagerImplClass = "$SYSTEMUI_PACKAGE_NAME.shared.plugins.PluginManagerImpl"
|
||||
|
||||
/** ColorOS 存在的类 - 旧版本不存在 */
|
||||
private const val OplusContrastColorUtilClass = "com.oplusos.util.OplusContrastColorUtil"
|
||||
/** 原生存在的类 */
|
||||
private const val NotificationBackgroundViewClass = "$SYSTEMUI_PACKAGE_NAME.statusbar.notification.row.NotificationBackgroundView"
|
||||
|
||||
/** 原生存在的类 */
|
||||
private const val PluginManagerImplClass = "$SYSTEMUI_PACKAGE_NAME.shared.plugins.PluginManagerImpl"
|
||||
/** 原生存在的类 */
|
||||
private const val PlayerViewHolderClass = "$SYSTEMUI_PACKAGE_NAME.media.PlayerViewHolder"
|
||||
|
||||
/** 原生存在的类 */
|
||||
private const val NotificationBackgroundViewClass = "$SYSTEMUI_PACKAGE_NAME.statusbar.notification.row.NotificationBackgroundView"
|
||||
/** 原生存在的类 */
|
||||
private const val MediaDataClass = "$SYSTEMUI_PACKAGE_NAME.media.MediaData"
|
||||
|
||||
/** ColorOS 存在的类 - 旧版本不存在 */
|
||||
private const val OplusNotificationBackgroundViewClass =
|
||||
"com.oplusos.systemui.statusbar.notification.row.OplusNotificationBackgroundView"
|
||||
/** ColorOS 存在的类 - 旧版本不存在 */
|
||||
private const val OplusContrastColorUtilClass = "com.oplusos.util.OplusContrastColorUtil"
|
||||
|
||||
/** 根据多个版本存在不同的包名相同的类 */
|
||||
private val OplusNotificationIconAreaControllerClass = VariousClass(
|
||||
"com.oplusos.systemui.statusbar.phone.OplusNotificationIconAreaController",
|
||||
"com.oplusos.systemui.statusbar.policy.OplusNotificationIconAreaController",
|
||||
"com.coloros.systemui.statusbar.policy.ColorNotificationIconAreaController"
|
||||
)
|
||||
/** ColorOS 存在的类 - 旧版本不存在 */
|
||||
private const val OplusNotificationBackgroundViewClass =
|
||||
"com.oplusos.systemui.statusbar.notification.row.OplusNotificationBackgroundView"
|
||||
|
||||
/** 根据多个版本存在不同的包名相同的类 */
|
||||
private val SystemPromptControllerClass = VariousClass(
|
||||
"com.oplusos.systemui.statusbar.policy.SystemPromptController",
|
||||
"com.coloros.systemui.statusbar.policy.ColorSystemPromptController"
|
||||
)
|
||||
/** ColorOS 存在的类 - 旧版本不存在 */
|
||||
private const val OplusMediaControlPanelClass = "com.oplusos.systemui.media.OplusMediaControlPanel"
|
||||
|
||||
/** 根据多个版本存在不同的包名相同的类 */
|
||||
private val RoundRectDrawableUtilClass = VariousClass(
|
||||
"com.oplusos.systemui.notification.util.RoundRectDrawableUtil",
|
||||
"com.coloros.systemui.notification.util.RoundRectDrawableUtil"
|
||||
)
|
||||
/** ColorOS 存在的类 - 旧版本不存在 */
|
||||
private const val OplusMediaViewControllerClass = "com.oplusos.systemui.media.OplusMediaViewController"
|
||||
|
||||
/** 根据多个版本存在不同的包名相同的类 */
|
||||
private val RoundRectDrawableUtil_CompanionClass = VariousClass(
|
||||
"com.oplusos.systemui.notification.util.RoundRectDrawableUtil\$Companion",
|
||||
"com.oplusos.systemui.notification.util.RoundRectDrawableUtil\$Companion"
|
||||
)
|
||||
/** ColorOS 存在的类 - 旧版本不存在 */
|
||||
private const val BasePlayViewHolderClass = "com.oplusos.systemui.media.base.BasePlayViewHolder"
|
||||
|
||||
/** 根据多个版本存在不同的包名相同的类 */
|
||||
private val DndAlertHelperClass = VariousClass(
|
||||
"com.oplusos.systemui.notification.helper.DndAlertHelper",
|
||||
"com.coloros.systemui.notification.helper.DndAlertHelper"
|
||||
)
|
||||
/** 根据多个版本存在不同的包名相同的类 */
|
||||
private val OplusNotificationIconAreaControllerClass = VariousClass(
|
||||
"com.oplusos.systemui.statusbar.phone.OplusNotificationIconAreaController",
|
||||
"com.oplusos.systemui.statusbar.policy.OplusNotificationIconAreaController",
|
||||
"com.coloros.systemui.statusbar.policy.ColorNotificationIconAreaController"
|
||||
)
|
||||
|
||||
/** 根据多个版本存在不同的包名相同的类 */
|
||||
private val OplusPowerNotificationWarningsClass = VariousClass(
|
||||
"com.oplusos.systemui.notification.power.OplusPowerNotificationWarnings",
|
||||
"com.coloros.systemui.notification.power.ColorosPowerNotificationWarnings"
|
||||
)
|
||||
/** 根据多个版本存在不同的包名相同的类 */
|
||||
private val SystemPromptControllerClass = VariousClass(
|
||||
"com.oplusos.systemui.statusbar.policy.SystemPromptController",
|
||||
"com.coloros.systemui.statusbar.policy.ColorSystemPromptController"
|
||||
)
|
||||
|
||||
/** 根据多个版本存在不同的包名相同的类 */
|
||||
private val AbstractReceiverClass = VariousClass(
|
||||
"com.oplusos.systemui.common.receiver.AbstractReceiver",
|
||||
"com.coloros.systemui.common.receiver.AbstractReceiver"
|
||||
)
|
||||
/** 根据多个版本存在不同的包名相同的类 */
|
||||
private val RoundRectDrawableUtilClass = VariousClass(
|
||||
"com.oplusos.systemui.notification.util.RoundRectDrawableUtil",
|
||||
"com.coloros.systemui.notification.util.RoundRectDrawableUtil"
|
||||
)
|
||||
|
||||
/** 根据多个版本存在不同的包名相同的类 */
|
||||
private val StatusBarNotificationPresenterClass = VariousClass(
|
||||
"$SYSTEMUI_PACKAGE_NAME.statusbar.phone.StatusBarNotificationPresenter",
|
||||
"$SYSTEMUI_PACKAGE_NAME.statusbar.phone.StatusBar"
|
||||
)
|
||||
/** 根据多个版本存在不同的包名相同的类 */
|
||||
private val RoundRectDrawableUtil_CompanionClass = VariousClass(
|
||||
"com.oplusos.systemui.notification.util.RoundRectDrawableUtil\$Companion",
|
||||
"com.oplusos.systemui.notification.util.RoundRectDrawableUtil\$Companion"
|
||||
)
|
||||
|
||||
/** 根据多个版本存在不同的包名相同的类 */
|
||||
private val ExpandableNotificationRowClass = VariousClass(
|
||||
"$SYSTEMUI_PACKAGE_NAME.statusbar.notification.row.ExpandableNotificationRow",
|
||||
"$SYSTEMUI_PACKAGE_NAME.statusbar.ExpandableNotificationRow"
|
||||
)
|
||||
/** 根据多个版本存在不同的包名相同的类 */
|
||||
private val DndAlertHelperClass = VariousClass(
|
||||
"com.oplusos.systemui.notification.helper.DndAlertHelper",
|
||||
"com.coloros.systemui.notification.helper.DndAlertHelper"
|
||||
)
|
||||
|
||||
/** 根据多个版本存在不同的包名相同的类 */
|
||||
private val NotificationViewWrapperClass = VariousClass(
|
||||
"$SYSTEMUI_PACKAGE_NAME.statusbar.notification.row.wrapper.NotificationViewWrapper",
|
||||
"$SYSTEMUI_PACKAGE_NAME.statusbar.notification.NotificationViewWrapper"
|
||||
)
|
||||
/** 根据多个版本存在不同的包名相同的类 */
|
||||
private val OplusPowerNotificationWarningsClass = VariousClass(
|
||||
"com.oplusos.systemui.notification.power.OplusPowerNotificationWarnings",
|
||||
"com.coloros.systemui.notification.power.ColorosPowerNotificationWarnings"
|
||||
)
|
||||
|
||||
/** 根据多个版本存在不同的包名相同的类 */
|
||||
private val NotificationHeaderViewWrapperClass = VariousClass(
|
||||
"$SYSTEMUI_PACKAGE_NAME.statusbar.notification.row.wrapper.NotificationHeaderViewWrapper",
|
||||
"$SYSTEMUI_PACKAGE_NAME.statusbar.notification.NotificationHeaderViewWrapper"
|
||||
)
|
||||
}
|
||||
/** 根据多个版本存在不同的包名相同的类 */
|
||||
private val AbstractReceiverClass = VariousClass(
|
||||
"com.oplusos.systemui.common.receiver.AbstractReceiver",
|
||||
"com.coloros.systemui.common.receiver.AbstractReceiver"
|
||||
)
|
||||
|
||||
/** 根据多个版本存在不同的包名相同的类 */
|
||||
private val StatusBarNotificationPresenterClass = VariousClass(
|
||||
"$SYSTEMUI_PACKAGE_NAME.statusbar.phone.StatusBarNotificationPresenter",
|
||||
"$SYSTEMUI_PACKAGE_NAME.statusbar.phone.StatusBar"
|
||||
)
|
||||
|
||||
/** 根据多个版本存在不同的包名相同的类 */
|
||||
private val ExpandableNotificationRowClass = VariousClass(
|
||||
"$SYSTEMUI_PACKAGE_NAME.statusbar.notification.row.ExpandableNotificationRow",
|
||||
"$SYSTEMUI_PACKAGE_NAME.statusbar.ExpandableNotificationRow"
|
||||
)
|
||||
|
||||
/** 根据多个版本存在不同的包名相同的类 */
|
||||
private val NotificationViewWrapperClass = VariousClass(
|
||||
"$SYSTEMUI_PACKAGE_NAME.statusbar.notification.row.wrapper.NotificationViewWrapper",
|
||||
"$SYSTEMUI_PACKAGE_NAME.statusbar.notification.NotificationViewWrapper"
|
||||
)
|
||||
|
||||
/** 根据多个版本存在不同的包名相同的类 */
|
||||
private val NotificationHeaderViewWrapperClass = VariousClass(
|
||||
"$SYSTEMUI_PACKAGE_NAME.statusbar.notification.row.wrapper.NotificationHeaderViewWrapper",
|
||||
"$SYSTEMUI_PACKAGE_NAME.statusbar.notification.NotificationHeaderViewWrapper"
|
||||
)
|
||||
|
||||
/** 缓存的彩色 APP 图标 */
|
||||
private var appIcons = ArrayMap<String, Drawable>()
|
||||
@@ -189,6 +204,9 @@ class SystemUIHooker : YukiBaseHooker() {
|
||||
/** 状态栏通知图标数组 */
|
||||
private var notificationIconInstances = ArrayList<View>()
|
||||
|
||||
/** 媒体通知 [View] */
|
||||
private var notificationPlayerView: View? = null
|
||||
|
||||
/** 通知栏通知控制器 */
|
||||
private var notificationPresenter: Any? = null
|
||||
|
||||
@@ -366,6 +384,7 @@ class SystemUIHooker : YukiBaseHooker() {
|
||||
emptyParam()
|
||||
}.call()
|
||||
}
|
||||
modifyNotifyPanelAlpha(notificationPlayerView, isTint = true)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -536,14 +555,25 @@ class SystemUIHooker : YukiBaseHooker() {
|
||||
* 设置通知面板背景透明度
|
||||
* @param view 背景 View 实例
|
||||
* @param drawable 背景实例
|
||||
* @param isTint 是否着色 [view]
|
||||
*/
|
||||
private fun modifyNotifyPanelAlpha(view: View?, drawable: Drawable?) {
|
||||
private fun modifyNotifyPanelAlpha(view: View?, drawable: Drawable? = null, isTint: Boolean = false) {
|
||||
prefs.get(DataConst.ENABLE_NOTIFY_PANEL_ALPHA).also { isEnabled ->
|
||||
val currentAlpha = prefs.get(DataConst.NOTIFY_PANEL_ALPHA)
|
||||
val currendColor = if (view?.context?.isSystemInDarkMode == true) 0xFF404040.toInt() else 0xFFFAFAFA.toInt()
|
||||
/** 设置通知面板背景透明度 */
|
||||
when {
|
||||
isEnabled.not() -> drawable?.alpha = 255
|
||||
view?.parent?.parent?.javaClass?.name?.contains(other = "ChildrenContainer") == true -> drawable?.alpha = 0
|
||||
else -> drawable?.alpha = prefs.get(DataConst.NOTIFY_PANEL_ALPHA)
|
||||
isEnabled.not() -> {
|
||||
if (isTint) view?.backgroundTintList = ColorStateList.valueOf(currendColor)
|
||||
else drawable?.setTint(currendColor)
|
||||
}
|
||||
isTint.not() && view?.parent?.parent?.javaClass?.name?.contains(other = "ChildrenContainer") == true -> drawable?.alpha = 0
|
||||
else -> {
|
||||
currendColor.colorAlphaOf(currentAlpha / 100f).also {
|
||||
if (isTint) view?.backgroundTintList = ColorStateList.valueOf(it)
|
||||
else drawable?.setTint(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
/** 移除阴影效果 */
|
||||
if (isEnabled) view?.elevation = 0f
|
||||
@@ -711,6 +741,11 @@ class SystemUIHooker : YukiBaseHooker() {
|
||||
method {
|
||||
name = "drawRegionBlur"
|
||||
paramCount = 2
|
||||
}.remedys {
|
||||
method {
|
||||
name = "draw"
|
||||
paramCount = 2
|
||||
}
|
||||
}
|
||||
beforeHook { modifyNotifyPanelAlpha(instance(), args().last().cast<Drawable>()) }
|
||||
}
|
||||
@@ -753,6 +788,47 @@ class SystemUIHooker : YukiBaseHooker() {
|
||||
}
|
||||
}
|
||||
}
|
||||
/** 替换媒体通知面板背景 - 设置媒体通知自动展开 */
|
||||
OplusMediaControlPanelClass.hook {
|
||||
injectMember {
|
||||
method {
|
||||
name = "bind"
|
||||
paramCount = 2
|
||||
}
|
||||
afterHook {
|
||||
/** 得到当前实例 */
|
||||
val holder = field {
|
||||
name = "mViewHolder"
|
||||
superClass(isOnlySuperClass = true)
|
||||
}.get(instance).any()
|
||||
/** 记录媒体通知 [View] */
|
||||
notificationPlayerView = PlayerViewHolderClass.clazz.method {
|
||||
name = "getPlayer"
|
||||
emptyParam()
|
||||
}.get(holder).invoke()
|
||||
/** 设置背景着色 */
|
||||
modifyNotifyPanelAlpha(notificationPlayerView, isTint = true)
|
||||
/** 当前是否正在播放 */
|
||||
val isPlaying = MediaDataClass.clazz.method {
|
||||
name = "isPlaying"
|
||||
emptyParam()
|
||||
}.get(args().first().any()).boolean()
|
||||
|
||||
/** 当前通知是否展开 */
|
||||
val isExpanded = OplusMediaViewControllerClass.clazz.method {
|
||||
name = "getExpanded"
|
||||
emptyParam()
|
||||
}.get(field { name = "mOplusMediaViewController" }.get(instance).self).boolean()
|
||||
/** 符合条件后执行 */
|
||||
if (prefs.get(DataConst.ENABLE_NOTIFY_MEDIA_PANEL_AUTO_EXP).not() || isExpanded || isPlaying.not()) return@afterHook
|
||||
/** 模拟手动展开通知 */
|
||||
BasePlayViewHolderClass.clazz.method {
|
||||
name = "getExpandButton"
|
||||
emptyParam()
|
||||
}.get(holder).invoke<View>()?.performClick()
|
||||
}
|
||||
}
|
||||
}.ignoredHookClassNotFoundFailure()
|
||||
/** 替换通知图标和样式 */
|
||||
NotificationHeaderViewWrapperClass.hook {
|
||||
injectMember {
|
||||
|
@@ -127,10 +127,12 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
||||
binding.notifyIconAutoSyncChildItem.isVisible = modulePrefs.get(DataConst.ENABLE_NOTIFY_ICON_FIX_AUTO)
|
||||
binding.notifyPanelConfigSeekbar.isVisible = modulePrefs.get(DataConst.ENABLE_NOTIFY_PANEL_ALPHA)
|
||||
binding.notifyPanelConfigTextPanel.isVisible = modulePrefs.get(DataConst.ENABLE_NOTIFY_PANEL_ALPHA)
|
||||
binding.notifyPanelConfigWarnPanel.isVisible = modulePrefs.get(DataConst.ENABLE_NOTIFY_PANEL_ALPHA)
|
||||
binding.devNotifyConfigSwitch.isChecked = modulePrefs.get(DataConst.REMOVE_DEV_NOTIFY)
|
||||
binding.crcpNotifyConfigSwitch.isChecked = modulePrefs.get(DataConst.REMOVE_CHANGECP_NOTIFY)
|
||||
binding.dndNotifyConfigSwitch.isChecked = modulePrefs.get(DataConst.REMOVE_DNDALERT_NOTIFY)
|
||||
binding.a12StyleConfigSwitch.isChecked = modulePrefs.get(DataConst.ENABLE_ANDROID12_STYLE)
|
||||
binding.notifyMediaPanelAutoExpSwitch.isChecked = modulePrefs.get(DataConst.ENABLE_NOTIFY_MEDIA_PANEL_AUTO_EXP)
|
||||
binding.moduleEnableSwitch.isChecked = modulePrefs.get(DataConst.ENABLE_MODULE)
|
||||
binding.moduleEnableLogSwitch.isChecked = modulePrefs.get(DataConst.ENABLE_MODULE_LOG)
|
||||
binding.hideIconInLauncherSwitch.isChecked = modulePrefs.get(DataConst.ENABLE_HIDE_ICON)
|
||||
@@ -139,8 +141,13 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
||||
binding.notifyIconAutoSyncSwitch.isChecked = modulePrefs.get(DataConst.ENABLE_NOTIFY_ICON_FIX_AUTO)
|
||||
binding.notifyPanelConfigSwitch.isChecked = modulePrefs.get(DataConst.ENABLE_NOTIFY_PANEL_ALPHA)
|
||||
binding.notifyPanelConfigSeekbar.progress = modulePrefs.get(DataConst.NOTIFY_PANEL_ALPHA)
|
||||
binding.notifyPanelConfigText.text = modulePrefs.get(DataConst.NOTIFY_PANEL_ALPHA).toString()
|
||||
binding.notifyPanelConfigText.text = "${modulePrefs.get(DataConst.NOTIFY_PANEL_ALPHA)}%"
|
||||
binding.notifyIconAutoSyncText.text = notifyIconAutoSyncTime
|
||||
/** 媒体通知自动展开仅支持 12.1 - 旧版本适配过于复杂已放弃 */
|
||||
if (colorOSNumberVersion != "V12.1") {
|
||||
binding.notifyMediaPanelAutoExpSwitch.isVisible = false
|
||||
binding.notifyMediaPanelAutoExpText.isVisible = false
|
||||
}
|
||||
binding.moduleEnableSwitch.setOnCheckedChangeListener { btn, b ->
|
||||
if (btn.isPressed.not()) return@setOnCheckedChangeListener
|
||||
modulePrefs.put(DataConst.ENABLE_MODULE, b)
|
||||
@@ -197,10 +204,16 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
||||
modulePrefs.put(DataConst.ENABLE_ANDROID12_STYLE, b)
|
||||
SystemUITool.refreshSystemUI(context = this)
|
||||
}
|
||||
binding.notifyMediaPanelAutoExpSwitch.setOnCheckedChangeListener { btn, b ->
|
||||
if (btn.isPressed.not()) return@setOnCheckedChangeListener
|
||||
modulePrefs.put(DataConst.ENABLE_NOTIFY_MEDIA_PANEL_AUTO_EXP, b)
|
||||
SystemUITool.refreshSystemUI(context = this, isRefreshCacheOnly = true)
|
||||
}
|
||||
binding.notifyPanelConfigSwitch.setOnCheckedChangeListener { btn, b ->
|
||||
if (btn.isPressed.not()) return@setOnCheckedChangeListener
|
||||
modulePrefs.put(DataConst.ENABLE_NOTIFY_PANEL_ALPHA, b)
|
||||
binding.notifyPanelConfigTextPanel.isVisible = b
|
||||
binding.notifyPanelConfigWarnPanel.isVisible = b
|
||||
binding.notifyPanelConfigSeekbar.isVisible = b
|
||||
SystemUITool.refreshSystemUI(context = this)
|
||||
}
|
||||
@@ -212,7 +225,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
||||
}
|
||||
binding.notifyPanelConfigSeekbar.setOnSeekBarChangeListener(object : OnSeekBarChangeListener {
|
||||
override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) {
|
||||
binding.notifyPanelConfigText.text = progress.toString()
|
||||
binding.notifyPanelConfigText.text = "$progress%"
|
||||
}
|
||||
|
||||
override fun onStopTrackingTouch(seekBar: SeekBar) {
|
||||
|
@@ -43,13 +43,13 @@ class NotifyIconRuleUpdateActivity : Activity() {
|
||||
View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
||||
window?.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS)
|
||||
window?.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION)
|
||||
/** 注册 */
|
||||
SystemUITool.register(context = this)
|
||||
/** 检测运行状态 */
|
||||
if (BaseActivity.isMainThreadRunning) {
|
||||
finish()
|
||||
return
|
||||
}
|
||||
/** 注册 */
|
||||
SystemUITool.register(context = this)
|
||||
/** 拉取云端数据 */
|
||||
IconRuleManagerTool.sync(appContext) {
|
||||
/** 刷新系统界面 */
|
||||
|
@@ -138,14 +138,20 @@ val colorOSFullVersion get() = "${if (isRealmeUI) "RealmeUI " else ""}$colorOSVe
|
||||
* 获取 ColorOS 版本
|
||||
* @return [String]
|
||||
*/
|
||||
val colorOSVersion
|
||||
val colorOSVersion get() = "$colorOSNumberVersion ${Build.DISPLAY}"
|
||||
|
||||
/**
|
||||
* 获取 ColorOS 数字版本
|
||||
* @return [String]
|
||||
*/
|
||||
val colorOSNumberVersion
|
||||
get() = safeOf(default = "无法获取") {
|
||||
(classOf(name = "com.oplus.os.OplusBuild").let {
|
||||
it.field { name = "VERSIONS" }.ignoredError().get().array<String>().takeIf { e -> e.isNotEmpty() }
|
||||
?.get(it.method { name = "getOplusOSVERSION" }.ignoredError().get().int() - 1)
|
||||
} ?: findPropString(
|
||||
key = "ro.system.build.fingerprint", default = "无法获取"
|
||||
).split("ssi:")[1].split("/")[0].trim()) + " ${Build.DISPLAY}"
|
||||
).split("ssi:")[1].split("/")[0].trim())
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -280,6 +286,13 @@ val Int.isWhite
|
||||
(0.2126 * r + 0.7152 * g + 0.0722 * b) >= 128
|
||||
}
|
||||
|
||||
/**
|
||||
* 调整颜色透明度
|
||||
* @param value 透明度
|
||||
* @return [Int] 调整后的颜色
|
||||
*/
|
||||
fun Int.colorAlphaOf(value: Float) = safeOfNan { (255.coerceAtMost(0.coerceAtLeast((value * 255).toInt())) shl 24) + (0x00ffffff and this) }
|
||||
|
||||
/**
|
||||
* Base64 加密
|
||||
* @return [String]
|
||||
|
@@ -47,7 +47,7 @@ object SystemUITool {
|
||||
* 注册广播
|
||||
* @param context 实例
|
||||
*/
|
||||
fun register(context: Context) {
|
||||
fun register(context: Context) = runInSafe {
|
||||
/** 注册广播检查模块激活状态 */
|
||||
context.registerReceiver(moduleHandlerReceiver, IntentFilter().apply { addAction(Const.ACTION_MODULE_HANDLER_RECEIVER) })
|
||||
/** 注册广播通知系统界面改变 */
|
||||
@@ -58,7 +58,7 @@ object SystemUITool {
|
||||
* 取消注册广播
|
||||
* @param context 实例
|
||||
*/
|
||||
fun unregister(context: Context) {
|
||||
fun unregister(context: Context) = runInSafe {
|
||||
context.unregisterReceiver(moduleHandlerReceiver)
|
||||
context.unregisterReceiver(remindHandlerReceiver)
|
||||
}
|
||||
|
@@ -421,6 +421,31 @@
|
||||
android:textColor="@color/colorTextDark"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<com.fankes.coloros.notify.ui.view.MaterialSwitch
|
||||
android:id="@+id/notify_media_panel_auto_exp_switch"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="40dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:paddingLeft="15dp"
|
||||
android:paddingRight="15dp"
|
||||
android:text="启用媒体通知播放时自动展开"
|
||||
android:textAllCaps="false"
|
||||
android:textColor="@color/colorTextGray"
|
||||
android:textSize="15sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/notify_media_panel_auto_exp_text"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:alpha="0.6"
|
||||
android:lineSpacingExtra="6dp"
|
||||
android:paddingLeft="15dp"
|
||||
android:paddingRight="15dp"
|
||||
android:text="ColorOS 的媒体通知在播放的时候默认是折叠状态,开启后只要推送媒体通知以及恢复播放状态都会自动展开通知。"
|
||||
android:textColor="@color/colorTextDark"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<com.fankes.coloros.notify.ui.view.MaterialSwitch
|
||||
android:id="@+id/notify_panel_config_switch"
|
||||
android:layout_width="match_parent"
|
||||
@@ -440,8 +465,9 @@
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginRight="5dp"
|
||||
android:max="255"
|
||||
android:min="0" />
|
||||
android:max="100"
|
||||
android:min="0"
|
||||
android:progress="75" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/notify_panel_config_text_panel"
|
||||
@@ -461,7 +487,7 @@
|
||||
android:gravity="center"
|
||||
android:maxWidth="100dp"
|
||||
android:singleLine="true"
|
||||
android:text="当前值"
|
||||
android:text="当前"
|
||||
android:textColor="@color/colorTextGray"
|
||||
android:textSize="13.5sp" />
|
||||
|
||||
@@ -473,7 +499,7 @@
|
||||
android:gravity="center"
|
||||
android:maxWidth="100dp"
|
||||
android:singleLine="true"
|
||||
android:text="%1"
|
||||
android:text="75%"
|
||||
android:textColor="@color/colorTextGray"
|
||||
android:textSize="15sp"
|
||||
android:textStyle="bold" />
|
||||
@@ -487,21 +513,42 @@
|
||||
android:lineSpacingExtra="6dp"
|
||||
android:paddingLeft="15dp"
|
||||
android:paddingRight="15dp"
|
||||
android:text="开启自定义功能后,你可以拖拽滑动条来调整通知面板的透明度,0 为全透明,255 为不透明。"
|
||||
android:text="开启自定义功能后,你可以拖拽滑动条来调整通知面板的透明度,0% 为全透明,100% 为不透明。"
|
||||
android:textColor="@color/colorTextDark"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<TextView
|
||||
<LinearLayout
|
||||
android:id="@+id/notify_panel_config_warn_panel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:alpha="0.6"
|
||||
android:lineSpacingExtra="6dp"
|
||||
android:paddingLeft="15dp"
|
||||
android:paddingRight="15dp"
|
||||
android:text="此功能为实验性功能,后期不一定继续维护,且仅在 ColorOS 12~12.1 测试正常,不能保证可以和各种通知栏主题模块配合使用,如有冲突请关闭此功能或禁用相关重复功能的主题模块。"
|
||||
android:textColor="@color/colorTextDark"
|
||||
android:textSize="12sp" />
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:alpha="0.6"
|
||||
android:lineSpacingExtra="6dp"
|
||||
android:paddingLeft="15dp"
|
||||
android:paddingRight="15dp"
|
||||
android:text="此功能为实验性功能,后期不一定继续维护,且仅在 ColorOS 12.1 测试通过,不能保证可以在任何系统版本中生效,以及和各种通知栏主题模块配合使用,如有冲突请关闭此功能或禁用相关重复功能的主题模块。"
|
||||
android:textColor="@color/colorTextDark"
|
||||
android:textSize="12sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:alpha="0.6"
|
||||
android:lineSpacingExtra="6dp"
|
||||
android:paddingLeft="15dp"
|
||||
android:paddingRight="15dp"
|
||||
android:text="已知问题:\n(1) 悬浮通知也会被透明,在透明度较低的时候下拉会有阴影光晕,松手释放后恢复正常,后期看需求再解决。\n(2) 媒体通知可能在低于 ColorOS 12.1 的系统上无法生效透明度,旧版本不再适配,该问题不会被修复。"
|
||||
android:textColor="@color/colorTextDark"
|
||||
android:textSize="12sp"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
|
@@ -5,8 +5,8 @@ plugins {
|
||||
}
|
||||
|
||||
ext {
|
||||
appVersionName = "1.75"
|
||||
appVersionCode = 13
|
||||
appVersionName = "1.77"
|
||||
appVersionCode = 15
|
||||
enableR8 = true
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user