mirror of
https://github.com/fankes/ColorOSNotifyIcon.git
synced 2025-09-07 19:14:20 +08:00
Compare commits
9 Commits
Author | SHA1 | Date | |
---|---|---|---|
384e6b657e | |||
08b7feeede | |||
e7fc0bbcd0 | |||
1f8022fd7c | |||
|
b404543f47 | ||
|
ad195d93ea | ||
15e7490808 | |||
7c906cd2a0 | |||
0da5875d64 |
@@ -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.81'
|
||||
ksp 'com.highcapable.yukihookapi:ksp-xposed:1.0.81'
|
||||
implementation 'com.highcapable.yukihookapi:api:1.0.85'
|
||||
ksp 'com.highcapable.yukihookapi:ksp-xposed:1.0.85'
|
||||
implementation "com.github.topjohnwu.libsu:core:3.1.2"
|
||||
implementation 'androidx.annotation:annotation:1.3.0'
|
||||
implementation 'com.geyifeng.immersionbar:immersionbar:3.2.0'
|
||||
|
@@ -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}_202205040646"
|
||||
const val MODULE_VERSION_VERIFY = "${MODULE_VERSION_NAME}_${MODULE_VERSION_CODE}_202205051512"
|
||||
|
||||
/** 当前模块的版本校验标签 */
|
||||
const val MODULE_VERSION_VERIFY_TAG = "module_version_verify"
|
||||
|
@@ -38,7 +38,7 @@ object DataConst {
|
||||
val REMOVE_CHANGECP_NOTIFY = PrefsData("_remove_charge_complete_notify", false)
|
||||
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", true)
|
||||
val ENABLE_NOTIFY_PANEL_ALPHA = PrefsData("_enable_notify_panel_alpha", false)
|
||||
val NOTIFY_PANEL_ALPHA = PrefsData("_notify_panel_alpha", 185)
|
||||
val NOTIFY_ICON_DATAS = PrefsData("_notify_icon_datas", "")
|
||||
val NOTIFY_ICON_FIX_AUTO_TIME = PrefsData("_notify_icon_fix_auto_time", "07:00")
|
||||
|
@@ -534,12 +534,20 @@ class SystemUIHooker : YukiBaseHooker() {
|
||||
|
||||
/**
|
||||
* 设置通知面板背景透明度
|
||||
* @param view 背景 View 实例
|
||||
* @param drawable 背景实例
|
||||
*/
|
||||
private fun modifyNotifyPanelAlpha(drawable: Drawable?) {
|
||||
if (prefs.get(DataConst.ENABLE_NOTIFY_PANEL_ALPHA))
|
||||
drawable?.alpha = prefs.get(DataConst.NOTIFY_PANEL_ALPHA)
|
||||
else drawable?.alpha = 255
|
||||
private fun modifyNotifyPanelAlpha(view: View?, drawable: Drawable?) {
|
||||
prefs.get(DataConst.ENABLE_NOTIFY_PANEL_ALPHA).also { isEnabled ->
|
||||
/** 设置通知面板背景透明度 */
|
||||
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)
|
||||
}
|
||||
/** 移除阴影效果 */
|
||||
if (isEnabled) view?.elevation = 0f
|
||||
}
|
||||
}
|
||||
|
||||
/** 缓存图标数据 */
|
||||
@@ -704,7 +712,7 @@ class SystemUIHooker : YukiBaseHooker() {
|
||||
name = "drawRegionBlur"
|
||||
paramCount = 2
|
||||
}
|
||||
beforeHook { modifyNotifyPanelAlpha(args().last().cast<Drawable>()) }
|
||||
beforeHook { modifyNotifyPanelAlpha(instance(), args().last().cast<Drawable>()) }
|
||||
}
|
||||
injectMember {
|
||||
method {
|
||||
@@ -712,7 +720,7 @@ class SystemUIHooker : YukiBaseHooker() {
|
||||
paramCount = 2
|
||||
superClass(isOnlySuperClass = true)
|
||||
}
|
||||
beforeHook { modifyNotifyPanelAlpha(args().last().cast<Drawable>()) }
|
||||
beforeHook { modifyNotifyPanelAlpha(instance(), args().last().cast<Drawable>()) }
|
||||
}
|
||||
}.by { isOldNotificationBackground.not() }
|
||||
/** 替换通知面板背景 - 旧版本 */
|
||||
@@ -722,16 +730,29 @@ class SystemUIHooker : YukiBaseHooker() {
|
||||
name = "draw"
|
||||
paramCount = 2
|
||||
}
|
||||
beforeHook { modifyNotifyPanelAlpha(args().last().cast<Drawable>()) }
|
||||
beforeHook { modifyNotifyPanelAlpha(instance(), args().last().cast<Drawable>()) }
|
||||
}
|
||||
injectMember {
|
||||
method {
|
||||
name = "drawCustom"
|
||||
paramCount = 2
|
||||
}
|
||||
beforeHook { modifyNotifyPanelAlpha(args().last().cast<Drawable>()) }
|
||||
beforeHook { modifyNotifyPanelAlpha(instance(), args().last().cast<Drawable>()) }
|
||||
}
|
||||
}.by { isOldNotificationBackground }
|
||||
/** 替换通知面板背景 - 避免折叠展开通知二次修改通知面板背景 */
|
||||
ExpandableNotificationRowClass.hook {
|
||||
injectMember {
|
||||
method {
|
||||
name = "updateBackgroundForGroupState"
|
||||
emptyParam()
|
||||
}
|
||||
beforeHook {
|
||||
if (prefs.get(DataConst.ENABLE_NOTIFY_PANEL_ALPHA))
|
||||
field { name = "mShowGroupBackgroundWhenExpanded" }.get(instance).setTrue()
|
||||
}
|
||||
}
|
||||
}
|
||||
/** 替换通知图标和样式 */
|
||||
NotificationHeaderViewWrapperClass.hook {
|
||||
injectMember {
|
||||
|
@@ -126,7 +126,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
||||
binding.notifyIconAutoSyncItem.isVisible = modulePrefs.get(DataConst.ENABLE_NOTIFY_ICON_FIX)
|
||||
binding.notifyIconAutoSyncChildItem.isVisible = modulePrefs.get(DataConst.ENABLE_NOTIFY_ICON_FIX_AUTO)
|
||||
binding.notifyPanelConfigSeekbar.isVisible = modulePrefs.get(DataConst.ENABLE_NOTIFY_PANEL_ALPHA)
|
||||
binding.notifyPanelConfigText.isVisible = modulePrefs.get(DataConst.ENABLE_NOTIFY_PANEL_ALPHA)
|
||||
binding.notifyPanelConfigTextPanel.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)
|
||||
@@ -139,7 +139,7 @@ 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)}"
|
||||
binding.notifyPanelConfigText.text = modulePrefs.get(DataConst.NOTIFY_PANEL_ALPHA).toString()
|
||||
binding.notifyIconAutoSyncText.text = notifyIconAutoSyncTime
|
||||
binding.moduleEnableSwitch.setOnCheckedChangeListener { btn, b ->
|
||||
if (btn.isPressed.not()) return@setOnCheckedChangeListener
|
||||
@@ -200,7 +200,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
||||
binding.notifyPanelConfigSwitch.setOnCheckedChangeListener { btn, b ->
|
||||
if (btn.isPressed.not()) return@setOnCheckedChangeListener
|
||||
modulePrefs.put(DataConst.ENABLE_NOTIFY_PANEL_ALPHA, b)
|
||||
binding.notifyPanelConfigText.isVisible = b
|
||||
binding.notifyPanelConfigTextPanel.isVisible = b
|
||||
binding.notifyPanelConfigSeekbar.isVisible = b
|
||||
SystemUITool.refreshSystemUI(context = this)
|
||||
}
|
||||
@@ -212,7 +212,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
||||
}
|
||||
binding.notifyPanelConfigSeekbar.setOnSeekBarChangeListener(object : OnSeekBarChangeListener {
|
||||
override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) {
|
||||
binding.notifyPanelConfigText.text = "当前值 - $progress"
|
||||
binding.notifyPanelConfigText.text = progress.toString()
|
||||
}
|
||||
|
||||
override fun onStopTrackingTouch(seekBar: SeekBar) {
|
||||
|
@@ -443,19 +443,41 @@
|
||||
android:max="255"
|
||||
android:min="0" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/notify_panel_config_text"
|
||||
android:layout_width="wrap_content"
|
||||
<LinearLayout
|
||||
android:id="@+id/notify_panel_config_text_panel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
android:maxWidth="100dp"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="5dp"
|
||||
android:paddingBottom="15dp"
|
||||
android:singleLine="true"
|
||||
android:text="当前值 - %1"
|
||||
android:textColor="@color/colorTextGray"
|
||||
android:textSize="14sp" />
|
||||
android:paddingBottom="15dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="5dp"
|
||||
android:alpha="0.75"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
android:maxWidth="100dp"
|
||||
android:singleLine="true"
|
||||
android:text="当前值"
|
||||
android:textColor="@color/colorTextGray"
|
||||
android:textSize="13.5sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/notify_panel_config_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
android:maxWidth="100dp"
|
||||
android:singleLine="true"
|
||||
android:text="%1"
|
||||
android:textColor="@color/colorTextGray"
|
||||
android:textSize="15sp"
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
@@ -468,6 +490,18 @@
|
||||
android:text="开启自定义功能后,你可以拖拽滑动条来调整通知面板的透明度,0 为全透明,255 为不透明。"
|
||||
android:textColor="@color/colorTextDark"
|
||||
android:textSize="12sp" />
|
||||
|
||||
<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~12.1 测试正常,不能保证可以和各种通知栏主题模块配合使用,如有冲突请关闭此功能或禁用相关重复功能的主题模块。"
|
||||
android:textColor="@color/colorTextDark"
|
||||
android:textSize="12sp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
|
@@ -5,8 +5,8 @@ plugins {
|
||||
}
|
||||
|
||||
ext {
|
||||
appVersionName = "1.7"
|
||||
appVersionCode = 12
|
||||
appVersionName = "1.75"
|
||||
appVersionCode = 13
|
||||
enableR8 = true
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user