132 Commits
2.98 ... master

Author SHA1 Message Date
3e29a70969 chore: update target sdk to 36 2025-08-19 16:52:33 +08:00
3015eade97 chore: update jdk to 21 2025-08-19 16:52:18 +08:00
c172e1e229 chore: bump gradle to 8.14.3 2025-08-19 16:52:11 +08:00
25b7853313 chore: bump dependencies 2025-08-19 16:52:00 +08:00
08e38c6770 chore(ci): trigger build #241 2025-08-17 00:50:06 +08:00
李太白
058c4534f7 fix:处理通知图标的 “app_package ” 并修复焦点通知图标的颜色 (#241)
* fix:处理通知图标的 “app_package ”并修复焦点通知图标的颜色

此提交解决了两个问题:

1.  **通知图标软件包名称:** 现在,如果通知中的 "app_package" 字符串可用,它将正确使用该字符串,并返回到通知的软件包名称。这可确保在一个应用程序代表另一个应用程序(如系统服务)发送通知时加载正确的图标。
2.  **焦点通知图标颜色:** 焦点通知图标的着色现在可根据通知图标优化配置正确应用,从而防止出现不正确的图标颜色。

Signed-off-by: ghhccghk <2137610394@qq.com>

* fix: 修复焦点通知图标逻辑异常,修复setTint导致无法正确着色

Signed-off-by: ghhccghk <2137610394@qq.com>

* fix: 修复焦点通知反色功能异常

Signed-off-by: ghhccghk <2137610394@qq.com>

* feat: 新增开关强制对焦点通知进行反色

- 新增开关 `ENABLE_FOCUS_NOTIFICATION_FIX`,默认关闭
- 当该开关开启时,强制对焦点通知图标进行反色处理
- 调整了 SystemUIHooker 中对焦点通知图标的反色逻辑,使其在 `ENABLE_FOCUS_NOTIFICATION_FIX` 开启时生效
- 修复了当图标不是灰度图标时,也标记为需要反色的问题

Signed-off-by: ghhccghk <2137610394@qq.com>

* style: some tweaks in SystemUIHooker

---------

Signed-off-by: ghhccghk <2137610394@qq.com>
Co-authored-by: fankesyooni <qzmmcn@163.com>
2025-08-16 20:57:57 +08:00
1551013414 refactor: update KavaRef usage to 1.0.1 2025-07-06 21:32:43 +08:00
8a775b3fdd refactor: migrate and update to YukiHookAPI 1.3.0 2025-06-25 23:25:58 +08:00
c5ed4f720f misc: invalidate 2025-06-25 23:25:57 +08:00
914e44942a refactor: migrate and update to YukiHookAPI 1.3.0 2025-06-25 23:22:23 +08:00
1b44e232ea docs: update README 2025-06-24 14:11:42 +08:00
7eb69e45f0 docs: update README 2025-06-20 12:50:08 +08:00
487e249f33 chore: disable type auto conversion for sweet-property 2025-05-09 23:20:18 +08:00
bbc14beb2e chore: bump dependencies 2025-03-16 23:22:17 +08:00
8a24cf3a4a chore: bump gradle to 8.13 2025-03-16 23:22:11 +08:00
139fafc758 chore: update project files 2025-03-16 23:22:01 +08:00
19e93cb15d Recommit #234 2025-02-22 00:55:40 +08:00
739816c31a chore: bump ci to v4 2025-02-22 00:55:35 +08:00
a7d457eb67 chore: update .gitignore 2025-02-21 23:19:09 +08:00
李太白
76f113de78 fix: 修复新版本焦点通知反色异常,取消对getStatusBarTickerDarkIcon进行着色 (#231)
* fix: 未适配图标的app在焦点通知会以白块显示

* fix: 修复调用方式解决Hyper 1.0 焦点反色失败

* fix: 修复调用方式解决Hyper 1.0 焦点反色失败

* fix: 修复新版本焦点通知反色异常,取消对getStatusBarTickerDarkIcon进行着色
2025-01-21 15:49:56 +08:00
aec000e252 docs: update license 2025-01-13 11:15:31 +08:00
d308111476 chore: update project files 2025-01-12 04:45:30 +08:00
c8f1099326 chore: update project files 2025-01-06 22:20:55 +08:00
李太白
350e54fac7 fix: 修复调用方式解决Hyper 1.0 焦点反色失败 (#228)
* fix: 未适配图标的app在焦点通知会以白块显示

* fix: 修复调用方式解决Hyper 1.0 焦点反色失败

* fix: 修复调用方式解决Hyper 1.0 焦点反色失败
2025-01-06 21:57:41 +08:00
李太白
4f1d74d5ff fix: 未适配图标的app在焦点通知会以白块显示 (#225) 2025-01-02 23:56:49 +09:00
f00f6efcf3 fix: getStatusBarTickerIcon/getStatusBarTickerDarkIcon lost state color in SystemUIHooker 2024-12-13 17:39:03 +08:00
8b6d35fa01 refactor: completion code optimizing 2024-12-13 10:35:06 +08:00
李太白
0c43bc5b97 fix: Log添加澎湃焦点通知相关,彻底修复焦点通知反色问题 (#222) 2024-12-12 21:52:25 +08:00
李太白
a134385d26 fix: 修复澎湃焦点通知1.0反色异常 (#219) 2024-12-09 19:26:24 +08:00
李太白
6d62c02b42 尝试修复反色异常,并以small图标为基准。 (#218) 2024-12-08 19:43:06 +08:00
4dcb05797c refactor: change use "miui.appIcon" to push system ui notification 2024-12-07 01:16:22 +08:00
7598da4d65 fix: small icon color transition @Nep-Timeline 2024-12-07 01:05:46 +08:00
992db5c4cf style: format code in SystemUIHooker 2024-12-07 00:48:06 +08:00
李太白
3cc2787a88 强制修改 getCustomAppIcon 获取的图标为 smallIcon,同时清理错误提交的代码 (#216)
* 强制修改 getCustomAppIcon 获取的图标为 smallIcon,同时清理错误提交的代码

* Resources.getSystem 换成 ct.resources
2024-12-05 22:42:15 +08:00
b476c19035 refactor: hook HyperOS focus icon and other fixing (cb4bf479) 2024-12-05 15:56:47 +08:00
李太白
cb4bf479ba add hook HyperOS 焦点通知彩色图标 (#215)
* add hook HyperOS 焦点通知彩色图标

* clean code

* fix: hyper os 2.0.25.0 bug
2024-12-05 15:37:03 +08:00
cd38dbf579 refactor: support Android 15 edge-to-edge system bars 2024-11-25 18:50:30 +08:00
259eb1dbd4 chore: update target sdk to 35 2024-11-10 20:42:28 +08:00
4d2160ce8a chore: some tweaks in build.gradle.kts 2024-11-10 20:42:10 +08:00
bcf3a17e21 chore: update project files 2024-11-10 20:42:01 +08:00
e7763baa22 chore: bump dependencies 2024-11-10 20:36:10 +08:00
e47754b870 chore: bump gradle to 8.10.2 2024-11-10 20:36:03 +08:00
YuSaki丶Kanade
e9e27b1d5a fix: HyperOS 2.0 handleAppIcon param (#212) 2024-11-06 20:39:45 +08:00
b10ff658ab refactor: test HyperOS 2.0 2024-11-02 00:25:00 +08:00
94f3fd12cd docs: add Android 15 option 2024-10-10 09:09:03 +08:00
7678ea7612 fix: HyperOS 1.1.3.0 (Android 15) status bar icons dark mode in SystemUIHooker 2024-10-03 19:02:51 +08:00
hamjin
d1a7d140a3 feat: Replace ghproxy.com with ghp.ci (#209) 2024-10-03 15:48:47 +08:00
01f5c902e9 Revert "feat: custom GitHub Proxy (#208)"
This reverts commit a601739679.
2024-10-03 01:27:14 +08:00
hamjin
a601739679 feat: custom GitHub Proxy (#208)
* feat: Custom GitHub Proxy

Signed-off-by: hamjin <jinham@qq.com>

* refactor: organize text layout

---------

Signed-off-by: hamjin <jinham@qq.com>
Co-authored-by: Fankesyooni <37344460+fankes@users.noreply.github.com>
2024-10-03 00:29:51 +08:00
YuSaki丶Kanade
a2bf9d24eb [修复] Android 15 解除状态栏图标无效 / 类及方法错误 (#206)
* Update FunctionFactory.kt

* Update SystemUIHooker.kt

* Update SystemUIHooker.kt

* Update SystemUIHooker.kt

* Update SystemUIHooker.kt

* Update FunctionFactory.kt
2024-09-24 19:09:12 +08:00
5a1672c0a4 fix: support HyperOS of commit(a5066814) in SystemUIHooker 2024-09-12 12:39:00 +08:00
a506681431 fix: notification icon reset in NotificationContentInflaterInjector in SystemUIHooker 2024-09-10 10:15:56 +08:00
abd1189e75 chore: update .editorconfig 2024-06-21 10:10:26 +08:00
ad0a538f13 refactor: support Kotlin 2.0.0 2024-06-20 11:20:30 +08:00
46abe6a6c1 chore: bump dependencies 2024-06-20 11:20:19 +08:00
b855113e4d chore: bump dependencies 2024-06-20 11:17:50 +08:00
c9411e5aa0 chore: bump gradle to 8.7 2024-06-20 11:17:46 +08:00
8729979c33 chore: update .editorconfig 2024-06-20 11:17:35 +08:00
28d3d7fd86 fix: wrong field name for MIUI14 in SystemUIHooker 2024-06-16 01:28:43 +08:00
hamjin
d2f8ef69c6 StatusBarMaxStaticIcons: Fully managed by us if enabled else do nothing (#199)
* StatusBarMaxStaticIcons: Fully managed by us if enabled else do nothing

Signed-off-by: hamjin <jinham@qq.com>

* Fix restore original count and enhance manage on HyperOS

* Remove unused code

---------

Signed-off-by: hamjin <jinham@qq.com>
2024-03-05 14:49:13 +08:00
c5b5fcfe35 chore: bump dependencies 2024-02-20 11:33:30 +08:00
219dd8b9e3 chore: bump gradle to 8.6 2024-02-20 11:33:25 +08:00
ad8fb50183 chore: update .editorconfig 2024-01-13 21:23:03 +08:00
ba74c7c9d4 docs: update copyright date to 2024 for all existing files 2024-01-01 01:27:09 +08:00
f398f2bcc3 style: merge to new ktlint version & rules 2023-12-29 21:37:12 +08:00
0377bb7062 chore: update project files 2023-12-29 21:36:08 +08:00
099133c6d6 chore: bump dependencies 2023-12-28 23:51:17 +08:00
7925629ef7 chore: bump gradle to 8.5 2023-12-28 23:49:06 +08:00
c42fad05c6 chore: update .gitignore 2023-12-28 23:48:56 +08:00
44483f1bd2 docs: use relative link 2023-12-11 02:41:29 +08:00
1e4bf54b80 chore: update project files 2023-12-11 02:41:27 +08:00
3fe8dca9e9 chore: bump dependency versions 2023-12-11 00:21:18 +08:00
b101210ed1 docs: update piracy statement 2023-12-11 00:21:12 +08:00
2a3398990b docs: update promotion 2023-11-18 18:16:09 +08:00
86d325ac31 chore: bump "com.highcapable.sweetdependency" version to 1.0.4 2023-11-14 01:03:18 +08:00
c74718572d chore: bump "com.highcapable.sweetproperty" version to 1.0.5 2023-11-08 15:16:46 +08:00
d1dc64108a fix: some problem in MIUI 14 (14.0.4) Android 14 2023-11-06 11:20:53 +08:00
386d3c254b chore: update project files 2023-11-06 11:20:13 +08:00
f2118bdc79 chore: bump dependencies 2023-11-04 03:56:18 +08:00
5651618506 chore: bump plugin versions
- bump "com.highcapable.sweetdependency" version to 1.0.3
- bump "com.highcapable.sweetproperty" version to 1.0.4
2023-11-04 03:52:36 +08:00
91f3a3418b Bump version to 2.110 2023-11-03 13:46:37 +08:00
61849cebe0 docs: update download links and description 2023-11-03 13:19:46 +08:00
1f71fbda9a feat: add classic (MIUI) style notification icon replacement 2023-11-03 12:18:18 +08:00
8f01e649fe feat: display HyperOS when decided and add HyperOS description 2023-11-03 11:32:57 +08:00
ae15d72923 refactor: optimize code 2023-11-03 10:33:02 +08:00
3b82c33c2e feat: remove warn dialog, support A14 and HyperOS 2023-11-02 11:58:08 +08:00
621f973a2f refactor: use legacy updateIconColor function to reset icon and color 2023-11-02 11:56:27 +08:00
ef2c8afe3f fix: notification panel refresh function
- Use SettingsManager instead StatusBarNotificationPresenter on A14 and HyperOS
2023-11-02 11:47:25 +08:00
3d7e4d8825 feat: shrink padding of notification icon on HyperOS 2023-11-02 09:57:35 +08:00
19b2efbb83 fix: ExpandableNotificationRow on A14 and HyperOS 2023-11-02 09:29:19 +08:00
d330510788 fix: handleAppIcon on A14 and HyperOS 2023-11-02 09:18:12 +08:00
25a23d7e1a fix: calculateIconTranslations on A14 and HyperOS 2023-11-02 09:11:06 +08:00
db4b418ed4 fix: updateNotificationIcons on A14 and HyperOS 2023-11-02 09:10:50 +08:00
8a97e38d20 fix: updateStatusBarIconAlpha on A14 and HyperOS 2023-11-02 08:12:40 +08:00
Fankesyooni
f294120fa8 Merge pull request #194 from hosizoraru/master
fix: A13 ignored A14 Adapt
2023-10-31 21:35:20 +08:00
hosizoraru
d244658aa6 fix: A13 ignored A14 Adapt 2023-10-31 15:03:52 +08:00
Fankesyooni
445ac85d8d Merge pull request #192 from hosizoraru/master
fix: statusBarMaxStaticIcons on A14/HyperOS
2023-10-31 13:10:02 +08:00
hosizoraru
e3b22671c1 fix: statusBarMaxStaticIcons on A14/HyperOS 2023-10-31 12:57:31 +08:00
d574449e4a docs: update explore history 2023-10-31 09:15:01 +08:00
85a2e730e0 docs: update release channel 2023-10-26 21:26:46 +08:00
ca367bde9e feat: simple support HyperOS 2023-10-23 00:45:42 +08:00
03ce7fbbe6 docs: add HyperOS support 2023-10-23 00:45:26 +08:00
88e3f79878 fix: catch toast when no looper 2023-10-22 22:36:16 +08:00
ba67bd0a62 chore: update target sdk to 34 2023-10-21 01:18:53 +08:00
0c0cf9bfba feat(docs): update YukiHookAPI owner link 2023-10-21 01:18:49 +08:00
0e98ec16c7 refactor: remove RECEIVER_NOT_EXPORTED_PERMISSION 2023-10-21 01:13:39 +08:00
f1fd3f2679 refactor: migrate to YukiHookAPI new usage 2023-10-07 21:02:34 +08:00
97065494b0 chore: bump dependency versions 2023-10-07 21:02:27 +08:00
b172d7a090 chore: bump plugin versions
- bump "com.highcapable.sweetdependency" version to 1.0.2
- bump "com.highcapable.sweetproperty" version to 1.0.3
2023-09-26 09:06:34 +08:00
b86988a310 refactor: add new R8 rules to fix possible problems 2023-09-19 08:18:38 +08:00
32f8ca9d63 ci: fix artifacts name 2023-09-19 01:51:56 +08:00
3cf67eb7fc feat: simple support Android 14 display name 2023-09-18 00:21:12 +08:00
9f39f297f9 docs: optimize comments 2023-09-18 00:19:03 +08:00
7feab98a1e feat: lots of changes
- add BuildConfigWrapper
- merge to new project promote
- add ci version tag support
- Fix system api compat issues
2023-09-18 00:17:23 +08:00
b297b43dfb docs: update README, EXPLORE_HISTORY 2023-09-18 00:15:54 +08:00
c7c03e891f style: optimize code 2023-09-18 00:15:08 +08:00
5ddc5de475 docs: move images to img-src 2023-09-18 00:13:17 +08:00
d09c11f026 refactor: use new payment code 2023-09-18 00:12:16 +08:00
bf22cae957 fix: class not found when R8 since android gradle plugin 8+ 2023-09-18 00:11:26 +08:00
a08e085b2b ci: optimize and add artifacts post to Telegram 2023-09-18 00:10:57 +08:00
9690e27511 chore: add Android 14 option 2023-09-18 00:10:31 +08:00
f9dde5f549 chore: migrate build script from groovy to kts
- using SweetDependency, SweetProperty
- merge singing key file configs to properties
- update gradle and dependencies
2023-09-18 00:10:06 +08:00
8ddb938883 chore: clean up build step files 2023-09-18 00:08:14 +08:00
8664d7b285 [Change Commit Specification] Use the new commit spec from here on
child commits:
chore: add .editorconfig
2023-09-18 00:05:26 +08:00
d70d01cf6c Fix SystemUI crashed when StatusBarNotification's tag is null by NotificationStat method "isUnimportantEntry" in SystemUIHooker 2023-08-27 14:38:05 +08:00
4703d339b7 Update version to 2.101 2023-05-14 19:16:05 +08:00
76b1cc2f0b Fix notification icon problem in MIUI 14 DEV version in SystemUIHooker 2023-05-14 15:51:36 +08:00
62ec1d16ae Update version to 2.100 2023-04-25 06:40:55 +08:00
7db010c9a1 Modify merge to YukiHookAPI new usage 2023-04-25 06:26:05 +08:00
e6fa34d7fd Update YukiHookAPI 2023-04-25 06:25:55 +08:00
d4661abb71 Update version to 2.99 2023-04-22 22:37:11 +08:00
744d028160 Modify remove prefs cache function and disable prefs cache 2023-04-22 22:32:16 +08:00
75 changed files with 1897 additions and 1075 deletions

33
.editorconfig Normal file
View File

@@ -0,0 +1,33 @@
# noinspection EditorConfigKeyCorrectness
[{*.kt,*.kts}]
ktlint_standard_annotation = disabled
ktlint_standard_filename = disabled
ktlint_standard_wrapping = disabled
ktlint_standard_import-ordering = enabled
ktlint_standard_max-line-length = disabled
ktlint_standard_multiline-if-else = disabled
ktlint_standard_argument-list-wrapping = disabled
ktlint_standard_parameter-list-wrapping = disabled
ktlint_standard_trailing-comma-on-declaration-site = disabled
ktlint_function_signature_body_expression_wrapping = multiline
ktlint_standard_string-template-indent = disabled
ktlint_standard_function-signature = disabled
ktlint_standard_trailing-comma-on-call-site = disabled
ktlint_standard_multiline-expression-wrapping = disabled
ktlint_standard_no-empty-first-line-in-class-body = disabled
ktlint_standard_if-else-wrapping = disabled
ktlint_standard_if-else-bracing = disabled
ktlint_standard_statement-wrapping = disabled
ktlint_standard_blank-line-before-declaration = disabled
ktlint_standard_no-empty-file = disabled
ktlint_standard_property-naming = disabled
ktlint_standard_function-naming = disabled
ktlint_standard_chain-method-continuation = disabled
ktlint_standard_class-signature = disabled
ktlint_standard_condition-wrapping = disabled
ktlint_standard_class-signature = disabled
ij_continuation_indent_size = 2
indent_size = 4
indent_style = space
insert_final_newline = false
max_line_length = 150

View File

@@ -1,6 +1,6 @@
name: 问题与 BUG 反馈 name: 问题与 BUG 反馈
description: 问题反馈必须使用此模板进行提交 description: 问题反馈必须使用此模板进行提交
labels: [bug] labels: [ bug ]
title: "[问题与 BUG 反馈] (在这里简要描述问题原因)" title: "[问题与 BUG 反馈] (在这里简要描述问题原因)"
body: body:
- type: markdown - type: markdown
@@ -8,7 +8,7 @@ body:
value: | value: |
### 请在下方填写问题发生的具体原因和复现步骤。 ### 请在下方填写问题发生的具体原因和复现步骤。
我们只接受 MIUI 正规官方版本系统,如果你正在使用 MIUI 官改(第三方修改版)请不要提交任何 BUG 与问题,我们无义务去解决,请自求多福。 我们只接受 MIUI 或 HyperOS 正规官方版本系统,如果你正在使用官改 (第三方修改版) 请不要提交任何 BUG 与问题,我们无义务去解决,请自求多福。
发生异常、崩溃、闪退或功能性问题,必须提交问题 Log (日志),没有 Log 的 issues 将直接被关闭。 发生异常、崩溃、闪退或功能性问题,必须提交问题 Log (日志),没有 Log 的 issues 将直接被关闭。
- type: input - type: input
@@ -19,16 +19,16 @@ body:
required: true required: true
- type: input - type: input
attributes: attributes:
label: MIUI 版本 label: 系统版本
description: | description: |
这里填写当前的 MIUI 版本,例如:**13.0.1** 这里填写当前的系统,例如:**MIUI 13.0.1** 或 **HyperOS 1.0**
开发版需要标注具体的版本号,例如:**13 22.9.27** 开发版需要标注具体的版本号,例如:**MIUI 13 22.9.27** 或 **HyperOS 1.0 22.9.27**
validations: validations:
required: true required: true
- type: dropdown - type: dropdown
attributes: attributes:
label: MIUI 版本类型 label: 系统版本类型
description: 请选择你使用的 MIUI 版本类型。 description: 请选择你使用的系统版本类型。
options: options:
- 稳定版 - 稳定版
- 稳定内测版 - 稳定内测版
@@ -41,6 +41,8 @@ body:
attributes: attributes:
label: Android 版本 label: Android 版本
options: options:
- 15
- 14
- 13 - 13
- 12L/12.1 - 12L/12.1
- 12 - 12

View File

@@ -13,17 +13,34 @@ on:
jobs: jobs:
build: build:
name: Build CI name: Build CI
if: ${{ success() }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
env:
APK_OUTPUT_PATH: 'app/build/outputs/apk'
TG_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
TG_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
COMMIT_MESSAGE: |+
New push to GitHub\!
```
${{ github.event.head_commit.message }}
```by `${{ github.event.head_commit.author.name }}`
See commit detail [here](${{ github.event.head_commit.url }})
COMMIT_URL: ${{ github.event.head_commit.url }}
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: Prepare GitHub Env
run: |
GITHUB_SHA=${{ github.sha }}
GITHUB_CI_COMMIT_ID=${GITHUB_SHA:0:7}
echo "GITHUB_CI_COMMIT_ID=$GITHUB_CI_COMMIT_ID" >> $GITHUB_ENV
- name: Setup cmake - name: Setup cmake
uses: jwlawson/actions-setup-cmake@v1 uses: jwlawson/actions-setup-cmake@v1
with: with:
cmake-version: '3.22.1' cmake-version: '3.22.1'
- name: Prepare Java 11 - name: Prepare Java 21
uses: actions/setup-java@v3 uses: actions/setup-java@v4
with: with:
java-version: 11 java-version: 21
java-package: jdk java-package: jdk
distribution: 'temurin' distribution: 'temurin'
cache: 'gradle' cache: 'gradle'
@@ -34,7 +51,7 @@ jobs:
~/.gradle/caches ~/.gradle/caches
~/.gradle/wrapper ~/.gradle/wrapper
!~/.gradle/caches/build-cache-* !~/.gradle/caches/build-cache-*
key: gradle-deps-core-${{ hashFiles('**/build.gradle') }} key: gradle-deps-core-${{ hashFiles('**/build.gradle.kts') }}
restore-keys: | restore-keys: |
gradle-deps gradle-deps
- name: Cache Gradle Build - name: Cache Gradle Build
@@ -49,15 +66,23 @@ jobs:
run: | run: |
./gradlew :app:assembleDebug ./gradlew :app:assembleDebug
./gradlew :app:assembleRelease ./gradlew :app:assembleRelease
echo "DEBUG_APK_FILE=$(find app/build/outputs/apk/debug -name '*.apk')" >> $GITHUB_ENV echo "DEBUG_APK_PATH=$(find ${{ env.APK_OUTPUT_PATH }}/debug -name '*.apk')" >> $GITHUB_ENV
echo "RELEASE_APK_FILE=$(find app/build/outputs/apk/release -name '*.apk')" >> $GITHUB_ENV echo "RELEASE_APK_PATH=$(find ${{ env.APK_OUTPUT_PATH }}/release -name '*.apk')" >> $GITHUB_ENV
- name: Upload Artifacts(debug) - name: Upload Artifacts (Debug)
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v4
with: with:
path: ${{ env.DEBUG_APK_FILE }} path: ${{ env.DEBUG_APK_PATH }}
name: app-debug name: MIUINativeNotifyIcon-debug-${{ github.event.head_commit.id }}
- name: Upload Artifacts(release) - name: Upload Artifacts (Release)
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v4
with: with:
path: ${{ env.RELEASE_APK_FILE }} path: ${{ env.RELEASE_APK_PATH }}
name: app-release name: MIUINativeNotifyIcon-release-${{ github.event.head_commit.id }}
- name: Post Artifacts to Telegram
run: |
export debug=$(find ${{ env.APK_OUTPUT_PATH }}/debug -name "*.apk")
export release=$(find ${{ env.APK_OUTPUT_PATH }}/release -name "*.apk")
ESCAPED=`python3 -c 'import json,os,urllib.parse; msg = json.dumps(os.environ["COMMIT_MESSAGE"]); print(urllib.parse.quote(msg if len(msg) <= 1024 else json.dumps(os.environ["COMMIT_URL"])))'`
curl -v "https://api.telegram.org/bot${TG_BOT_TOKEN}/sendMediaGroup?chat_id=${TG_CHAT_ID}&media=%5B%7B%22type%22%3A%22document%22%2C%20%22media%22%3A%22attach%3A%2F%2Fdebug%22%7D%2C%7B%22type%22%3A%22document%22%2C%20%22media%22%3A%22attach%3A%2F%2Frelease%22%2C%22parse_mode%22%3A%22MarkdownV2%22%2C%22caption%22:${ESCAPED}%7D%5D" \
-F debug="@$debug" \
-F release="@$release"

View File

@@ -11,18 +11,26 @@ on:
jobs: jobs:
build: build:
name: Pull request check name: Pull Request Check
if: ${{ success() }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
env:
APK_OUTPUT_PATH: 'app/build/outputs/apk'
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: Prepare GitHub Env
run: |
GITHUB_SHA=${{ github.sha }}
GITHUB_CI_COMMIT_ID=${GITHUB_SHA:0:7}
echo "GITHUB_CI_COMMIT_ID=$GITHUB_CI_COMMIT_ID" >> $GITHUB_ENV
- name: Setup cmake - name: Setup cmake
uses: jwlawson/actions-setup-cmake@v1 uses: jwlawson/actions-setup-cmake@v1
with: with:
cmake-version: '3.22.1' cmake-version: '3.22.1'
- name: Prepare Java 11 - name: Prepare Java 21
uses: actions/setup-java@v3 uses: actions/setup-java@v4
with: with:
java-version: 11 java-version: 21
java-package: jdk java-package: jdk
distribution: 'temurin' distribution: 'temurin'
cache: 'gradle' cache: 'gradle'
@@ -33,7 +41,7 @@ jobs:
~/.gradle/caches ~/.gradle/caches
~/.gradle/wrapper ~/.gradle/wrapper
!~/.gradle/caches/build-cache-* !~/.gradle/caches/build-cache-*
key: gradle-deps-core-${{ hashFiles('**/build.gradle') }} key: gradle-deps-core-${{ hashFiles('**/build.gradle.kts') }}
restore-keys: | restore-keys: |
gradle-deps gradle-deps
- name: Cache Gradle Build - name: Cache Gradle Build
@@ -48,15 +56,15 @@ jobs:
run: | run: |
./gradlew :app:assembleDebug ./gradlew :app:assembleDebug
./gradlew :app:assembleRelease ./gradlew :app:assembleRelease
echo "DEBUG_APK_FILE=$(find app/build/outputs/apk/debug -name '*.apk')" >> $GITHUB_ENV echo "DEBUG_APK_PATH=$(find ${{ env.APK_OUTPUT_PATH }}/debug -name '*.apk')" >> $GITHUB_ENV
echo "RELEASE_APK_FILE=$(find app/build/outputs/apk/release -name '*.apk')" >> $GITHUB_ENV echo "RELEASE_APK_PATH=$(find ${{ env.APK_OUTPUT_PATH }}/release -name '*.apk')" >> $GITHUB_ENV
- name: Upload Artifacts(debug) - name: Upload Artifacts (Debug)
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v4
with: with:
path: ${{ env.DEBUG_APK_FILE }} path: ${{ env.DEBUG_APK_PATH }}
name: app-debug name: MIUINativeNotifyIcon-debug-${{ github.event.head_commit.id }}
- name: Upload Artifacts(release) - name: Upload Artifacts (Release)
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v4
with: with:
path: ${{ env.RELEASE_APK_FILE }} path: ${{ env.RELEASE_APK_PATH }}
name: app-release name: MIUINativeNotifyIcon-release-${{ github.event.head_commit.id }}

117
.gitignore vendored
View File

@@ -1,15 +1,110 @@
## Fully .gtignore for IntelliJ, Android Studio and Gradle based Java projects
## References:
## - https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
## - https://github.com/android/platform-samples/blob/main/.gitignore
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
# AWS User-specific
.idea/**/aws.xml
# Generated files
.idea/**/contentModel.xml
# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
# Gradle
.idea/**/gradle.xml
.idea/**/libraries
# Gradle and Maven with auto-import
.idea/.name
.idea/artifacts
.idea/compiler.xml
.idea/jarRepositories.xml
.idea/modules.xml
.idea/*.iml
.idea/modules
.idea/caches
.idea/material_theme**
.idea/other.xml
*.iml *.iml
.gradle *.ipr
/local.properties
/.idea/caches # Kotlin
/.idea/libraries .kotlin
/.idea/modules.xml
/.idea/workspace.xml # Misc
/.idea/navEditor.xml .idea/misc.xml
/.idea/assetWizardSettings.xml
.DS_Store # CMake
/build cmake-build-*/
# Mongo Explorer plugin
.idea/**/mongoSettings.xml
# File-based project format
*.iws
# IntelliJ
out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# SonarLint plugin
.idea/sonarlint/
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
# Editor-based Rest Client
.idea/httpRequests
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
# Android studio 3.1+ additional
.idea/deployment*.xml
.idea/assetWizardSettings.xml
.idea/androidTestResultsUserPreferences.xml
# Android projects
**/local.properties
/captures /captures
.externalNativeBuild .externalNativeBuild
.cxx .cxx
local.properties
# Gradle projects
.gradle
build/
# Mkdocs temporary serving folder
docs-gen
site
*.bak
.idea/appInsightsSettings.xml
# Mac OS
.DS_Store

3
.idea/.gitignore generated vendored
View File

@@ -1,3 +0,0 @@
# Default ignored files
/shelf/
/workspace.xml

1
.idea/.name generated
View File

@@ -1 +0,0 @@
MIUINativeNotifyIcon

6
.idea/AndroidProjectSystem.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AndroidProjectSystem">
<option name="providerId" value="com.android.tools.idea.GradleProjectSystem" />
</component>
</project>

6
.idea/compiler.xml generated
View File

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="11" />
</component>
</project>

20
.idea/gradle.xml generated
View File

@@ -1,20 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="GRADLE" />
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleJvm" value="11" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
</set>
</option>
</GradleProjectSettings>
</option>
</component>
</project>

View File

@@ -1,10 +1,12 @@
<component name="InspectionProjectProfileManager"> <component name="InspectionProjectProfileManager">
<profile version="1.0"> <profile version="1.0">
<option name="myName" value="Project Default" /> <option name="myName" value="Project Default" />
<inspection_tool class="CheckImageSize" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SpellCheckingInspection" enabled="false" level="TYPO" enabled_by_default="false"> <inspection_tool class="SpellCheckingInspection" enabled="false" level="TYPO" enabled_by_default="false">
<option name="processCode" value="true" /> <option name="processCode" value="true" />
<option name="processLiterals" value="true" /> <option name="processLiterals" value="true" />
<option name="processComments" value="true" /> <option name="processComments" value="true" />
</inspection_tool> </inspection_tool>
<inspection_tool class="YAMLSchemaValidation" enabled="false" level="WARNING" enabled_by_default="false" />
</profile> </profile>
</component> </component>

View File

@@ -1,40 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="MavenRepo" />
<option name="name" value="MavenRepo" />
<option name="url" value="https://repo.maven.apache.org/maven2/" />
</remote-repository>
<remote-repository>
<option name="id" value="maven3" />
<option name="name" value="maven3" />
<option name="url" value="https://www.jitpack.io" />
</remote-repository>
<remote-repository>
<option name="id" value="maven" />
<option name="name" value="maven" />
<option name="url" value="https://maven.aliyun.com/nexus/content/groups/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="maven2" />
<option name="name" value="maven2" />
<option name="url" value="https://maven.aliyun.com/nexus/content/repositories/jcenter" />
</remote-repository>
<remote-repository>
<option name="id" value="Google" />
<option name="name" value="Google" />
<option name="url" value="https://dl.google.com/dl/android/maven2/" />
</remote-repository>
</component>
</project>

6
.idea/kotlinc.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="KotlinJpsPluginSettings">
<option name="version" value="2.1.10" />
</component>
</project>

10
.idea/ktlint-plugin.xml generated Normal file
View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="KtLint plugin">
<ktlintMode>MANUAL</ktlintMode>
<formatOnSave>false</formatOnSave>
</component>
<component name="com.nbadal.ktlint.KtlintProjectSettings">
<ktlintMode>MANUAL</ktlintMode>
</component>
</project>

6
.idea/ktlint.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="KtlintProjectConfiguration">
<treatAsErrors>false</treatAsErrors>
</component>
</project>

10
.idea/migrations.xml generated Normal file
View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectMigrations">
<option name="MigrateToGradleLocalJavaHome">
<set>
<option value="$PROJECT_DIR$" />
</set>
</option>
</component>
</project>

43
.idea/misc.xml generated
View File

@@ -1,43 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DesignSurface">
<option name="filePathToZoomLevelMap">
<map>
<entry key="app/src/main/res/drawable-night/dark_round.xml" value="0.256" />
<entry key="app/src/main/res/drawable-night/permotion_round.xml" value="0.256" />
<entry key="app/src/main/res/drawable-v24/ic_launcher_foreground.xml" value="0.44871794871794873" />
<entry key="app/src/main/res/drawable/bg_dark_round.xml" value="0.2325" />
<entry key="app/src/main/res/drawable/bg_dialog_background.xml" value="0.2325" />
<entry key="app/src/main/res/drawable/bg_green_round.xml" value="0.255" />
<entry key="app/src/main/res/drawable/bg_orange_round.xml" value="0.2325" />
<entry key="app/src/main/res/drawable/bg_warn_round.xml" value="0.2325" />
<entry key="app/src/main/res/drawable/bg_yellow_round.xml" value="0.255" />
<entry key="app/src/main/res/drawable/ic_nf_icon_refresh.xml" value="0.2325" />
<entry key="app/src/main/res/drawable/ic_nf_icon_update.xml" value="0.2325" />
<entry key="app/src/main/res/drawable/ic_notify_icon.xml" value="0.2325" />
<entry key="app/src/main/res/drawable/ic_system_clock.xml" value="0.2325" />
<entry key="app/src/main/res/drawable/permotion_round.xml" value="0.256" />
<entry key="app/src/main/res/drawable/white_round.xml" value="0.256" />
<entry key="app/src/main/res/layout-w1240dp/dia_source_from.xml" value="0.36484375" />
<entry key="app/src/main/res/layout-w1240dp/dia_source_from_string.xml" value="0.36484375" />
<entry key="app/src/main/res/layout-w936dp/dia_status_icon_cout.xml" value="0.935546875" />
<entry key="app/src/main/res/layout/activity_config.xml" value="0.42168674698795183" />
<entry key="app/src/main/res/layout/activity_login.xml" value="0.4375" />
<entry key="app/src/main/res/layout/activity_main.xml" value="0.30387540746106484" />
<entry key="app/src/main/res/layout/adapter_config.xml" value="0.375" />
<entry key="app/src/main/res/layout/dia_icon_filter.xml" value="0.4307692307692308" />
<entry key="app/src/main/res/layout/dia_icon_search.xml" value="0.4307692307692308" />
<entry key="app/src/main/res/layout/dia_source_from.xml" value="0.3591278324070115" />
<entry key="app/src/main/res/layout/dia_source_from_string.xml" value="0.4307692307692308" />
<entry key="app/src/main/res/layout/dia_status_icon_count.xml" value="0.45" />
<entry key="app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml" value="0.44871794871794873" />
</map>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="11" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
</project>

17
.idea/runConfigurations.xml generated Normal file
View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="com.intellij.execution.junit.AbstractAllInDirectoryConfigurationProducer" />
<option value="com.intellij.execution.junit.AllInPackageConfigurationProducer" />
<option value="com.intellij.execution.junit.PatternConfigurationProducer" />
<option value="com.intellij.execution.junit.TestInClassConfigurationProducer" />
<option value="com.intellij.execution.junit.UniqueIdConfigurationProducer" />
<option value="com.intellij.execution.junit.testDiscovery.JUnitTestDiscoveryConfigurationProducer" />
<option value="org.jetbrains.kotlin.idea.junit.KotlinJUnitRunConfigurationProducer" />
<option value="org.jetbrains.kotlin.idea.junit.KotlinPatternConfigurationProducer" />
</set>
</option>
</component>
</project>

View File

@@ -1,6 +0,0 @@
{
"keyAlias": "public",
"keyPassword": "123456",
"storeFileName": "universal.p12",
"storePassword": "123456"
}

View File

@@ -12,22 +12,34 @@
但是,这个模块就是为了修复被 MIUI 开发组忽略的图标问题才诞生的,并完美地给 MIUI 修复了黑白块图标的问题。 但是,这个模块就是为了修复被 MIUI 开发组忽略的图标问题才诞生的,并完美地给 MIUI 修复了黑白块图标的问题。
补充:现在这个 [开发文档](https://dev.mi.com/distribute/doc/details?pId=1582) 竟然还在,那就放在这里鞭个尸吧。
## 效果展示 ## 效果展示
<img src="https://github.com/fankes/MIUINativeNotifyIcon/blob/master/images/style.png?raw=true"/> <img src="https://github.com/fankes/MIUINativeNotifyIcon/blob/master/img-src/style.png?raw=true" alt="Screenshot"/>
## 探索历程 ## 探索历程
原生 Android 的小图标和通知图标具有状态性。<br/><br/> 原生 Android 的小图标和通知图标具有状态性。
<img src="https://github.com/fankes/MIUINativeNotifyIcon/blob/master/images/native.jpg?raw=true" height = "35"/><br/><br/>
而 MIUI 最近的版本直接破坏了这一状态性,全部设置为 APP 的图标,不仅难看而且你无法下拉通知栏区别这些图标代表什么。<br/><br/> <img src="https://github.com/fankes/MIUINativeNotifyIcon/blob/master/img-src/native.jpg?raw=true" height = "35" alt="Screenshot"/>
<img src="https://github.com/fankes/MIUINativeNotifyIcon/blob/master/images/miui.jpg?raw=true" height = "40"/><br/><br/>
同样地,通知面板的图标同样遵守这一状态性。<br/><br/> 而 MIUI 最近的版本直接破坏了这一状态性,全部设置为 APP 的图标,不仅难看而且你无法下拉通知栏区别这些图标代表什么。
<img src="https://github.com/fankes/MIUINativeNotifyIcon/blob/master/images/native_n_1.jpg?raw=true" height = "100"/><br/>
<img src="https://github.com/fankes/MIUINativeNotifyIcon/blob/master/images/native_n_2.jpg?raw=true" height = "100"/><br/><br/> <img src="https://github.com/fankes/MIUINativeNotifyIcon/blob/master/img-src/miui.jpg?raw=true" height = "40" alt="Screenshot"/>
而 MIUI 做了什么呢?<br/><br/>
<img src="https://github.com/fankes/MIUINativeNotifyIcon/blob/master/images/miui_n_1.jpg?raw=true" height = "100"/><br/> 同样地,通知面板的图标同样遵守这一状态性。
<img src="https://github.com/fankes/MIUINativeNotifyIcon/blob/master/images/miui_n_2.jpg?raw=true" height = "100"/><br/><br/>
<img src="https://github.com/fankes/MIUINativeNotifyIcon/blob/master/img-src/native_n_1.jpg?raw=true" height = "100" alt="Screenshot"/>
<img src="https://github.com/fankes/MIUINativeNotifyIcon/blob/master/img-src/native_n_2.jpg?raw=true" height = "100" alt="Screenshot"/>
而 MIUI 做了什么呢?
<img src="https://github.com/fankes/MIUINativeNotifyIcon/blob/master/img-src/miui_n_1.jpg?raw=true" height = "100" alt="Screenshot"/>
<img src="https://github.com/fankes/MIUINativeNotifyIcon/blob/master/img-src/miui_n_2.jpg?raw=true" height = "100" alt="Screenshot"/>
不曾记得是什么版本开始MIUI 把通知图标改成了这个鬼样子,寻找开发组提案也是无人问津,最后转念一想,自己干吧。 不曾记得是什么版本开始MIUI 把通知图标改成了这个鬼样子,寻找开发组提案也是无人问津,最后转念一想,自己干吧。
由于目前大量通知图标都来自 `MIPUSH` 发出的营销通知,而 `MIPUSH` 的图标都是统一的彩色应用图标,很多应用也没有适配这一特性, 在通知栏广告满天飞的情况下MIUI 由于目前大量通知图标都来自 `MIPUSH` 发出的营销通知,而 `MIPUSH` 的图标都是统一的彩色应用图标,很多应用也没有适配这一特性, 在通知栏广告满天飞的情况下MIUI

View File

@@ -1,20 +1,25 @@
# MIUI 原生通知图标 # MIUI 原生通知图标
[![Blank](https://img.shields.io/badge/build-passing-brightgreen)](https://github.com/fankes/MIUINativeNotifyIcon) [![GitHub license](https://img.shields.io/github/license/fankes/MIUINativeNotifyIcon?color=blue&style=flat-square)](https://github.com/fankes/MIUINativeNotifyIcon/blob/master/LICENSE)
[![Blank](https://img.shields.io/badge/license-AGPL3.0-blue)](https://github.com/fankes/MIUINativeNotifyIcon/blob/master/LICENSE) [![GitHub CI](https://img.shields.io/github/actions/workflow/status/fankes/MIUINativeNotifyIcon/commit_ci.yml?label=CI%20builds&style=flat-square)](https://github.com/fankes/MIUINativeNotifyIcon/actions/workflows/commit_ci.yml)
[![Blank](https://img.shields.io/badge/version-v2.98-green)](https://github.com/fankes/MIUINativeNotifyIcon/releases) [![GitHub release](https://img.shields.io/github/v/release/fankes/MIUINativeNotifyIcon?display_name=release&logo=github&color=green&style=flat-square)](https://github.com/fankes/MIUINativeNotifyIcon/releases)
[![Blank](https://img.shields.io/github/downloads/fankes/MIUINativeNotifyIcon/total?label=Release)](https://github.com/fankes/MIUINativeNotifyIcon/releases) ![GitHub all releases](https://img.shields.io/github/downloads/fankes/MIUINativeNotifyIcon/total?label=downloads&style=flat-square)
[![Blank](https://img.shields.io/github/downloads/Xposed-Modules-Repo/com.fankes.miui.notify/total?label=LSPosed%20Repo&logo=Android&style=flat&labelColor=F48FB1&logoColor=ffffff)](https://github.com/Xposed-Modules-Repo/com.fankes.miui.notify/releases) ![GitHub all releases](https://img.shields.io/github/downloads/Xposed-Modules-Repo/com.fankes.miui.notify/total?label=LSPosed%20downloads&labelColor=F48FB1&style=flat-square)
[![Telegram](https://img.shields.io/badge/Follow-Telegram-blue.svg?logo=telegram)](https://t.me/XiaofangInternet)
<br/><br/>
<img src="https://github.com/fankes/MIUINativeNotifyIcon/blob/master/app/src/main/ic_launcher-playstore.png?raw=true" width = "100" height = "100"/>
<br/>
Fix the native notification bar icon function abandoned by the MIUI development team.<br/>
修复被 MIUI 开发组丢弃的原生通知图标,支持 MIUI 11、12、12.5、13、14 以及最新版本。
## Developer [![Telegram CI](https://img.shields.io/badge/CI%20builds-Telegram-blue.svg?logo=telegram&style=flat-square)](https://t.me/MIUINativeNotifyIcon_CI)
[![Telegram](https://img.shields.io/badge/discussion-Telegram-blue.svg?logo=telegram&style=flat-square)](https://t.me/XiaofangInternet)
[![QQ](https://img.shields.io/badge/discussion-QQ-blue.svg?logo=tencent-qq&logoColor=red&style=flat-square)](https://qm.qq.com/cgi-bin/qm/qr?k=dp2h5YhWiga9WWb_Oh7kSHmx01X8I8ii&jump_from=webapi&authKey=Za5CaFP0lk7+Zgsk2KpoBD7sSaYbeXbsDgFjiWelOeH4VSionpxFJ7V0qQBSqvFM)
[![QQ 频道](https://img.shields.io/badge/discussion-QQ%20频道-blue.svg?logo=tencent-qq&logoColor=red&style=flat-square)](https://pd.qq.com/s/44gcy28h)
[酷安 @星夜不荟](http://www.coolapk.com/u/876977) <img src="img-src/icon.png" width = "100" height = "100" alt="LOGO"/>
Fix the native notification bar icon function abandoned by the MIUI development team.
修复被 MIUI 开发组丢弃的原生通知图标,支持 MIUI 11~14 以及 HyperOS 1.0。
## For Non-Chinese Users
This project will not be adapted i18n, please stay tuned for my new projects in the future.
## 项目迁移公告 ## 项目迁移公告
@@ -24,7 +29,7 @@ Fix the native notification bar icon function abandoned by the MIUI development
## 适配说明 ## 适配说明
- 此模块仅支持 <b>LSPosed</b>(作用域“系统界面”)、<b>~~EdXposed(随时停止支持)~~</b>、不支持<b>太极、无极</b> - 此模块仅支持 **LSPosed** (作用域“系统界面”)、**~~EdXposed(随时停止支持)~~**、不支持**太极、无极**
- 请确保你使用的是 MIUI 官方版本,任何第三方官改包发生的问题,开发者没有义务去解决和修复,请自求多福 - 请确保你使用的是 MIUI 官方版本,任何第三方官改包发生的问题,开发者没有义务去解决和修复,请自求多福
@@ -32,13 +37,13 @@ Fix the native notification bar icon function abandoned by the MIUI development
- 建议最低从 MIUI 12.5 `2021-5-18` 开发版以后开始使用模块,之前的版本可能或多或少存在 MIUI 自身 BUG 不生效、图标黑白块的问题 - 建议最低从 MIUI 12.5 `2021-5-18` 开发版以后开始使用模块,之前的版本可能或多或少存在 MIUI 自身 BUG 不生效、图标黑白块的问题
- 请始终保持最新版本的 LSPosed旧版本可能会出现 Hook 不生效的问题,若最新版本依然不生效请在作用域中长按“系统界面”(“系统 UI”)选择重新优化 - 请始终保持最新版本的 **LSPosed**,旧版本可能会出现 Hook 不生效的问题,若最新版本依然不生效请在作用域中长按“系统界面” (“系统 UI”) 选择重新优化
## 历史背景 ## 历史背景
点击下方的链接查看此模块的历史背景与探索历程。 点击下方的链接查看此模块的历史背景与探索历程。
- [EXPLORE_HISTORY](https://github.com/fankes/MIUINativeNotifyIcon/blob/master/EXPLORE_HISTORY.md) - [EXPLORE_HISTORY](EXPLORE_HISTORY.md)
## 贡献通知图标优化名单 ## 贡献通知图标优化名单
@@ -46,52 +51,63 @@ Fix the native notification bar icon function abandoned by the MIUI development
- [Android 通知图标规范适配计划](https://github.com/fankes/AndroidNotifyIconAdapt) - [Android 通知图标规范适配计划](https://github.com/fankes/AndroidNotifyIconAdapt)
## 请勿用于非法用途 ## 发行渠道
- 本模块完全开源免费,如果好用你可以打赏支持开发,但是请不要用于非法用途。 | <img src="https://avatars.githubusercontent.com/in/15368?s=64&v=4" width = "30" height = "30" alt="LOGO"/> | [GitHub CI](https://github.com/fankes/MIUINativeNotifyIcon/actions/workflows/commit_ci.yml) | CI 自动构建 (测试版) |
|------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------|---------------|
## 发行渠道说明 | <img src="https://github.com/peter-iakovlev/Telegram/blob/public/Icon.png?raw=true" width = "30" height = "30" alt="LOGO"/> | [Telegram CI 频道](https://t.me/MIUINativeNotifyIcon_CI) | CI 自动构建 (测试版) |
|-----------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------|---------------|
- [Automatic Build on Commit](https://github.com/fankes/MIUINativeNotifyIcon/actions/workflows/commit_ci.yml) | <img src="https://avatars.githubusercontent.com/in/15368?s=64&v=4" width = "30" height = "30" alt="LOGO"/> | [GitHub Releases](https://github.com/fankes/MIUINativeNotifyIcon/releases) | 正式版 (稳定版) |
|------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------|-----------|
上述更新为代码 `commit` 后自动触发,具体更新内容可点击上方的文字前往 **GitHub Actions** 进行查看,本更新由开源的流程自动编译发布,**不保证其稳定性**,所发布的版本**仅供测试**,且不会特殊说明甚至可能会变更版本号或保持与当前稳定版相同的版本号。 | <img src="https://avatars.githubusercontent.com/u/78217009?s=200&v=4?raw=true" width = "30" height = "30" alt="LOGO"/> | [Xposed-Modules-Repo](https://github.com/Xposed-Modules-Repo/com.fankes.miui.notify/releases) | 正式版 (稳定版) |
|------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------|-----------|
- [Release](https://github.com/fankes/MIUINativeNotifyIcon/releases) | <img src="https://github.com/fankes/fankes/assets/37344460/82113d3c-aa7b-4dd1-95c7-cda650065c12" width = "30" height = "30" alt="LOGO"/> | [123 云盘 **(密码62ll)**](https://www.123pan.com/s/5SlUVv-W8DBh.html) | 正式版 (稳定版) |
- [Xposed-Modules-Repo](https://github.com/Xposed-Modules-Repo/com.fankes.miui.notify/releases) |------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------|-----------|
- [蓝奏云 **密码62ll**](https://fankes.lanzouy.com/b030o2e8h)
- [酷安应用市场](https://www.coolapk.com/apk/com.fankes.miui.notify)
上述更新为手动发布的稳定版,具体更新内容可点击上方的文字前往指定的发布页面查看,稳定版的更新将会同时发布到上述地址中,同步更新 本模块发布地址仅限于上述所列出的地址,从其他非正规渠道下载到的版本或对您造成任何影响均与我们无关
## 发行状态说明 ## 注意事项
![Blank](https://img.shields.io/badge/build-passing-brightgreen) <h3>1.&nbsp;本软件免费、由兴趣驱动开发,仅供学习交流使用。如果你是从其他非官方渠道付费获得本软件,可能已遭遇欺诈,欢迎向我们举报可疑行为。</h3>
上述状态为当前稳定版与自动构建版本一致或当前代码改动与稳定版无功能差异。 <h3>2.&nbsp;本软件采用 <strong>GNU Affero General Public License (AGPL 3.0)</strong> 许可证。根据该许可证的要求:</h3>
![Blank](https://img.shields.io/badge/build-pending-dbab09) - 任何衍生作品必须采用相同的 AGPL 许可证
- 分发本软件或其修改版本时,必须提供完整的源代码
- 必须保留原始的版权声明及许可证信息
- 不得额外施加限制来限制他人对本软件的自由使用
上述状态为存在自动构建版本和新功能的更新但当前并未发布稳定版,处于预发行状态。 <h3>3.&nbsp;我们鼓励在遵守 AGPL 3.0 条款的前提下进行自由传播和改进,但请尊重作者署名权,勿冒用原作者名义。</h3>
![Blank](https://img.shields.io/badge/build-problem-red) ## 项目推广
上述状态为当前发行的稳定版可能存在严重问题但并未及时进行修复且并未发布稳定版。 <!--suppress HtmlDeprecatedAttribute -->
<div align="center">
<h2>嘿,还请君留步!👋</h2>
<h3>这里有 Android 开发工具、UI 设计、Gradle 插件、Xposed 模块和实用软件等相关项目。</h3>
<h3>如果下方的项目能为你提供帮助,不妨为我点个 star 吧!</h3>
<h3>所有项目免费、开源,遵循对应开源许可协议。</h3>
<h1><a href="https://github.com/fankes/fankes/blob/main/project-promote/README-zh-CN.md">→ 查看更多关于我的项目,请点击这里 ←</a></h1>
</div>
## 捐赠支持 ## Star History
- 工作不易,无意外情况此项目将继续维护下去,提供更多可能,欢迎打赏。<br/><br/> ![Star History Chart](https://api.star-history.com/svg?repos=fankes/MIUINativeNotifyIcon&type=Date)
<img src="https://github.com/fankes/YuKiHookAPI/blob/master/img-src/wechat_code.jpg?raw=true" width = "200" height = "200"/>
## 隐私政策 ## 隐私政策
- [PRIVACY](https://github.com/fankes/MIUINativeNotifyIcon/blob/master/PRIVACY.md) - [PRIVACY](PRIVACY.md)
## 许可证 ## 许可证
- [AGPL-3.0](https://www.gnu.org/licenses/agpl-3.0.html) - [AGPL-3.0](https://www.gnu.org/licenses/agpl-3.0.html)
``` ```
Copyright (C) 2017-2023 Fankes Studio(qzmmcn@163.com) Copyright (C) 2017 Fankes Studio(qzmmcn@163.com)
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as it under the terms of the GNU Affero General Public License as
@@ -104,9 +120,9 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details. GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <https://www.gnu.org/licenses/>.
``` ```
Powered by [YukiHookAPI](https://github.com/fankes/YukiHookAPI) Powered by [YukiHookAPI](https://github.com/HighCapable/YukiHookAPI)
版权所有 © 2017-2023 Fankes Studio(qzmmcn@163.com) 版权所有 © 2017 Fankes Studio(qzmmcn@163.com)

1
app/.gitignore vendored
View File

@@ -1,3 +1,2 @@
/build
/src/main/assets/xposed_init /src/main/assets/xposed_init
/src/main/resources/META-INF/yukihookapi_init /src/main/resources/META-INF/yukihookapi_init

View File

@@ -1,88 +0,0 @@
import groovy.json.JsonSlurper
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'com.google.devtools.ksp'
}
android {
signingConfigs {
universal {
def dirPath = rootProject.ext.app.signingConfigs.secretConfigsDirPath
def fileName = rootProject.ext.app.signingConfigs.secretConfigsFileName
def configs = new JsonSlurper().parse(file("${dirPath}/${fileName}"))
keyAlias configs.keyAlias
keyPassword configs.keyPassword
storeFile file("${dirPath}/${configs.storeFileName}")
storePassword configs.storePassword
v1SigningEnabled true
v2SigningEnabled true
}
}
namespace 'com.fankes.miui.notify'
compileSdk rootProject.ext.android.compileSdk
defaultConfig {
applicationId 'com.fankes.miui.notify'
minSdk rootProject.ext.android.minSdk
targetSdk rootProject.ext.android.targetSdk
versionCode rootProject.ext.app.versionCode
versionName rootProject.ext.app.versionName
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
}
buildTypes {
debug {
minifyEnabled false
signingConfig signingConfigs.universal
}
release {
minifyEnabled true
shrinkResources true
zipAlignEnabled true
signingConfig signingConfigs.universal
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = '11'
freeCompilerArgs = [
'-Xno-param-assertions',
'-Xno-call-assertions',
'-Xno-receiver-assertions'
]
}
buildFeatures {
viewBinding true
}
lintOptions {
checkReleaseBuilds false
}
aaptOptions.additionalParameters '--allow-reserved-package-id', '--package-id', '0x64'
}
dependencies {
compileOnly 'de.robv.android.xposed:api:82'
implementation 'com.highcapable.yukihookapi:api:1.1.10'
ksp 'com.highcapable.yukihookapi:ksp-xposed:1.1.10'
implementation 'com.github.duanhong169:drawabletoolbox:1.0.7'
implementation "com.github.topjohnwu.libsu:core:5.0.4"
implementation 'androidx.annotation:annotation:1.6.0'
implementation 'com.squareup.okhttp3:okhttp:5.0.0-alpha.7'
implementation 'androidx.core:core-ktx:1.10.0'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.8.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
}

89
app/build.gradle.kts Normal file
View File

@@ -0,0 +1,89 @@
plugins {
autowire(libs.plugins.android.application)
autowire(libs.plugins.kotlin.android)
autowire(libs.plugins.kotlin.ksp)
}
android {
namespace = property.project.app.packageName
compileSdk = property.project.android.compileSdk
signingConfigs {
create("universal") {
keyAlias = property.project.app.signing.keyAlias
keyPassword = property.project.app.signing.keyPassword
storeFile = rootProject.file(property.project.app.signing.storeFilePath)
storePassword = property.project.app.signing.storePassword
enableV1Signing = true
enableV2Signing = true
}
}
defaultConfig {
applicationId = property.project.app.packageName
minSdk = property.project.android.minSdk
targetSdk = property.project.android.targetSdk
versionName = property.project.app.versionName
versionCode = property.project.app.versionCode
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
all { signingConfig = signingConfigs.getByName("universal") }
release {
isMinifyEnabled = true
isShrinkResources = true
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
buildFeatures {
buildConfig = true
viewBinding = true
}
lint { checkReleaseBuilds = false }
androidResources.additionalParameters += listOf("--allow-reserved-package-id", "--package-id", "0x37")
}
androidComponents {
onVariants(selector().all()) {
it.outputs.forEach { output ->
val currentType = it.buildType
// Workaround for GitHub Actions.
// Why? I don't know, but it works.
// Unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
// public inline fun CharSequence.isNotBlank(): Boolean defined in kotlin.text.
@Suppress("UNNECESSARY_SAFE_CALL", "RemoveRedundantCallsOfConversionMethods")
val currentSuffix = property.github.ci.commit.id?.let { suffix ->
// Workaround for GitHub Actions.
// Strongly transfer type to [String].
val sSuffix = suffix.toString()
if (sSuffix.isNotBlank()) "-$sSuffix" else ""
}
val currentVersion = "${output.versionName.get()}$currentSuffix(${output.versionCode.get()})"
if (output is com.android.build.api.variant.impl.VariantOutputImpl)
output.outputFileName.set("${property.project.name}-v$currentVersion-$currentType.apk")
}
}
}
dependencies {
compileOnly(de.robv.android.xposed.api)
implementation(com.highcapable.yukihookapi.api)
ksp(com.highcapable.yukihookapi.ksp.xposed)
implementation(com.highcapable.kavaref.kavaref.core)
implementation(com.highcapable.kavaref.kavaref.extension)
implementation(com.fankes.projectpromote.project.promote)
implementation(com.github.topjohnwu.libsu.core)
implementation(com.github.duanhong169.drawabletoolbox)
implementation(com.squareup.okhttp3.okhttp)
implementation(androidx.core.core.ktx)
implementation(androidx.appcompat.appcompat)
implementation(com.google.android.material.material)
implementation(androidx.constraintlayout.constraintlayout)
testImplementation(junit.junit)
androidTestImplementation(androidx.test.ext.junit)
androidTestImplementation(androidx.test.espresso.espresso.core)
}

View File

@@ -32,13 +32,15 @@
-adaptresourcefilecontents -adaptresourcefilecontents
-renamesourcefileattribute P -renamesourcefileattribute P
-keepattributes SourceFile,LineNumberTable -keepattributes SourceFile,Signature,LineNumberTable
-assumenosideeffects class kotlin.jvm.internal.Intrinsics { -assumenosideeffects class kotlin.jvm.internal.Intrinsics {
public static *** throwUninitializedProperty(...); public static *** throwUninitializedProperty(...);
public static *** throwUninitializedPropertyAccessException(...); public static *** throwUninitializedPropertyAccessException(...);
} }
-keepclassmembers class * implements androidx.viewbinding.ViewBinding { -keep class * extends android.app.Activity
-keep class * implements androidx.viewbinding.ViewBinding {
<init>();
*** inflate(android.view.LayoutInflater); *** inflate(android.view.LayoutInflater);
} }

View File

@@ -1,12 +1,18 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools">
package="com.fankes.miui.notify">
<uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" /> <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
<uses-permission
android:name="${applicationId}.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION"
tools:node="remove" />
<permission
android:name="${applicationId}.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION"
tools:node="remove" />
<application <application
android:name=".application.MNNApplication" android:name=".application.MNNApplication"
android:allowBackup="true" android:allowBackup="true"

View File

@@ -1,6 +1,6 @@
/* /*
* MIUINativeNotifyIcon - Fix the native notification bar icon function abandoned by the MIUI development team. * MIUINativeNotifyIcon - Fix the native notification bar icon function abandoned by the MIUI development team.
* Copyright (C) 2017-2023 Fankes Studio(qzmmcn@163.com) * Copyright (C) 2017 Fankes Studio(qzmmcn@163.com)
* https://github.com/fankes/MIUINativeNotifyIcon * https://github.com/fankes/MIUINativeNotifyIcon
* *
* This software is non-free but opensource software: you can redistribute it * This software is non-free but opensource software: you can redistribute it
@@ -18,7 +18,7 @@
* and eula along with this software. If not, see * and eula along with this software. If not, see
* <https://www.gnu.org/licenses/> * <https://www.gnu.org/licenses/>
* *
* This file is Created by fankes on 2022/1/24. * This file is created by fankes on 2022/1/24.
*/ */
@file:Suppress("unused") @file:Suppress("unused")

View File

@@ -1,6 +1,6 @@
/* /*
* MIUINativeNotifyIcon - Fix the native notification bar icon function abandoned by the MIUI development team. * MIUINativeNotifyIcon - Fix the native notification bar icon function abandoned by the MIUI development team.
* Copyright (C) 2017-2023 Fankes Studio(qzmmcn@163.com) * Copyright (C) 2017 Fankes Studio(qzmmcn@163.com)
* https://github.com/fankes/MIUINativeNotifyIcon * https://github.com/fankes/MIUINativeNotifyIcon
* *
* This software is non-free but opensource software: you can redistribute it * This software is non-free but opensource software: you can redistribute it
@@ -18,7 +18,7 @@
* and eula along with this software. If not, see * and eula along with this software. If not, see
* <https://www.gnu.org/licenses/> * <https://www.gnu.org/licenses/>
* *
* This file is Created by fankes on 2022/1/30. * This file is created by fankes on 2022/1/30.
*/ */
package com.fankes.miui.notify.bean package com.fankes.miui.notify.bean
@@ -47,13 +47,15 @@ data class IconDataBean(
) : Serializable { ) : Serializable {
fun toEnabledName() = ("$appName$packageName").base64 + "_enable" fun toEnabledName() = ("$appName$packageName").base64 + "_enable"
fun toEnabledAllName() = ("$appName$packageName").base64 + "_enable_all" fun toEnabledAllName() = ("$appName$packageName").base64 + "_enable_all"
override fun toString() = "{\n" + override fun toString() = """
" \"appName\": \"$appName\",\n" + {
" \"packageName\": \"$packageName\",\n" + "appName": "$appName",
" \"iconBitmap\": \"${iconBitmap.base64}\",\n" + "packageName": "$packageName",
" \"iconColor\": \"#${Integer.toHexString(iconColor)}\",\n" + "iconBitmap": "${iconBitmap.base64}",
" \"contributorName\": \"$contributorName\",\n" + "iconColor": "#${Integer.toHexString(iconColor)}",
" \"isEnabled\": $isEnabled,\n" + "contributorName": "$contributorName",
" \"isEnabledAll\": $isEnabledAll\n" + "isEnabled": $isEnabled,
" }" "isEnabledAll": $isEnabledAll
}
""".trimIndent()
} }

View File

@@ -1,6 +1,6 @@
/* /*
* MIUINativeNotifyIcon - Fix the native notification bar icon function abandoned by the MIUI development team. * MIUINativeNotifyIcon - Fix the native notification bar icon function abandoned by the MIUI development team.
* Copyright (C) 2017-2023 Fankes Studio(qzmmcn@163.com) * Copyright (C) 2017 Fankes Studio(qzmmcn@163.com)
* https://github.com/fankes/MIUINativeNotifyIcon * https://github.com/fankes/MIUINativeNotifyIcon
* *
* This software is non-free but opensource software: you can redistribute it * This software is non-free but opensource software: you can redistribute it
@@ -18,10 +18,15 @@
* and eula along with this software. If not, see * and eula along with this software. If not, see
* <https://www.gnu.org/licenses/> * <https://www.gnu.org/licenses/>
* *
* This file is Created by fankes on 2023/2/2. * This file is created by fankes on 2023/2/2.
*/ */
@file:Suppress("MemberVisibilityCanBePrivate")
package com.fankes.miui.notify.const package com.fankes.miui.notify.const
import com.fankes.miui.notify.generated.AppProperties
import com.fankes.miui.notify.wrapper.BuildConfigWrapper
/** /**
* 包名常量定义类 * 包名常量定义类
*/ */
@@ -48,3 +53,26 @@ object IconRuleSourceSyncType {
/** 自定义地址 */ /** 自定义地址 */
const val CUSTOM_URL = 3000 const val CUSTOM_URL = 3000
} }
/**
* 模块版本常量定义类
*/
object ModuleVersion {
/** 当前 GitHub 提交的 ID (CI 自动构建) */
const val GITHUB_COMMIT_ID = AppProperties.GITHUB_CI_COMMIT_ID
/** 版本名称 */
const val NAME = BuildConfigWrapper.VERSION_NAME
/** 版本号 */
const val CODE = BuildConfigWrapper.VERSION_CODE
/** 是否为 CI 自动构建版本 */
val isCiMode = GITHUB_COMMIT_ID.isNotBlank()
/** 当前版本名称后缀 */
val suffix = GITHUB_COMMIT_ID.let { if (it.isNotBlank()) "-$it" else "" }
override fun toString() = "$NAME$suffix($CODE)"
}

View File

@@ -1,6 +1,6 @@
/* /*
* MIUINativeNotifyIcon - Fix the native notification bar icon function abandoned by the MIUI development team. * MIUINativeNotifyIcon - Fix the native notification bar icon function abandoned by the MIUI development team.
* Copyright (C) 2017-2023 Fankes Studio(qzmmcn@163.com) * Copyright (C) 2017 Fankes Studio(qzmmcn@163.com)
* https://github.com/fankes/MIUINativeNotifyIcon * https://github.com/fankes/MIUINativeNotifyIcon
* *
* This software is non-free but opensource software: you can redistribute it * This software is non-free but opensource software: you can redistribute it
@@ -18,7 +18,7 @@
* and eula along with this software. If not, see * and eula along with this software. If not, see
* <https://www.gnu.org/licenses/> * <https://www.gnu.org/licenses/>
* *
* This file is Created by fankes on 2023/2/2. * This file is created by fankes on 2023/2/2.
*/ */
@file:Suppress("MemberVisibilityCanBePrivate") @file:Suppress("MemberVisibilityCanBePrivate")
@@ -26,9 +26,8 @@ package com.fankes.miui.notify.data
import android.content.Context import android.content.Context
import com.fankes.miui.notify.const.IconRuleSourceSyncType import com.fankes.miui.notify.const.IconRuleSourceSyncType
import com.highcapable.yukihookapi.YukiHookAPI
import com.highcapable.yukihookapi.hook.factory.prefs import com.highcapable.yukihookapi.hook.factory.prefs
import com.highcapable.yukihookapi.hook.log.loggerW import com.highcapable.yukihookapi.hook.log.YLog
import com.highcapable.yukihookapi.hook.param.PackageParam import com.highcapable.yukihookapi.hook.param.PackageParam
import com.highcapable.yukihookapi.hook.xposed.prefs.data.PrefsData import com.highcapable.yukihookapi.hook.xposed.prefs.data.PrefsData
@@ -40,9 +39,6 @@ object ConfigData {
/** 启用模块 */ /** 启用模块 */
val ENABLE_MODULE = PrefsData("_enable_module", true) val ENABLE_MODULE = PrefsData("_enable_module", true)
/** 启用数据缓存 */
val ENABLE_PREFS_CACHE = PrefsData("_enable_prefs_cache", true)
/** 启用模块日志 */ /** 启用模块日志 */
val ENABLE_MODULE_LOG = PrefsData("_enable_module_log", false) val ENABLE_MODULE_LOG = PrefsData("_enable_module_log", false)
@@ -64,6 +60,9 @@ object ConfigData {
/** 通知栏中的通知图标圆角程度 */ /** 通知栏中的通知图标圆角程度 */
val NOTIFY_ICON_CORNER_SIZE = PrefsData("_notify_icon_corner", 15) val NOTIFY_ICON_CORNER_SIZE = PrefsData("_notify_icon_corner", 15)
/** 替换 MIUI 样式通知栏的通知图标 */
val ENABLE_REPLACE_MIUI_STYLE_NOTIFY_ICON = PrefsData("_replace_miui_style_notify_icon", true)
/** 强制通知栏中的通知图标使用系统着色 */ /** 强制通知栏中的通知图标使用系统着色 */
val ENABLE_NOTIFY_ICON_FORCE_SYSTEM_COLOR = PrefsData("_notify_icon_force_system_color", false) val ENABLE_NOTIFY_ICON_FORCE_SYSTEM_COLOR = PrefsData("_notify_icon_force_system_color", false)
@@ -73,6 +72,9 @@ object ConfigData {
/** 启用通知图标优化 */ /** 启用通知图标优化 */
val ENABLE_NOTIFY_ICON_FIX = PrefsData("_notify_icon_fix", true) val ENABLE_NOTIFY_ICON_FIX = PrefsData("_notify_icon_fix", true)
/** 强制启用焦点通知反色 */
val ENABLE_FOCUS_NOTIFICATION_FIX = PrefsData("_enable_focus_notification_fix", false)
/** 使用占位符修补未适配的通知图标 */ /** 使用占位符修补未适配的通知图标 */
val ENABLE_NOTIFY_ICON_FIX_PLACEHOLDER = PrefsData("_notify_icon_fix_placeholder", false) val ENABLE_NOTIFY_ICON_FIX_PLACEHOLDER = PrefsData("_notify_icon_fix_placeholder", false)
@@ -110,8 +112,6 @@ object ConfigData {
is Context, is PackageParam -> this.instance = instance is Context, is PackageParam -> this.instance = instance
else -> error("Unknown type for init ConfigData") else -> error("Unknown type for init ConfigData")
} }
/** 设置是否启用数据缓存 */
YukiHookAPI.Configs.isEnablePrefsBridgeCache = isEnablePrefsCache
} }
/** /**
@@ -133,7 +133,7 @@ object ConfigData {
private fun putString(data: PrefsData<String>, value: String) { private fun putString(data: PrefsData<String>, value: String) {
when (instance) { when (instance) {
is Context -> (instance as Context).prefs().edit { put(data, value) } is Context -> (instance as Context).prefs().edit { put(data, value) }
is PackageParam -> loggerW(msg = "Not support for this method") is PackageParam -> YLog.warn("Not support for this method")
else -> error("Unknown type for put prefs data") else -> error("Unknown type for put prefs data")
} }
} }
@@ -157,7 +157,7 @@ object ConfigData {
internal fun putInt(data: PrefsData<Int>, value: Int) { internal fun putInt(data: PrefsData<Int>, value: Int) {
when (instance) { when (instance) {
is Context -> (instance as Context).prefs().edit { put(data, value) } is Context -> (instance as Context).prefs().edit { put(data, value) }
is PackageParam -> loggerW(msg = "Not support for this method") is PackageParam -> YLog.warn("Not support for this method")
else -> error("Unknown type for put prefs data") else -> error("Unknown type for put prefs data")
} }
} }
@@ -181,7 +181,7 @@ object ConfigData {
internal fun putBoolean(data: PrefsData<Boolean>, value: Boolean) { internal fun putBoolean(data: PrefsData<Boolean>, value: Boolean) {
when (instance) { when (instance) {
is Context -> (instance as Context).prefs().edit { put(data, value) } is Context -> (instance as Context).prefs().edit { put(data, value) }
is PackageParam -> loggerW(msg = "Not support for this method") is PackageParam -> YLog.warn("Not support for this method")
else -> error("Unknown type for put prefs data") else -> error("Unknown type for put prefs data")
} }
} }
@@ -196,16 +196,6 @@ object ConfigData {
putBoolean(ENABLE_MODULE, value) putBoolean(ENABLE_MODULE, value)
} }
/**
* 是否启用数据缓存
* @return [Boolean]
*/
var isEnablePrefsCache
get() = getBoolean(ENABLE_PREFS_CACHE)
set(value) {
putBoolean(ENABLE_PREFS_CACHE, value)
}
/** /**
* 是否启用模块日志 * 是否启用模块日志
* @return [Boolean] * @return [Boolean]
@@ -276,6 +266,16 @@ object ConfigData {
putInt(NOTIFY_ICON_CORNER_SIZE, value) putInt(NOTIFY_ICON_CORNER_SIZE, value)
} }
/**
* 是否替换 MIUI 样式通知栏的通知图标
* @return [Boolean]
*/
var isEnableReplaceMiuiStyleNotifyIcon
get() = getBoolean(ENABLE_REPLACE_MIUI_STYLE_NOTIFY_ICON)
set(value) {
putBoolean(ENABLE_REPLACE_MIUI_STYLE_NOTIFY_ICON, value)
}
/** /**
* 是否强制通知栏中的通知图标使用系统着色 * 是否强制通知栏中的通知图标使用系统着色
* @return [Boolean] * @return [Boolean]
@@ -306,6 +306,16 @@ object ConfigData {
putBoolean(ENABLE_NOTIFY_ICON_FIX, value) putBoolean(ENABLE_NOTIFY_ICON_FIX, value)
} }
/**
* 是否强制启用焦点通知反色
* @return [Boolean]*/
var isEnableFocusNotificationFix
get() = getBoolean(ENABLE_FOCUS_NOTIFICATION_FIX)
set(value) {
putBoolean(ENABLE_FOCUS_NOTIFICATION_FIX, value)
}
/** /**
* 是否使用占位符修补未适配的通知图标 * 是否使用占位符修补未适配的通知图标
* @return [Boolean] * @return [Boolean]

View File

@@ -1,6 +1,6 @@
/* /*
* MIUINativeNotifyIcon - Fix the native notification bar icon function abandoned by the MIUI development team. * MIUINativeNotifyIcon - Fix the native notification bar icon function abandoned by the MIUI development team.
* Copyright (C) 2017-2023 Fankes Studio(qzmmcn@163.com) * Copyright (C) 2017 Fankes Studio(qzmmcn@163.com)
* https://github.com/fankes/MIUINativeNotifyIcon * https://github.com/fankes/MIUINativeNotifyIcon
* *
* This software is non-free but opensource software: you can redistribute it * This software is non-free but opensource software: you can redistribute it
@@ -18,7 +18,7 @@
* and eula along with this software. If not, see * and eula along with this software. If not, see
* <https://www.gnu.org/licenses/> * <https://www.gnu.org/licenses/>
* *
* This file is Created by fankes on 2023/2/3. * This file is created by fankes on 2023/2/3.
*/ */
@file:Suppress("unused", "MemberVisibilityCanBePrivate") @file:Suppress("unused", "MemberVisibilityCanBePrivate")

View File

@@ -1,6 +1,6 @@
/* /*
* MIUINativeNotifyIcon - Fix the native notification bar icon function abandoned by the MIUI development team. * MIUINativeNotifyIcon - Fix the native notification bar icon function abandoned by the MIUI development team.
* Copyright (C) 2017-2023 Fankes Studio(qzmmcn@163.com) * Copyright (C) 2017 Fankes Studio(qzmmcn@163.com)
* https://github.com/fankes/MIUINativeNotifyIcon * https://github.com/fankes/MIUINativeNotifyIcon
* *
* This software is non-free but opensource software: you can redistribute it * This software is non-free but opensource software: you can redistribute it
@@ -18,7 +18,7 @@
* and eula along with this software. If not, see * and eula along with this software. If not, see
* <https://www.gnu.org/licenses/> * <https://www.gnu.org/licenses/>
* *
* This file is Created by fankes on 2023/2/4. * This file is created by fankes on 2023/2/4.
*/ */
@file:Suppress("SetTextI18n") @file:Suppress("SetTextI18n")

View File

@@ -1,6 +1,6 @@
/* /*
* MIUINativeNotifyIcon - Fix the native notification bar icon function abandoned by the MIUI development team. * MIUINativeNotifyIcon - Fix the native notification bar icon function abandoned by the MIUI development team.
* Copyright (C) 2017-2023 Fankes Studio(qzmmcn@163.com) * Copyright (C) 2017 Fankes Studio(qzmmcn@163.com)
* https://github.com/fankes/MIUINativeNotifyIcon * https://github.com/fankes/MIUINativeNotifyIcon
* *
* This software is non-free but opensource software: you can redistribute it * This software is non-free but opensource software: you can redistribute it
@@ -18,7 +18,7 @@
* and eula along with this software. If not, see * and eula along with this software. If not, see
* <https://www.gnu.org/licenses/> * <https://www.gnu.org/licenses/>
* *
* This file is Created by fankes on 2022/2/15. * This file is created by fankes on 2022/2/15.
*/ */
package com.fankes.miui.notify.hook package com.fankes.miui.notify.hook
@@ -26,16 +26,16 @@ import com.fankes.miui.notify.const.PackageName
import com.fankes.miui.notify.data.ConfigData import com.fankes.miui.notify.data.ConfigData
import com.fankes.miui.notify.hook.entity.SystemUIHooker import com.fankes.miui.notify.hook.entity.SystemUIHooker
import com.fankes.miui.notify.utils.factory.isLowerAndroidP import com.fankes.miui.notify.utils.factory.isLowerAndroidP
import com.fankes.miui.notify.utils.factory.isNotMIUI import com.fankes.miui.notify.utils.factory.isNotMiSystem
import com.fankes.miui.notify.utils.factory.isNotSupportMiuiVersion import com.fankes.miui.notify.utils.factory.isNotSupportMiSystemVersion
import com.fankes.miui.notify.utils.factory.miuiVersion import com.fankes.miui.notify.utils.factory.miSystemVersion
import com.highcapable.yukihookapi.annotation.xposed.InjectYukiHookWithXposed import com.highcapable.yukihookapi.annotation.xposed.InjectYukiHookWithXposed
import com.highcapable.yukihookapi.hook.factory.configs import com.highcapable.yukihookapi.hook.factory.configs
import com.highcapable.yukihookapi.hook.factory.encase import com.highcapable.yukihookapi.hook.factory.encase
import com.highcapable.yukihookapi.hook.log.loggerW import com.highcapable.yukihookapi.hook.log.YLog
import com.highcapable.yukihookapi.hook.xposed.proxy.IYukiHookXposedInit import com.highcapable.yukihookapi.hook.xposed.proxy.IYukiHookXposedInit
@InjectYukiHookWithXposed(isUsingResourcesHook = false) @InjectYukiHookWithXposed
object HookEntry : IYukiHookXposedInit { object HookEntry : IYukiHookXposedInit {
override fun onInit() = configs { override fun onInit() = configs {
@@ -51,10 +51,10 @@ object HookEntry : IYukiHookXposedInit {
loadApp(PackageName.SYSTEMUI) { loadApp(PackageName.SYSTEMUI) {
ConfigData.init(instance = this) ConfigData.init(instance = this)
when { when {
isNotMIUI -> loggerW(msg = "Aborted Hook -> This System is not MIUI") isNotMiSystem -> YLog.warn("Aborted Hook -> This System is not MIUI or HyperOS")
isLowerAndroidP -> loggerW(msg = "Aborted Hook -> This System is lower than Android P") isLowerAndroidP -> YLog.warn("Aborted Hook -> This System is lower than Android P")
isNotSupportMiuiVersion -> loggerW(msg = "Aborted Hook -> This MIUI Version ${miuiVersion.ifBlank { "unknown" }} not supported") isNotSupportMiSystemVersion -> YLog.warn("Aborted Hook -> This System Version ${miSystemVersion.ifBlank { "unknown" }} not supported")
ConfigData.isEnableModule.not() -> loggerW(msg = "Aborted Hook -> Hook Closed") ConfigData.isEnableModule.not() -> YLog.warn("Aborted Hook -> Hook Closed")
else -> loadHooker(SystemUIHooker) else -> loadHooker(SystemUIHooker)
} }
} }

View File

@@ -1,6 +1,6 @@
/* /*
* MIUINativeNotifyIcon - Fix the native notification bar icon function abandoned by the MIUI development team. * MIUINativeNotifyIcon - Fix the native notification bar icon function abandoned by the MIUI development team.
* Copyright (C) 2017-2023 Fankes Studio(qzmmcn@163.com) * Copyright (C) 2017 Fankes Studio(qzmmcn@163.com)
* https://github.com/fankes/MIUINativeNotifyIcon * https://github.com/fankes/MIUINativeNotifyIcon
* *
* This software is non-free but opensource software: you can redistribute it * This software is non-free but opensource software: you can redistribute it
@@ -18,7 +18,7 @@
* and eula along with this software. If not, see * and eula along with this software. If not, see
* <https://www.gnu.org/licenses/> * <https://www.gnu.org/licenses/>
* *
* This file is Created by fankes on 2022/1/24. * This file is created by fankes on 2022/1/24.
*/ */
@file:Suppress("MemberVisibilityCanBePrivate") @file:Suppress("MemberVisibilityCanBePrivate")
@@ -28,7 +28,11 @@ import android.content.Context
import android.graphics.Color import android.graphics.Color
import com.fankes.miui.notify.bean.IconDataBean import com.fankes.miui.notify.bean.IconDataBean
import com.fankes.miui.notify.data.ConfigData import com.fankes.miui.notify.data.ConfigData
import com.fankes.miui.notify.utils.factory.* import com.fankes.miui.notify.utils.factory.bitmap
import com.fankes.miui.notify.utils.factory.safeOf
import com.fankes.miui.notify.utils.factory.safeOfNan
import com.fankes.miui.notify.utils.factory.safeOfNull
import com.fankes.miui.notify.utils.factory.snake
import com.highcapable.yukihookapi.hook.factory.prefs import com.highcapable.yukihookapi.hook.factory.prefs
import com.highcapable.yukihookapi.hook.param.PackageParam import com.highcapable.yukihookapi.hook.param.PackageParam
import org.json.JSONArray import org.json.JSONArray
@@ -47,7 +51,7 @@ class IconPackParams(private val context: Context? = null, private val param: Pa
* 已存储的 JSON 数据 * 已存储的 JSON 数据
* @return [String] * @return [String]
*/ */
internal val storageDataJson get() = (context?.prefs() ?: param?.prefs)?.direct()?.get(ConfigData.NOTIFY_ICONS_DATA) internal val storageDataJson get() = (context?.prefs() ?: param?.prefs)?.get(ConfigData.NOTIFY_ICONS_DATA)
/** /**
* 获取图标数据 * 获取图标数据

View File

@@ -1,6 +1,6 @@
/* /*
* MIUINativeNotifyIcon - Fix the native notification bar icon function abandoned by the MIUI development team. * MIUINativeNotifyIcon - Fix the native notification bar icon function abandoned by the MIUI development team.
* Copyright (C) 2017-2023 Fankes Studio(qzmmcn@163.com) * Copyright (C) 2017 Fankes Studio(qzmmcn@163.com)
* https://github.com/fankes/MIUINativeNotifyIcon * https://github.com/fankes/MIUINativeNotifyIcon
* *
* This software is non-free but opensource software: you can redistribute it * This software is non-free but opensource software: you can redistribute it
@@ -18,7 +18,7 @@
* and eula along with this software. If not, see * and eula along with this software. If not, see
* <https://www.gnu.org/licenses/> * <https://www.gnu.org/licenses/>
* *
* This file is Created by fankes on 2022/2/15. * This file is created by fankes on 2022/2/15.
* This file is Modified by fankes on 2023/2/3. * This file is Modified by fankes on 2023/2/3.
*/ */
package com.fankes.miui.notify.params.factory package com.fankes.miui.notify.params.factory

View File

@@ -1,6 +1,6 @@
/* /*
* MIUINativeNotifyIcon - Fix the native notification bar icon function abandoned by the MIUI development team. * MIUINativeNotifyIcon - Fix the native notification bar icon function abandoned by the MIUI development team.
* Copyright (C) 2017-2023 Fankes Studio(qzmmcn@163.com) * Copyright (C) 2017 Fankes Studio(qzmmcn@163.com)
* https://github.com/fankes/MIUINativeNotifyIcon * https://github.com/fankes/MIUINativeNotifyIcon
* *
* This software is non-free but opensource software: you can redistribute it * This software is non-free but opensource software: you can redistribute it
@@ -18,7 +18,7 @@
* and eula along with this software. If not, see * and eula along with this software. If not, see
* <https://www.gnu.org/licenses/> * <https://www.gnu.org/licenses/>
* *
* This file is Created by fankes on 2022/3/26. * This file is created by fankes on 2022/3/26.
*/ */
package com.fankes.miui.notify.service package com.fankes.miui.notify.service

View File

@@ -1,6 +1,6 @@
/* /*
* MIUINativeNotifyIcon - Fix the native notification bar icon function abandoned by the MIUI development team. * MIUINativeNotifyIcon - Fix the native notification bar icon function abandoned by the MIUI development team.
* Copyright (C) 2017-2023 Fankes Studio(qzmmcn@163.com) * Copyright (C) 2017 Fankes Studio(qzmmcn@163.com)
* https://github.com/fankes/MIUINativeNotifyIcon * https://github.com/fankes/MIUINativeNotifyIcon
* *
* This software is non-free but opensource software: you can redistribute it * This software is non-free but opensource software: you can redistribute it
@@ -18,7 +18,7 @@
* and eula along with this software. If not, see * and eula along with this software. If not, see
* <https://www.gnu.org/licenses/> * <https://www.gnu.org/licenses/>
* *
* This file is Created by fankes on 2022/1/30. * This file is created by fankes on 2022/1/30.
*/ */
@file:Suppress("SetTextI18n", "InflateParams") @file:Suppress("SetTextI18n", "InflateParams")
@@ -37,7 +37,16 @@ import com.fankes.miui.notify.params.factory.isAppNotifyHookOf
import com.fankes.miui.notify.params.factory.putAppNotifyHookAllOf import com.fankes.miui.notify.params.factory.putAppNotifyHookAllOf
import com.fankes.miui.notify.params.factory.putAppNotifyHookOf import com.fankes.miui.notify.params.factory.putAppNotifyHookOf
import com.fankes.miui.notify.ui.activity.base.BaseActivity import com.fankes.miui.notify.ui.activity.base.BaseActivity
import com.fankes.miui.notify.utils.factory.* import com.fankes.miui.notify.utils.factory.addOnBackPressedEvent
import com.fankes.miui.notify.utils.factory.bindAdapter
import com.fankes.miui.notify.utils.factory.callOnBackPressed
import com.fankes.miui.notify.utils.factory.colorOf
import com.fankes.miui.notify.utils.factory.copyToClipboard
import com.fankes.miui.notify.utils.factory.navigate
import com.fankes.miui.notify.utils.factory.openBrowser
import com.fankes.miui.notify.utils.factory.showDialog
import com.fankes.miui.notify.utils.factory.snake
import com.fankes.miui.notify.utils.factory.toast
import com.fankes.miui.notify.utils.tool.IconRuleManagerTool import com.fankes.miui.notify.utils.tool.IconRuleManagerTool
import com.fankes.miui.notify.utils.tool.SystemUITool import com.fankes.miui.notify.utils.tool.SystemUITool
import com.highcapable.yukihookapi.YukiHookAPI import com.highcapable.yukihookapi.YukiHookAPI
@@ -145,8 +154,8 @@ class ConfigureActivity : BaseActivity<ActivityConfigBinding>() {
if (b) showDialog { if (b) showDialog {
title = "全部替换" title = "全部替换"
msg = "此功能仅针对严重不遵守规范的 APP 通知图标才需要开启例如APP 推送通知后无法识别出现的黑白块图标。\n\n" + msg = "此功能仅针对严重不遵守规范的 APP 通知图标才需要开启例如APP 推送通知后无法识别出现的黑白块图标。\n\n" +
"此功能在一般情况下请保持关闭并跟随在线规则的配置,并不要随意改变此配置," + "此功能在一般情况下请保持关闭并跟随在线规则的配置,并不要随意改变此配置," +
"开启后 APP 的通知图标可能会被规则破坏,你确定还要开启吗?" "开启后 APP 的通知图标可能会被规则破坏,你确定还要开启吗?"
confirmButton { saveState() } confirmButton { saveState() }
cancelButton { btn.isChecked = btn.isChecked.not() } cancelButton { btn.isChecked = btn.isChecked.not() }
noCancelable() noCancelable()
@@ -188,10 +197,10 @@ class ConfigureActivity : BaseActivity<ActivityConfigBinding>() {
val pkgName = intent?.getStringExtra("pkgName") ?: "" val pkgName = intent?.getStringExtra("pkgName") ?: ""
title = "新安装应用通知图标适配" title = "新安装应用通知图标适配"
msg = "你已安装 $appName($pkgName)\n\n" + msg = "你已安装 $appName($pkgName)\n\n" +
"此应用未在通知优化名单中发现适配数据,若此应用发送的通知为彩色图标," + "此应用未在通知优化名单中发现适配数据,若此应用发送的通知为彩色图标," +
"可随时点击本页面下方的“贡献通知图标优化名单”按钮提交贡献或请求适配。\n\n" + "可随时点击本页面下方的“贡献通知图标优化名单”按钮提交贡献或请求适配。\n\n" +
"若你已知晓此应用会遵守原生通知图标规范,可忽略此提示。\n\n" + "若你已知晓此应用会遵守原生通知图标规范,可忽略此提示。\n\n" +
"你可以现在立即同步适配列表,以获取最新的适配数据。" "你可以现在立即同步适配列表,以获取最新的适配数据。"
confirmButton(text = "同步列表") { onStartRefresh() } confirmButton(text = "同步列表") { onStartRefresh() }
cancelButton(text = "复制名称+包名") { copyToClipboard(content = "$appName($pkgName)") } cancelButton(text = "复制名称+包名") { copyToClipboard(content = "$appName($pkgName)") }
neutralButton(text = "取消") neutralButton(text = "取消")
@@ -250,7 +259,7 @@ class ConfigureActivity : BaseActivity<ActivityConfigBinding>() {
onChanged?.invoke() onChanged?.invoke()
binding.configTitleCountText.text = binding.configTitleCountText.text =
if (filterText.isBlank()) "已适配 ${iconDatas.size} 个 APP 的通知图标" if (filterText.isBlank()) "已适配 ${iconDatas.size} 个 APP 的通知图标"
else "${filterText}” 匹配到 ${iconDatas.size} 个结果" else "$filterText” 匹配到 ${iconDatas.size} 个结果"
binding.configListNoDataView.apply { binding.configListNoDataView.apply {
text = if (iconAllDatas.isEmpty()) "噫,竟然什么都没有~\n请点击右上角同步按钮获取云端数据" else "噫,竟然什么都没找到~" text = if (iconAllDatas.isEmpty()) "噫,竟然什么都没有~\n请点击右上角同步按钮获取云端数据" else "噫,竟然什么都没找到~"
isVisible = iconDatas.isEmpty() isVisible = iconDatas.isEmpty()

View File

@@ -1,6 +1,6 @@
/* /*
* MIUINativeNotifyIcon - Fix the native notification bar icon function abandoned by the MIUI development team. * MIUINativeNotifyIcon - Fix the native notification bar icon function abandoned by the MIUI development team.
* Copyright (C) 2017-2023 Fankes Studio(qzmmcn@163.com) * Copyright (C) 2017 Fankes Studio(qzmmcn@163.com)
* https://github.com/fankes/MIUINativeNotifyIcon * https://github.com/fankes/MIUINativeNotifyIcon
* *
* This software is non-free but opensource software: you can redistribute it * This software is non-free but opensource software: you can redistribute it
@@ -18,7 +18,7 @@
* and eula along with this software. If not, see * and eula along with this software. If not, see
* <https://www.gnu.org/licenses/> * <https://www.gnu.org/licenses/>
* *
* This file is Created by fankes on 2022/1/24. * This file is created by fankes on 2022/1/24.
*/ */
@file:Suppress("SetTextI18n") @file:Suppress("SetTextI18n")
@@ -26,19 +26,36 @@ package com.fankes.miui.notify.ui.activity
import androidx.core.view.isGone import androidx.core.view.isGone
import androidx.core.view.isVisible import androidx.core.view.isVisible
import com.fankes.miui.notify.BuildConfig
import com.fankes.miui.notify.R import com.fankes.miui.notify.R
import com.fankes.miui.notify.const.ModuleVersion
import com.fankes.miui.notify.data.ConfigData import com.fankes.miui.notify.data.ConfigData
import com.fankes.miui.notify.data.factory.bind import com.fankes.miui.notify.data.factory.bind
import com.fankes.miui.notify.databinding.ActivityMainBinding import com.fankes.miui.notify.databinding.ActivityMainBinding
import com.fankes.miui.notify.databinding.DiaStatusIconCountBinding import com.fankes.miui.notify.databinding.DiaStatusIconCountBinding
import com.fankes.miui.notify.params.IconPackParams import com.fankes.miui.notify.params.IconPackParams
import com.fankes.miui.notify.ui.activity.base.BaseActivity import com.fankes.miui.notify.ui.activity.base.BaseActivity
import com.fankes.miui.notify.utils.factory.* import com.fankes.miui.notify.utils.factory.androidVersionCodeName
import com.fankes.miui.notify.utils.factory.hideOrShowLauncherIcon
import com.fankes.miui.notify.utils.factory.isLauncherIconShowing
import com.fankes.miui.notify.utils.factory.isLowerAndroidP
import com.fankes.miui.notify.utils.factory.isLowerAndroidR
import com.fankes.miui.notify.utils.factory.isMIOS
import com.fankes.miui.notify.utils.factory.isNotMiSystem
import com.fankes.miui.notify.utils.factory.isNotNoificationEnabled
import com.fankes.miui.notify.utils.factory.isNotSupportMiSystemVersion
import com.fankes.miui.notify.utils.factory.miSystemVersion
import com.fankes.miui.notify.utils.factory.miuiVersionCode
import com.fankes.miui.notify.utils.factory.navigate
import com.fankes.miui.notify.utils.factory.openBrowser
import com.fankes.miui.notify.utils.factory.openNotifySetting
import com.fankes.miui.notify.utils.factory.showDialog
import com.fankes.miui.notify.utils.factory.showTimePicker
import com.fankes.miui.notify.utils.factory.snake
import com.fankes.miui.notify.utils.factory.systemFullVersion
import com.fankes.miui.notify.utils.tool.GithubReleaseTool import com.fankes.miui.notify.utils.tool.GithubReleaseTool
import com.fankes.miui.notify.utils.tool.I18nWarnTool import com.fankes.miui.notify.utils.tool.I18nWarnTool
import com.fankes.miui.notify.utils.tool.SystemUITool import com.fankes.miui.notify.utils.tool.SystemUITool
import com.fankes.miui.notify.utils.tool.YukiPromoteTool import com.fankes.projectpromote.ProjectPromote
import com.highcapable.yukihookapi.YukiHookAPI import com.highcapable.yukihookapi.YukiHookAPI
class MainActivity : BaseActivity<ActivityMainBinding>() { class MainActivity : BaseActivity<ActivityMainBinding>() {
@@ -53,19 +70,13 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
/** 模块是否有效 */ /** 模块是否有效 */
internal var isModuleValied = false internal var isModuleValied = false
/** 模块版本 */
private const val moduleVersion = BuildConfig.VERSION_NAME
/** 预发布的版本标识 */
private const val pendingFlag = ""
} }
override fun onCreate() { override fun onCreate() {
/** 设置可用性 */ /** 设置可用性 */
isActivityLive = true isActivityLive = true
/** 检查更新 */ /** 检查更新 */
GithubReleaseTool.checkingForUpdate(context = this, moduleVersion) { version, function -> GithubReleaseTool.checkingForUpdate(context = this, ModuleVersion.NAME) { version, function ->
binding.mainTextReleaseVersion.apply { binding.mainTextReleaseVersion.apply {
text = "点击更新 $version" text = "点击更新 $version"
isVisible = true isVisible = true
@@ -73,11 +84,11 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
} }
} }
when { when {
/** 判断是否为 MIUI 系统 */ /** 判断是否为小米系统 */
isNotMIUI -> isNotMiSystem ->
showDialog { showDialog {
title = "不是 MIUI 系统" title = "不是 MIUI 或 HyperOS 系统"
msg = "此模块专为 MIUI 系统打造,当前无法识别你的系统为 MIUI,所以模块无法工作。" msg = "此模块专为 MIUI、HyperOS 系统打造,当前无法识别你的系统为其中任意之一,所以模块无法工作。"
confirmButton(text = "查看支持的模块") { confirmButton(text = "查看支持的模块") {
openBrowser(url = "https://github.com/fankes/AndroidNotifyIconAdapt") openBrowser(url = "https://github.com/fankes/AndroidNotifyIconAdapt")
finish() finish()
@@ -90,7 +101,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
showDialog { showDialog {
title = "Android 系统版本过低" title = "Android 系统版本过低"
msg = "此模块最低支持基于 Android 9 的 MIUI 系统,你的系统版本过低不再进行适配。\n\n" + msg = "此模块最低支持基于 Android 9 的 MIUI 系统,你的系统版本过低不再进行适配。\n\n" +
"若有其它疑问,你可以点击下方按钮前往项目地址进行反馈。" "若有其它疑问,你可以点击下方按钮前往项目地址进行反馈。"
confirmButton(text = "前往项目地址") { confirmButton(text = "前往项目地址") {
openProjectUrl() openProjectUrl()
finish() finish()
@@ -98,14 +109,14 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
cancelButton(text = "退出") { finish() } cancelButton(text = "退出") { finish() }
noCancelable() noCancelable()
} }
/** 判断支持的 MIUI 版本 */ /** 判断支持的系统版本 */
isNotSupportMiuiVersion -> isNotSupportMiSystemVersion ->
showDialog { showDialog {
title = "不支持的 MIUI 版本" title = "不支持的系统版本"
msg = (if (miuiVersion.isNotBlank()) msg = (if (miSystemVersion.isNotBlank())
"此模块目前支持 MIUI 11~14 系统,你的 MIUI 版本为 ${miuiVersion},暂不支持。\n\n" + "此模块目前支持 MIUI 11~14 和 HyperOS 1.0~2.0 系统,你的系统版本为 $miSystemVersion,暂不支持。\n\n" +
"如果你的 MIUI 版本识别有误,请检查是否有相关插件修改了系统版本。\n\n" "如果你的系统版本识别有误,请检查是否有相关插件修改了系统版本。\n\n"
else "无法获取 MIUI 版本,请检查你是否修改了系统参数或使用非官方系统。\n\n") + "若有其它疑问,你可以点击下方按钮前往项目地址进行反馈。" else "无法获取系统版本,请检查你是否修改了系统参数或使用非官方系统。\n\n") + "若有其它疑问,你可以点击下方按钮前往项目地址进行反馈。"
confirmButton(text = "前往项目地址") { confirmButton(text = "前往项目地址") {
openProjectUrl() openProjectUrl()
finish() finish()
@@ -119,7 +130,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
showDialog { showDialog {
title = "配置通知图标优化名单" title = "配置通知图标优化名单"
msg = "模块需要获取在线规则以更新“通知图标优化名单”,它现在是空的,这看起来是你第一次使用模块,请首先进行配置才可以使用相关功能。\n" + msg = "模块需要获取在线规则以更新“通知图标优化名单”,它现在是空的,这看起来是你第一次使用模块,请首先进行配置才可以使用相关功能。\n" +
"你可以随时在本页面下方找到“配置通知图标优化名单”手动前往。" "你可以随时在本页面下方找到“配置通知图标优化名单”手动前往。"
confirmButton(text = "前往") { navigate<ConfigureActivity>() } confirmButton(text = "前往") { navigate<ConfigureActivity>() }
cancelButton() cancelButton()
noCancelable() noCancelable()
@@ -136,38 +147,53 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
showDialog { showDialog {
title = "Android 版本过低" title = "Android 版本过低"
msg = "你当前使用的 Android 版本过低,模块的部分功能可能会发生问题," + msg = "你当前使用的 Android 版本过低,模块的部分功能可能会发生问题," +
"由于设备有限,无法逐一调试,若有好的建议可向我们贡献代码提交适配请求,建议在 Android 11 及以上版本中使用效果最佳。" "由于设备有限,无法逐一调试,若有好的建议可向我们贡献代码提交适配请求,建议在 Android 11 及以上版本中使用效果最佳。"
confirmButton(text = "我知道了") { ConfigData.isIgnoredAndroidVersionToLow = true } confirmButton(text = "我知道了") { ConfigData.isIgnoredAndroidVersionToLow = true }
noCancelable() noCancelable()
} }
/** 推广、恰饭 */ /** 推广、恰饭 */
YukiPromoteTool.promote(context = this) ProjectPromote.show(activity = this, ModuleVersion.toString())
} }
else -> else ->
showDialog { showDialog {
title = "模块没有激活" title = "模块没有激活"
msg = "检测到模块没有激活,模块需要 Xposed 环境依赖," + msg = "检测到模块没有激活,模块需要 Xposed 环境依赖," +
"同时需要系统拥有 Root 权限," + "同时需要系统拥有 Root 权限," +
"请自行查看本页面使用帮助与说明第二条。\n" + "请自行查看本页面使用帮助与说明第二条。\n" +
"由于需要修改系统应用达到效果,模块不支持太极阴、应用转生。" "由于需要修改系统应用达到效果,模块不支持太极阴、应用转生。"
confirmButton(text = "我知道了") confirmButton(text = "我知道了")
noCancelable() noCancelable()
} }
} }
I18nWarnTool.checkingOrShowing(context = this) I18nWarnTool.checkingOrShowing(context = this)
binding.mainTextVersion.text = "模块版本:$moduleVersion $pendingFlag" if (isMIOS) binding.mainTitle.text = binding.mainTitle.text.toString().replace("MIUI", "HyperOS")
binding.mainTextMiuiVersion.text = "系统版本:[$androidVersionCodeName] $miuiFullVersion" binding.mainTextVersion.text = "模块版本:${ModuleVersion.NAME}"
/** 设置 CI 自动构建标识 */
if (ModuleVersion.isCiMode)
binding.mainTextReleaseVersion.apply {
text = "CI ${ModuleVersion.GITHUB_COMMIT_ID}"
isVisible = true
setOnClickListener {
showDialog {
title = "CI 自动构建说明"
msg = """
你正在使用的是 CI 自动构建版本Commit ID 为 ${ModuleVersion.GITHUB_COMMIT_ID}
它是由代码提交后自动触发并构建、自动编译发布的,并未经任何稳定性测试,使用风险自负。
""".trimIndent()
confirmButton(text = "我知道了")
noCancelable()
}
}
}
binding.mainTextMiuiVersion.text = "系统版本:[$androidVersionCodeName] $systemFullVersion"
binding.warnSCountDisTip.isGone = miuiVersionCode > 12.5 binding.warnSCountDisTip.isGone = miuiVersionCode > 12.5
binding.warnMiuiNotifyStyleTip.isGone = miuiVersionCode > 11 binding.warnMiuiNotifyStyleTip.isGone = miuiVersionCode > 11
binding.statusIconCountText.text = ConfigData.liftedStatusIconCount.toString() binding.statusIconCountText.text = ConfigData.liftedStatusIconCount.toString()
binding.notifyIconAutoSyncText.text = ConfigData.notifyIconFixAutoTime binding.notifyIconAutoSyncText.text = ConfigData.notifyIconFixAutoTime
binding.moduleEnableSwitch.bind(ConfigData.ENABLE_MODULE) { binding.moduleEnableSwitch.bind(ConfigData.ENABLE_MODULE) {
onInitialize { onInitialize {
binding.moduleEnableLogSwitch.isVisible = it binding.moduleEnableLogItem.isVisible = it
binding.moduleEnableLogText.isVisible = it
binding.modulePrefsCacheEnableSwitch.isVisible = it
binding.modulePrefsCacheEnableText.isVisible = it
binding.expAllDebugLogButton.isVisible = it && ConfigData.isEnableModuleLog
binding.colorIconHookItem.isVisible = it binding.colorIconHookItem.isVisible = it
binding.statusIconCountItem.isVisible = isLowerAndroidR.not() && it binding.statusIconCountItem.isVisible = isLowerAndroidR.not() && it
binding.notifyStyleConfigItem.isVisible = it binding.notifyStyleConfigItem.isVisible = it
@@ -179,11 +205,8 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
SystemUITool.showNeedRestartSnake(context = this@MainActivity) SystemUITool.showNeedRestartSnake(context = this@MainActivity)
} }
} }
binding.modulePrefsCacheEnableSwitch.bind(ConfigData.ENABLE_PREFS_CACHE) {
onChanged { SystemUITool.showNeedRestartSnake(context = this@MainActivity) }
}
binding.moduleEnableLogSwitch.bind(ConfigData.ENABLE_MODULE_LOG) { binding.moduleEnableLogSwitch.bind(ConfigData.ENABLE_MODULE_LOG) {
onInitialize { binding.expAllDebugLogButton.isVisible = it && ConfigData.isEnableModule } onInitialize { binding.expAllDebugLogButton.isVisible = it }
onChanged { onChanged {
reinitialize() reinitialize()
SystemUITool.refreshSystemUI(context = this@MainActivity, isRefreshCacheOnly = true) SystemUITool.refreshSystemUI(context = this@MainActivity, isRefreshCacheOnly = true)
@@ -207,14 +230,20 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
if (it) showDialog { if (it) showDialog {
title = "启用兼容模式" title = "启用兼容模式"
msg = "启用兼容模式可修复部分系统版本可能出现无法判定通知图标反色的问题," + msg = "启用兼容模式可修复部分系统版本可能出现无法判定通知图标反色的问题," +
"但是这也可能会导致新的问题,一般情况下不建议开启,确定要继续吗?\n\n" + "但是这也可能会导致新的问题,一般情况下不建议开启,确定要继续吗?\n\n" +
"如果系统界面刷新后通知图标颜色发生错误,请尝试重启一次系统界面。" "如果系统界面刷新后通知图标颜色发生错误,请尝试重启一次系统界面。"
confirmButton { applyChangesAndRefresh() } confirmButton { applyChangesAndRefresh() }
cancelButton { cancelChanges() } cancelButton { cancelChanges() }
noCancelable() noCancelable()
} else applyChangesAndRefresh() } else applyChangesAndRefresh()
} }
} }
binding.miuiNotifyIconReplacementSwitch.bind(ConfigData.ENABLE_REPLACE_MIUI_STYLE_NOTIFY_ICON) {
onChanged { SystemUITool.refreshSystemUI(context = this@MainActivity) }
}
binding.miuiFocusNotifyIconFixSwitch.bind(ConfigData.ENABLE_FOCUS_NOTIFICATION_FIX) {
onChanged { SystemUITool.refreshSystemUI(context = this@MainActivity) }
}
binding.notifyIconForceSystemColorSwitch.bind(ConfigData.ENABLE_NOTIFY_ICON_FORCE_SYSTEM_COLOR) { binding.notifyIconForceSystemColorSwitch.bind(ConfigData.ENABLE_NOTIFY_ICON_FORCE_SYSTEM_COLOR) {
isAutoApplyChanges = false isAutoApplyChanges = false
onChanged { onChanged {
@@ -226,7 +255,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
if (it) showDialog { if (it) showDialog {
title = "破坏性功能警告" title = "破坏性功能警告"
msg = "开启这个功能后,任何通知栏中的通知图标都会忽略图标自身的着色属性,全部使用系统默认颜色 (系统提供的统一色调) 着色。\n\n" + msg = "开启这个功能后,任何通知栏中的通知图标都会忽略图标自身的着色属性,全部使用系统默认颜色 (系统提供的统一色调) 着色。\n\n" +
"此功能仅面向一些追求图标美观度的用户,我们不推荐开启这个功能,且发生任何 BUG 都不会去修复,仍然继续开启吗?" "此功能仅面向一些追求图标美观度的用户,我们不推荐开启这个功能,且发生任何 BUG 都不会去修复,仍然继续开启吗?"
confirmButton { applyChangesAndRefresh() } confirmButton { applyChangesAndRefresh() }
cancelButton { cancelChanges() } cancelButton { cancelChanges() }
noCancelable() noCancelable()
@@ -240,6 +269,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
binding.notifyIconCustomCornerItem, binding.notifyIconCustomCornerItem,
binding.notifyIconForceSystemColorItem binding.notifyIconForceSystemColorItem
).forEach { e -> e.isVisible = isLowerAndroidR.not() && it.not() } ).forEach { e -> e.isVisible = isLowerAndroidR.not() && it.not() }
binding.miuiNotifyIconReplacementItem.isVisible = it.not()
} }
onChanged { onChanged {
/** 应用更改并刷新系统界面 */ /** 应用更改并刷新系统界面 */
@@ -250,8 +280,8 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
if (it) showDialog { if (it) showDialog {
title = "破坏性功能警告" title = "破坏性功能警告"
msg = "开启这个功能后,任何通知栏中的通知图标都会被强制替换为当前推送通知的 APP 的图标," + msg = "开启这个功能后,任何通知栏中的通知图标都会被强制替换为当前推送通知的 APP 的图标," +
"某些系统级别的 APP 通知图标可能会显示异常或发生图标丢失。\n\n" + "某些系统级别的 APP 通知图标可能会显示异常或发生图标丢失。\n\n" +
"此功能仅面向一些追求图标美观度的用户,我们不推荐开启这个功能,且发生任何 BUG 都不会去修复,仍然继续开启吗?" "此功能仅面向一些追求图标美观度的用户,我们不推荐开启这个功能,且发生任何 BUG 都不会去修复,仍然继续开启吗?"
confirmButton { applyChangesAndRefresh() } confirmButton { applyChangesAndRefresh() }
cancelButton { cancelChanges() } cancelButton { cancelChanges() }
noCancelable() noCancelable()
@@ -281,9 +311,9 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
if (it) showDialog { if (it) showDialog {
title = "注意" title = "注意"
msg = "开启这个功能后,当发现未适配的彩色通知图标时," + msg = "开启这个功能后,当发现未适配的彩色通知图标时," +
"状态栏中显示的通知图标将会使用预置的占位符图标进行修补," + "状态栏中显示的通知图标将会使用预置的占位符图标进行修补," +
"通知栏中显示的通知图标保持原始图标不变。\n\n" + "通知栏中显示的通知图标保持原始图标不变。\n\n" +
"此功能的作用仅为临时修复破坏规范的通知图标,仍然继续开启吗?" "此功能的作用仅为临时修复破坏规范的通知图标,仍然继续开启吗?"
confirmButton { applyChangesAndRefresh() } confirmButton { applyChangesAndRefresh() }
cancelButton { cancelChanges() } cancelButton { cancelChanges() }
noCancelable() noCancelable()
@@ -328,7 +358,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
confirmButton { confirmButton {
when { when {
(runCatching { binding.iconCountEdit.text.toString().toInt() }.getOrNull() ?: -1) (runCatching { binding.iconCountEdit.text.toString().toInt() }.getOrNull() ?: -1)
!in 0..100 -> snake(msg = "请输入有效数值") !in 0..100 -> snake(msg = "请输入有效数值")
binding.iconCountEdit.text.toString().isNotBlank() -> runCatching { binding.iconCountEdit.text.toString().isNotBlank() -> runCatching {
ConfigData.liftedStatusIconCount = binding.iconCountEdit.text.toString().trim().toInt() ConfigData.liftedStatusIconCount = binding.iconCountEdit.text.toString().trim().toInt()
this@MainActivity.binding.statusIconCountText.text = ConfigData.liftedStatusIconCount.toString() this@MainActivity.binding.statusIconCountText.text = ConfigData.liftedStatusIconCount.toString()
@@ -346,11 +376,11 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
showDialog { showDialog {
title = "每天 $it 自动更新" title = "每天 $it 自动更新"
msg = "设置保存后将在每天 $it 自动同步名单到最新云端数据,若数据已是最新则不会显示任何提示,否则会发送一条通知。\n\n" + msg = "设置保存后将在每天 $it 自动同步名单到最新云端数据,若数据已是最新则不会显示任何提示,否则会发送一条通知。\n\n" +
"请确保:\n\n" + "请确保:\n\n" +
"1.模块没有被禁止前台以及后台联网权限\n" + "1.模块没有被禁止前台以及后台联网权限\n" +
"2.模块没有被禁止被其它 APP 关联唤醒\n" + "2.模块没有被禁止被其它 APP 关联唤醒\n" +
"3.模块的系统通知权限已开启\n\n" + "3.模块的系统通知权限已开启\n\n" +
"模块无需保持在后台运行,到达同步时间后会自动启动,如果到达时间后模块正在运行则会自动取消本次计划任务。" "模块无需保持在后台运行,到达同步时间后会自动启动,如果到达时间后模块正在运行则会自动取消本次计划任务。"
confirmButton(text = "保存设置") { confirmButton(text = "保存设置") {
ConfigData.notifyIconFixAutoTime = it ConfigData.notifyIconFixAutoTime = it
this@MainActivity.binding.notifyIconAutoSyncText.text = it this@MainActivity.binding.notifyIconAutoSyncText.text = it
@@ -389,7 +419,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
binding.mainLinStatus.setBackgroundResource( binding.mainLinStatus.setBackgroundResource(
when { when {
YukiHookAPI.Status.isXposedModuleActive && YukiHookAPI.Status.isXposedModuleActive &&
(isModuleRegular.not() || isModuleValied.not() || ConfigData.isEnableModule.not()) -> R.drawable.bg_yellow_round (isModuleRegular.not() || isModuleValied.not() || ConfigData.isEnableModule.not()) -> R.drawable.bg_yellow_round
YukiHookAPI.Status.isXposedModuleActive -> R.drawable.bg_green_round YukiHookAPI.Status.isXposedModuleActive -> R.drawable.bg_green_round
else -> R.drawable.bg_dark_round else -> R.drawable.bg_dark_round
} }

View File

@@ -1,6 +1,6 @@
/* /*
* MIUINativeNotifyIcon - Fix the native notification bar icon function abandoned by the MIUI development team. * MIUINativeNotifyIcon - Fix the native notification bar icon function abandoned by the MIUI development team.
* Copyright (C) 2017-2023 Fankes Studio(qzmmcn@163.com) * Copyright (C) 2017 Fankes Studio(qzmmcn@163.com)
* https://github.com/fankes/MIUINativeNotifyIcon * https://github.com/fankes/MIUINativeNotifyIcon
* *
* This software is non-free but opensource software: you can redistribute it * This software is non-free but opensource software: you can redistribute it
@@ -18,7 +18,7 @@
* and eula along with this software. If not, see * and eula along with this software. If not, see
* <https://www.gnu.org/licenses/> * <https://www.gnu.org/licenses/>
* *
* This file is Created by fankes on 2022/3/26. * This file is created by fankes on 2022/3/26.
*/ */
@file:Suppress("DEPRECATION") @file:Suppress("DEPRECATION")

View File

@@ -1,6 +1,6 @@
/* /*
* MIUINativeNotifyIcon - Fix the native notification bar icon function abandoned by the MIUI development team. * MIUINativeNotifyIcon - Fix the native notification bar icon function abandoned by the MIUI development team.
* Copyright (C) 2017-2023 Fankes Studio(qzmmcn@163.com) * Copyright (C) 2017 Fankes Studio(qzmmcn@163.com)
* https://github.com/fankes/MIUINativeNotifyIcon * https://github.com/fankes/MIUINativeNotifyIcon
* *
* This software is non-free but opensource software: you can redistribute it * This software is non-free but opensource software: you can redistribute it
@@ -18,22 +18,22 @@
* and eula along with this software. If not, see * and eula along with this software. If not, see
* <https://www.gnu.org/licenses/> * <https://www.gnu.org/licenses/>
* *
* This file is Created by fankes on 2022/1/30. * This file is created by fankes on 2022/1/30.
*/ */
@file:Suppress("UNCHECKED_CAST")
package com.fankes.miui.notify.ui.activity.base package com.fankes.miui.notify.ui.activity.base
import android.os.Build
import android.os.Bundle import android.os.Bundle
import android.view.LayoutInflater
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.res.ResourcesCompat import androidx.core.content.res.ResourcesCompat
import androidx.core.view.WindowCompat import androidx.core.view.WindowCompat
import androidx.viewbinding.ViewBinding import androidx.viewbinding.ViewBinding
import com.fankes.miui.notify.R import com.fankes.miui.notify.R
import com.fankes.miui.notify.utils.factory.isNotSystemInDarkMode import com.fankes.miui.notify.utils.factory.isNotSystemInDarkMode
import com.highcapable.yukihookapi.hook.factory.current import com.highcapable.kavaref.KavaRef.Companion.resolve
import com.highcapable.yukihookapi.hook.factory.method import com.highcapable.kavaref.extension.genericSuperclassTypeArguments
import com.highcapable.yukihookapi.hook.type.android.LayoutInflaterClass import com.highcapable.kavaref.extension.toClassOrNull
abstract class BaseActivity<VB : ViewBinding> : AppCompatActivity() { abstract class BaseActivity<VB : ViewBinding> : AppCompatActivity() {
@@ -49,10 +49,12 @@ abstract class BaseActivity<VB : ViewBinding> : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
isMainThreadRunning = true isMainThreadRunning = true
binding = current().generic()?.argument()?.method { val bindingClass = javaClass.genericSuperclassTypeArguments().firstOrNull()?.toClassOrNull()
binding = bindingClass?.resolve()?.optional()?.firstMethodOrNull {
name = "inflate" name = "inflate"
param(LayoutInflaterClass) parameters(LayoutInflater::class)
}?.get()?.invoke<VB>(layoutInflater) ?: error("binding failed") }?.invoke<VB>(layoutInflater) ?: error("binding failed")
if (Build.VERSION.SDK_INT >= 35) binding.root.fitsSystemWindows = true
setContentView(binding.root) setContentView(binding.root)
/** 隐藏系统的标题栏 */ /** 隐藏系统的标题栏 */
supportActionBar?.hide() supportActionBar?.hide()
@@ -61,6 +63,7 @@ abstract class BaseActivity<VB : ViewBinding> : AppCompatActivity() {
isAppearanceLightStatusBars = isNotSystemInDarkMode isAppearanceLightStatusBars = isNotSystemInDarkMode
isAppearanceLightNavigationBars = isNotSystemInDarkMode isAppearanceLightNavigationBars = isNotSystemInDarkMode
} }
@Suppress("DEPRECATION")
ResourcesCompat.getColor(resources, R.color.colorThemeBackground, null).also { ResourcesCompat.getColor(resources, R.color.colorThemeBackground, null).also {
window?.statusBarColor = it window?.statusBarColor = it
window?.navigationBarColor = it window?.navigationBarColor = it

View File

@@ -1,6 +1,6 @@
/* /*
* MIUINativeNotifyIcon - Fix the native notification bar icon function abandoned by the MIUI development team. * MIUINativeNotifyIcon - Fix the native notification bar icon function abandoned by the MIUI development team.
* Copyright (C) 2017-2023 Fankes Studio(qzmmcn@163.com) * Copyright (C) 2017 Fankes Studio(qzmmcn@163.com)
* https://github.com/fankes/MIUINativeNotifyIcon * https://github.com/fankes/MIUINativeNotifyIcon
* *
* This software is non-free but opensource software: you can redistribute it * This software is non-free but opensource software: you can redistribute it
@@ -18,7 +18,7 @@
* and eula along with this software. If not, see * and eula along with this software. If not, see
* <https://www.gnu.org/licenses/> * <https://www.gnu.org/licenses/>
* *
* This file is Created by fankes on 2022/1/8. * This file is created by fankes on 2022/1/8.
*/ */
@file:Suppress("SameParameterValue") @file:Suppress("SameParameterValue")

View File

@@ -1,6 +1,6 @@
/* /*
* MIUINativeNotifyIcon - Fix the native notification bar icon function abandoned by the MIUI development team. * MIUINativeNotifyIcon - Fix the native notification bar icon function abandoned by the MIUI development team.
* Copyright (C) 2017-2023 Fankes Studio(qzmmcn@163.com) * Copyright (C) 2017 Fankes Studio(qzmmcn@163.com)
* https://github.com/fankes/MIUINativeNotifyIcon * https://github.com/fankes/MIUINativeNotifyIcon
* *
* This software is non-free but opensource software: you can redistribute it * This software is non-free but opensource software: you can redistribute it
@@ -18,7 +18,7 @@
* and eula along with this software. If not, see * and eula along with this software. If not, see
* <https://www.gnu.org/licenses/> * <https://www.gnu.org/licenses/>
* *
* This file is Created by fankes on 2022/10/6. * This file is created by fankes on 2022/10/6.
*/ */
package com.fankes.miui.notify.utils.factory package com.fankes.miui.notify.utils.factory

View File

@@ -1,6 +1,6 @@
/* /*
* MIUINativeNotifyIcon - Fix the native notification bar icon function abandoned by the MIUI development team. * MIUINativeNotifyIcon - Fix the native notification bar icon function abandoned by the MIUI development team.
* Copyright (C) 2017-2023 Fankes Studio(qzmmcn@163.com) * Copyright (C) 2017 Fankes Studio(qzmmcn@163.com)
* https://github.com/fankes/MIUINativeNotifyIcon * https://github.com/fankes/MIUINativeNotifyIcon
* *
* This software is non-free but opensource software: you can redistribute it * This software is non-free but opensource software: you can redistribute it
@@ -18,7 +18,7 @@
* and eula along with this software. If not, see * and eula along with this software. If not, see
* <https://www.gnu.org/licenses/> * <https://www.gnu.org/licenses/>
* *
* This file is Created by fankes on 2022/6/3. * This file is created by fankes on 2022/6/3.
*/ */
package com.fankes.miui.notify.utils.factory package com.fankes.miui.notify.utils.factory
@@ -64,6 +64,7 @@ class BaseAdapterCreater(val context: Context) {
* 绑定 [BaseAdapter] 到 [ListView] * 绑定 [BaseAdapter] 到 [ListView]
* @param bindViews 回调 - ([VB] 每项,[Int] 下标) * @param bindViews 回调 - ([VB] 每项,[Int] 下标)
*/ */
@Suppress("DEPRECATION")
inline fun <reified VB : ViewBinding> onBindViews(crossinline bindViews: (binding: VB, position: Int) -> Unit) { inline fun <reified VB : ViewBinding> onBindViews(crossinline bindViews: (binding: VB, position: Int) -> Unit) {
baseAdapter = object : BaseAdapter() { baseAdapter = object : BaseAdapter() {
override fun getCount() = listDataCallback?.let { it() }?.size ?: 0 override fun getCount() = listDataCallback?.let { it() }?.size ?: 0

View File

@@ -1,6 +1,6 @@
/* /*
* MIUINativeNotifyIcon - Fix the native notification bar icon function abandoned by the MIUI development team. * MIUINativeNotifyIcon - Fix the native notification bar icon function abandoned by the MIUI development team.
* Copyright (C) 2017-2023 Fankes Studio(qzmmcn@163.com) * Copyright (C) 2017 Fankes Studio(qzmmcn@163.com)
* https://github.com/fankes/MIUINativeNotifyIcon * https://github.com/fankes/MIUINativeNotifyIcon
* *
* This software is non-free but opensource software: you can redistribute it * This software is non-free but opensource software: you can redistribute it
@@ -18,9 +18,9 @@
* and eula along with this software. If not, see * and eula along with this software. If not, see
* <https://www.gnu.org/licenses/> * <https://www.gnu.org/licenses/>
* *
* This file is Created by fankes on 2022/1/7. * This file is created by fankes on 2022/1/7.
*/ */
@file:Suppress("unused", "OPT_IN_USAGE", "EXPERIMENTAL_API_USAGE") @file:Suppress("unused")
package com.fankes.miui.notify.utils.factory package com.fankes.miui.notify.utils.factory
@@ -38,7 +38,6 @@ import androidx.viewbinding.ViewBinding
import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.google.android.material.progressindicator.CircularProgressIndicator import com.google.android.material.progressindicator.CircularProgressIndicator
import com.highcapable.yukihookapi.YukiHookAPI import com.highcapable.yukihookapi.YukiHookAPI
import com.highcapable.yukihookapi.annotation.CauseProblemsApi
import com.highcapable.yukihookapi.hook.factory.method import com.highcapable.yukihookapi.hook.factory.method
import com.highcapable.yukihookapi.hook.type.android.LayoutInflaterClass import com.highcapable.yukihookapi.hook.type.android.LayoutInflaterClass
@@ -69,6 +68,7 @@ inline fun Context.showDialog(initiate: DialogBuilder<*>.() -> Unit) = DialogBui
* @param context 实例 * @param context 实例
* @param bindingClass [ViewBinding] 的 [Class] 实例 or null * @param bindingClass [ViewBinding] 的 [Class] 实例 or null
*/ */
@Suppress("DEPRECATION")
class DialogBuilder<VB : ViewBinding>(val context: Context, private val bindingClass: Class<*>? = null) { class DialogBuilder<VB : ViewBinding>(val context: Context, private val bindingClass: Class<*>? = null) {
/** 实例对象 */ /** 实例对象 */
@@ -181,7 +181,6 @@ class DialogBuilder<VB : ViewBinding>(val context: Context, private val bindingC
fun cancel() = dialogInstance?.cancel() fun cancel() = dialogInstance?.cancel()
/** 显示对话框 */ /** 显示对话框 */
@CauseProblemsApi
fun show() = runInSafe { fun show() = runInSafe {
/** 若当前自定义 View 的对话框没有调用 [binding] 将会对其手动调用一次以确保显示布局 */ /** 若当前自定义 View 的对话框没有调用 [binding] 将会对其手动调用一次以确保显示布局 */
if (bindingClass != null) binding if (bindingClass != null) binding

View File

@@ -1,6 +1,6 @@
/* /*
* MIUINativeNotifyIcon - Fix the native notification bar icon function abandoned by the MIUI development team. * MIUINativeNotifyIcon - Fix the native notification bar icon function abandoned by the MIUI development team.
* Copyright (C) 2017-2023 Fankes Studio(qzmmcn@163.com) * Copyright (C) 2017 Fankes Studio(qzmmcn@163.com)
* https://github.com/fankes/MIUINativeNotifyIcon * https://github.com/fankes/MIUINativeNotifyIcon
* *
* This software is non-free but opensource software: you can redistribute it * This software is non-free but opensource software: you can redistribute it
@@ -18,13 +18,13 @@
* and eula along with this software. If not, see * and eula along with this software. If not, see
* <https://www.gnu.org/licenses/> * <https://www.gnu.org/licenses/>
* *
* This file is Created by fankes on 2022/3/13. * This file is created by fankes on 2022/3/13.
*/ */
@file:Suppress("unused") @file:Suppress("unused")
package com.fankes.miui.notify.utils.factory package com.fankes.miui.notify.utils.factory
import com.highcapable.yukihookapi.hook.log.loggerE import com.highcapable.yukihookapi.hook.log.YLog
/** /**
* 忽略异常返回值 * 忽略异常返回值
@@ -79,5 +79,5 @@ inline fun <T> safeOf(default: T, result: () -> T) = try {
* @param block 正常回调 * @param block 正常回调
*/ */
inline fun <T> T.runInSafe(msg: String = "", block: () -> Unit) { inline fun <T> T.runInSafe(msg: String = "", block: () -> Unit) {
runCatching(block).onFailure { if (msg.isNotBlank()) loggerE(msg = msg, e = it) } runCatching(block).onFailure { if (msg.isNotBlank()) YLog.error(msg, it) }
} }

View File

@@ -1,6 +1,6 @@
/* /*
* MIUINativeNotifyIcon - Fix the native notification bar icon function abandoned by the MIUI development team. * MIUINativeNotifyIcon - Fix the native notification bar icon function abandoned by the MIUI development team.
* Copyright (C) 2017-2023 Fankes Studio(qzmmcn@163.com) * Copyright (C) 2017 Fankes Studio(qzmmcn@163.com)
* https://github.com/fankes/MIUINativeNotifyIcon * https://github.com/fankes/MIUINativeNotifyIcon
* *
* This software is non-free but opensource software: you can redistribute it * This software is non-free but opensource software: you can redistribute it
@@ -18,24 +18,37 @@
* and eula along with this software. If not, see * and eula along with this software. If not, see
* <https://www.gnu.org/licenses/> * <https://www.gnu.org/licenses/>
* *
* This file is Created by fankes on 2022/1/7. * This file is created by fankes on 2022/1/7.
*/ */
@file:Suppress("unused", "ObsoleteSdkInt") @file:Suppress("unused", "ObsoleteSdkInt")
package com.fankes.miui.notify.utils.factory package com.fankes.miui.notify.utils.factory
import android.annotation.SuppressLint
import android.app.Activity import android.app.Activity
import android.app.Notification import android.app.Notification
import android.app.Service import android.app.Service
import android.app.WallpaperManager import android.app.WallpaperManager
import android.content.* import android.content.ClipData
import android.content.ClipboardManager
import android.content.ComponentName
import android.content.Context
import android.content.Intent
import android.content.pm.ApplicationInfo import android.content.pm.ApplicationInfo
import android.content.pm.PackageInfo import android.content.pm.PackageInfo
import android.content.pm.PackageManager import android.content.pm.PackageManager
import android.content.pm.PackageManager.PackageInfoFlags import android.content.pm.PackageManager.PackageInfoFlags
import android.content.res.Configuration import android.content.res.Configuration
import android.content.res.Resources import android.content.res.Resources
import android.graphics.* import android.graphics.Bitmap
import android.graphics.BitmapFactory
import android.graphics.Canvas
import android.graphics.Color
import android.graphics.Paint
import android.graphics.PorterDuff
import android.graphics.PorterDuffXfermode
import android.graphics.Rect
import android.graphics.RectF
import android.graphics.drawable.Drawable import android.graphics.drawable.Drawable
import android.net.ConnectivityManager import android.net.ConnectivityManager
import android.net.Uri import android.net.Uri
@@ -50,17 +63,22 @@ import androidx.core.app.NotificationManagerCompat
import androidx.core.content.getSystemService import androidx.core.content.getSystemService
import androidx.core.content.pm.PackageInfoCompat import androidx.core.content.pm.PackageInfoCompat
import androidx.core.content.res.ResourcesCompat import androidx.core.content.res.ResourcesCompat
import com.fankes.miui.notify.BuildConfig import androidx.core.graphics.createBitmap
import androidx.core.net.toUri
import com.fankes.miui.notify.wrapper.BuildConfigWrapper
import com.google.android.material.snackbar.Snackbar import com.google.android.material.snackbar.Snackbar
import com.highcapable.yukihookapi.hook.factory.hasClass import com.highcapable.yukihookapi.hook.factory.hasClass
import com.highcapable.yukihookapi.hook.factory.method import com.highcapable.yukihookapi.hook.factory.method
import com.highcapable.yukihookapi.hook.factory.toClassOrNull import com.highcapable.yukihookapi.hook.factory.toClassOrNull
import com.highcapable.yukihookapi.hook.log.YLog
import com.highcapable.yukihookapi.hook.type.java.StringClass import com.highcapable.yukihookapi.hook.type.java.StringClass
import com.highcapable.yukihookapi.hook.xposed.application.ModuleApplication.Companion.appContext import com.highcapable.yukihookapi.hook.xposed.application.ModuleApplication.Companion.appContext
import com.topjohnwu.superuser.Shell import com.topjohnwu.superuser.Shell
import java.io.ByteArrayOutputStream import java.io.ByteArrayOutputStream
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
import java.util.* import java.util.Calendar
import java.util.Date
import java.util.Locale
/** /**
* 系统深色模式是否开启 * 系统深色模式是否开启
@@ -86,17 +104,23 @@ val Context.isSystemInDarkMode get() = (resources.configuration.uiMode and Confi
*/ */
inline val Context.isNotSystemInDarkMode get() = !isSystemInDarkMode inline val Context.isNotSystemInDarkMode get() = !isSystemInDarkMode
/**
* 系统版本是否高于或等于 Android 14
* @return [Boolean] 是否符合条件
*/
inline val isUpperOfAndroidU get() = Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE
/** /**
* 系统版本是否高于或等于 Android 13 * 系统版本是否高于或等于 Android 13
* @return [Boolean] 是否符合条件 * @return [Boolean] 是否符合条件
*/ */
inline val isUpperOfAndroidT get() = Build.VERSION.SDK_INT > Build.VERSION_CODES.S inline val isUpperOfAndroidT get() = Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU
/** /**
* 系统版本是否高于或等于 Android 12 * 系统版本是否高于或等于 Android 12
* @return [Boolean] 是否符合条件 * @return [Boolean] 是否符合条件
*/ */
inline val isUpperOfAndroidS get() = Build.VERSION.SDK_INT > Build.VERSION_CODES.R inline val isUpperOfAndroidS get() = Build.VERSION.SDK_INT >= Build.VERSION_CODES.S
/** /**
* 系统版本是否低于 Android 9 * 系统版本是否低于 Android 9
@@ -110,12 +134,31 @@ inline val isLowerAndroidP get() = Build.VERSION.SDK_INT < Build.VERSION_CODES.P
*/ */
inline val isLowerAndroidR get() = Build.VERSION.SDK_INT < Build.VERSION_CODES.R inline val isLowerAndroidR get() = Build.VERSION.SDK_INT < Build.VERSION_CODES.R
/**
* 当前设备是否是 MIUI、HyperOS 定制 Android 系统
* @return [Boolean] 是否符合条件
*/
val isMiSystem get() = isMIUI || isMIOS
/**
* 当前设备是否不是 MIUI、HyperOS 定制 Android 系统
* @return [Boolean] 是否符合条件
*/
val isNotMiSystem get() = !isMiSystem
/** /**
* 当前设备是否是 MIUI 定制 Android 系统 * 当前设备是否是 MIUI 定制 Android 系统
* @return [Boolean] 是否符合条件 * @return [Boolean] 是否符合条件
*/ */
@Suppress("DEPRECATION")
val isMIUI by lazy { "android.miui.R".hasClass() } val isMIUI by lazy { "android.miui.R".hasClass() }
/**
* 当前设备是否是 HyperOS 定制 Android 系统
* @return [Boolean] 是否符合条件
*/
val isMIOS get() = isMIUI && miuiVersion == "816"
/** /**
* 当前设备是否不是 MIUI 定制 Android 系统 * 当前设备是否不是 MIUI 定制 Android 系统
* @return [Boolean] 是否符合条件 * @return [Boolean] 是否符合条件
@@ -123,20 +166,33 @@ val isMIUI by lazy { "android.miui.R".hasClass() }
inline val isNotMIUI get() = !isMIUI inline val isNotMIUI get() = !isMIUI
/** /**
* 是否为支持的 MIUI 版本 * 当前设备是否不是 HyperOS 定制 Android 系统
* @return [Boolean] 是否符合条件
*/
inline val isNotMIOS get() = !isMIOS
/**
* 是否为支持的 MIUI、HyperOS 版本
* @return [Boolean] * @return [Boolean]
*/ */
val isSupportMiuiVersion val isSupportMiSystemVersion
get() = when (miuiVersion) { get() = when {
"11", "12", "12.5", "13", "14" -> true isMIOS -> when (miosVersion) {
"1.0", "1.1", "2.0" -> true
else -> false
}
isMIUI -> when (miuiVersion) {
"11", "12", "12.5", "13", "14" -> true
else -> false
}
else -> false else -> false
} }
/** /**
* 是否不为支持的 MIUI 版本 * 是否不为支持的 MIUI、HyperOS 版本
* @return [Boolean] * @return [Boolean]
*/ */
inline val isNotSupportMiuiVersion get() = !isSupportMiuiVersion inline val isNotSupportMiSystemVersion get() = !isSupportMiSystemVersion
/** /**
* 获取 Android 版本代号 * 获取 Android 版本代号
@@ -144,6 +200,8 @@ inline val isNotSupportMiuiVersion get() = !isSupportMiuiVersion
*/ */
val androidVersionCodeName val androidVersionCodeName
get() = when (Build.VERSION.SDK_INT) { get() = when (Build.VERSION.SDK_INT) {
35 -> "V"
34 -> "U"
33 -> "T" 33 -> "T"
32 -> "S_V2" 32 -> "S_V2"
31 -> "S" 31 -> "S"
@@ -157,9 +215,31 @@ val androidVersionCodeName
23 -> "M" 23 -> "M"
22 -> "L_MR1" 22 -> "L_MR1"
21 -> "L" 21 -> "L"
else -> "?"
}
/**
* 获取 MIUI、HyperOS 版本
* @return [String]
*/
val miSystemVersion
get() = when {
isMIOS -> miosVersion
isMIUI -> miuiVersion
else -> "" else -> ""
} }
/**
* 获取 MIUI、HyperOS 版本号
* @return [Float]
*/
val miSystemVersionCode
get() = when {
isMIOS -> miosVersionCode
isMIUI -> miuiVersionCode
else -> 0f
}
/** /**
* 获取 MIUI 版本 * 获取 MIUI 版本
* @return [String] * @return [String]
@@ -178,11 +258,28 @@ val miuiVersion
}.trim() }.trim()
else "" else ""
/**
* 获取 HyperOS 版本
* @return [String]
*/
val miosVersion
get() = if (isMIOS)
findPropString("ro.mi.os.version.name").let {
if (it.startsWith("OS")) it.replaceFirst("OS", "") else it
}.trim()
else ""
/** /**
* 获取 MIUI 版本号 * 获取 MIUI 版本号
* @return [Float] * @return [Float]
*/ */
val miuiVersionCode get() = safeOf(default = 0f) { miuiVersion.toFloat() } val miuiVersionCode get() = miuiVersion.toFloatOrNull() ?: 0f
/**
* 获取 HyperOS 版本号
* @return [Float]
*/
val miosVersionCode get() = findPropString("ro.mi.os.version.code").toFloatOrNull() ?: 0f
/** /**
* 获取 MIUI 次版本号 * 获取 MIUI 次版本号
@@ -191,18 +288,35 @@ val miuiVersionCode get() = safeOf(default = 0f) { miuiVersion.toFloat() }
val miuiIncrementalVersion get() = findPropString("ro.system.build.version.incremental").trim() val miuiIncrementalVersion get() = findPropString("ro.system.build.version.incremental").trim()
/** /**
* 获取 MIUI 完全版本 * 获取 HyperOS 次版本
* @return [String] * @return [String]
*/ */
val miuiFullVersion val miosIncrementalVersion get() = findPropString("ro.mi.os.version.incremental").trim()
get() = if (isMIUI) miuiIncrementalVersion.let {
if (it.lowercase().endsWith(".dev").not() && it.lowercase().any { e -> e.code in 97..122 }) /**
"$it 稳定版" * 获取 MIUI、HyperOS 完全版本
else when { * @return [String]
it.lowercase().endsWith(".dev") -> "$it 开发版" */
else -> "V$miuiVersion $it 开发版" val systemFullVersion
get() = when {
isMIOS -> "HyperOS " + miosIncrementalVersion.let {
if (it.lowercase().endsWith(".dev").not() && it.lowercase().any { e -> e.code in 97..122 })
"${it.replaceFirst("OS", "")} 稳定版"
else when {
it.lowercase().endsWith(".dev") -> "${it.replaceFirst("OS", "")} 开发版"
else -> "$miosVersion $it 开发版"
}
} }
} else "不是 MIUI 系统" isMIUI -> miuiIncrementalVersion.let {
if (it.lowercase().endsWith(".dev").not() && it.lowercase().any { e -> e.code in 97..122 })
"$it 稳定版"
else when {
it.lowercase().endsWith(".dev") -> "$it 开发版"
else -> "V$miuiVersion $it 开发版"
}
}
else -> "不是 MIUI 或 HyperOS 系统"
}
/** /**
* 获取 [Drawable] * 获取 [Drawable]
@@ -225,7 +339,7 @@ fun Resources.colorOf(@ColorRes resId: Int) = ResourcesCompat.getColor(this, res
* @return [PackageInfo] or null * @return [PackageInfo] or null
*/ */
private fun Context.getPackageInfoCompat(packageName: String, flag: Number = 0) = runCatching { private fun Context.getPackageInfoCompat(packageName: String, flag: Number = 0) = runCatching {
@Suppress("DEPRECATION") @Suppress("DEPRECATION", "KotlinRedundantDiagnosticSuppress")
if (Build.VERSION.SDK_INT >= 33) if (Build.VERSION.SDK_INT >= 33)
packageManager?.getPackageInfo(packageName, PackageInfoFlags.of(flag.toLong())) packageManager?.getPackageInfo(packageName, PackageInfoFlags.of(flag.toLong()))
else packageManager?.getPackageInfo(packageName, flag.toInt()) else packageManager?.getPackageInfo(packageName, flag.toInt())
@@ -350,6 +464,7 @@ fun Number.dpFloat(context: Context) = toFloat() * context.resources.displayMetr
* @return [Int] Android < 12 返回 [wallpaperColor] * @return [Int] Android < 12 返回 [wallpaperColor]
*/ */
val Context.systemAccentColor val Context.systemAccentColor
@SuppressLint("InlinedApi")
get() = safeOf(wallpaperColor) { get() = safeOf(wallpaperColor) {
if (isUpperOfAndroidS) resources.colorOf(android.R.color.system_accent1_600) else wallpaperColor if (isUpperOfAndroidS) resources.colorOf(android.R.color.system_accent1_600) else wallpaperColor
} }
@@ -429,7 +544,7 @@ val String.bitmap: Bitmap get() = unbase64.bitmap
* @return [Bitmap] 圆角后的位图 - 失败会返回处理之前的位图 * @return [Bitmap] 圆角后的位图 - 失败会返回处理之前的位图
*/ */
fun Bitmap.round(radius: Float): Bitmap = safeOf(default = this) { fun Bitmap.round(radius: Float): Bitmap = safeOf(default = this) {
Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888).also { out -> createBitmap(width, height).also { out ->
Canvas(out).also { canvas -> Canvas(out).also { canvas ->
Paint().also { paint -> Paint().also { paint ->
paint.isAntiAlias = true paint.isAntiAlias = true
@@ -449,6 +564,7 @@ fun Bitmap.round(radius: Float): Bitmap = safeOf(default = this) {
* @param default 默认值 * @param default 默认值
* @return [String] * @return [String]
*/ */
@Suppress("DEPRECATION")
fun findPropString(key: String, default: String = "") = safeOf(default) { fun findPropString(key: String, default: String = "") = safeOf(default) {
"android.os.SystemProperties".toClassOrNull()?.method { "android.os.SystemProperties".toClassOrNull()?.method {
name = "get" name = "get"
@@ -460,7 +576,10 @@ fun findPropString(key: String, default: String = "") = safeOf(default) {
* 是否有 Root 权限 * 是否有 Root 权限
* @return [Boolean] * @return [Boolean]
*/ */
val isRootAccess get() = safeOfFalse { Shell.rootAccess() } val isRootAccess get() = safeOfFalse {
@Suppress("DEPRECATION")
Shell.rootAccess()
}
/** /**
* 执行命令 * 执行命令
@@ -469,6 +588,7 @@ val isRootAccess get() = safeOfFalse { Shell.rootAccess() }
* @return [String] 执行结果 * @return [String] 执行结果
*/ */
fun execShell(cmd: String, isSu: Boolean = true) = safeOfNothing { fun execShell(cmd: String, isSu: Boolean = true) = safeOfNothing {
@Suppress("DEPRECATION")
(if (isSu) Shell.su(cmd) else Shell.sh(cmd)).exec().out.let { (if (isSu) Shell.su(cmd) else Shell.sh(cmd)).exec().out.let {
if (it.isNotEmpty()) it[0].trim() else "" if (it.isNotEmpty()) it[0].trim() else ""
} }
@@ -478,7 +598,11 @@ fun execShell(cmd: String, isSu: Boolean = true) = safeOfNothing {
* 弹出 [Toast] * 弹出 [Toast]
* @param msg 提示内容 * @param msg 提示内容
*/ */
fun toast(msg: String) = Toast.makeText(appContext, msg, Toast.LENGTH_SHORT).show() fun toast(msg: String) {
runCatching {
Toast.makeText(appContext, msg, Toast.LENGTH_SHORT).show()
}.onFailure { YLog.warn(msg) }
}
/** /**
* 跳转到指定页面 * 跳转到指定页面
@@ -514,7 +638,7 @@ fun Context.openBrowser(url: String, packageName: String = "") = runCatching {
startActivity(Intent().apply { startActivity(Intent().apply {
if (packageName.isNotBlank()) setPackage(packageName) if (packageName.isNotBlank()) setPackage(packageName)
action = Intent.ACTION_VIEW action = Intent.ACTION_VIEW
data = Uri.parse(url) data = url.toUri()
/** 防止顶栈一样重叠在自己的 APP 中 */ /** 防止顶栈一样重叠在自己的 APP 中 */
flags = Intent.FLAG_ACTIVITY_NEW_TASK flags = Intent.FLAG_ACTIVITY_NEW_TASK
}) })
@@ -587,7 +711,7 @@ fun Any?.delayedRun(ms: Long = 150, it: () -> Unit) = runInSafe {
*/ */
fun Context.hideOrShowLauncherIcon(isShow: Boolean) { fun Context.hideOrShowLauncherIcon(isShow: Boolean) {
packageManager?.setComponentEnabledSetting( packageManager?.setComponentEnabledSetting(
ComponentName(packageName, "${BuildConfig.APPLICATION_ID}.Home"), ComponentName(packageName, "${BuildConfigWrapper.APPLICATION_ID}.Home"),
if (isShow) PackageManager.COMPONENT_ENABLED_STATE_DISABLED else PackageManager.COMPONENT_ENABLED_STATE_ENABLED, if (isShow) PackageManager.COMPONENT_ENABLED_STATE_DISABLED else PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
PackageManager.DONT_KILL_APP PackageManager.DONT_KILL_APP
) )
@@ -599,5 +723,5 @@ fun Context.hideOrShowLauncherIcon(isShow: Boolean) {
*/ */
val Context.isLauncherIconShowing val Context.isLauncherIconShowing
get() = packageManager?.getComponentEnabledSetting( get() = packageManager?.getComponentEnabledSetting(
ComponentName(packageName, "${BuildConfig.APPLICATION_ID}.Home") ComponentName(packageName, "${BuildConfigWrapper.APPLICATION_ID}.Home")
) != PackageManager.COMPONENT_ENABLED_STATE_DISABLED ) != PackageManager.COMPONENT_ENABLED_STATE_DISABLED

View File

@@ -1,6 +1,6 @@
/* /*
* MIUINativeNotifyIcon - Fix the native notification bar icon function abandoned by the MIUI development team. * MIUINativeNotifyIcon - Fix the native notification bar icon function abandoned by the MIUI development team.
* Copyright (C) 2017-2023 Fankes Studio(qzmmcn@163.com) * Copyright (C) 2017 Fankes Studio(qzmmcn@163.com)
* https://github.com/fankes/MIUINativeNotifyIcon * https://github.com/fankes/MIUINativeNotifyIcon
* *
* This software is non-free but opensource software: you can redistribute it * This software is non-free but opensource software: you can redistribute it
@@ -18,7 +18,7 @@
* and eula along with this software. If not, see * and eula along with this software. If not, see
* <https://www.gnu.org/licenses/> * <https://www.gnu.org/licenses/>
* *
* This file is Created by fankes on 2023/4/17. * This file is created by fankes on 2023/4/17.
*/ */
package com.fankes.miui.notify.utils.tool package com.fankes.miui.notify.utils.tool
@@ -31,10 +31,11 @@ import android.content.Context
import android.content.Intent import android.content.Intent
import android.graphics.drawable.Icon import android.graphics.drawable.Icon
import android.os.Build import android.os.Build
import android.os.Bundle
import androidx.core.graphics.drawable.toBitmap import androidx.core.graphics.drawable.toBitmap
import com.fankes.miui.notify.BuildConfig
import com.fankes.miui.notify.R import com.fankes.miui.notify.R
import com.fankes.miui.notify.utils.factory.appIconOf import com.fankes.miui.notify.utils.factory.appIconOf
import com.fankes.miui.notify.wrapper.BuildConfigWrapper
/** /**
* 模块更新激活提醒通知工具类 * 模块更新激活提醒通知工具类
@@ -42,7 +43,7 @@ import com.fankes.miui.notify.utils.factory.appIconOf
object ActivationPromptTool { object ActivationPromptTool {
/** 当前模块的包名 */ /** 当前模块的包名 */
private const val MODULE_PACKAGE_NAME = BuildConfig.APPLICATION_ID private const val MODULE_PACKAGE_NAME = BuildConfigWrapper.APPLICATION_ID
/** 推送通知的渠道名称 */ /** 推送通知的渠道名称 */
private const val NOTIFY_CHANNEL = "activationPromptId" private const val NOTIFY_CHANNEL = "activationPromptId"
@@ -53,7 +54,7 @@ object ActivationPromptTool {
* @param packageName 当前 APP 包名 * @param packageName 当前 APP 包名
*/ */
fun prompt(context: Context, packageName: String) { fun prompt(context: Context, packageName: String) {
if (packageName != BuildConfig.APPLICATION_ID) return if (packageName != BuildConfigWrapper.APPLICATION_ID) return
context.getSystemService(NotificationManager::class.java)?.apply { context.getSystemService(NotificationManager::class.java)?.apply {
createNotificationChannel( createNotificationChannel(
NotificationChannel( NotificationChannel(
@@ -68,12 +69,14 @@ object ActivationPromptTool {
setColor(0xFFE06818.toInt()) setColor(0xFFE06818.toInt())
setAutoCancel(true) setAutoCancel(true)
setSmallIcon(Icon.createWithResource(MODULE_PACKAGE_NAME, R.drawable.ic_notify_update)) setSmallIcon(Icon.createWithResource(MODULE_PACKAGE_NAME, R.drawable.ic_notify_update))
setLargeIcon(context.appIconOf(packageName)?.toBitmap()) setExtras(Bundle().apply {
putParcelable("miui.appIcon", Icon.createWithBitmap(context.appIconOf(MODULE_PACKAGE_NAME)?.toBitmap()))
})
setContentIntent( setContentIntent(
PendingIntent.getActivity( PendingIntent.getActivity(
context, packageName.hashCode(), context, packageName.hashCode(),
Intent().apply { Intent().apply {
component = ComponentName(MODULE_PACKAGE_NAME, "${MODULE_PACKAGE_NAME}.ui.activity.MainActivity") component = ComponentName(MODULE_PACKAGE_NAME, "$MODULE_PACKAGE_NAME.ui.activity.MainActivity")
flags = Intent.FLAG_ACTIVITY_NEW_TASK flags = Intent.FLAG_ACTIVITY_NEW_TASK
}, if (Build.VERSION.SDK_INT < 31) PendingIntent.FLAG_UPDATE_CURRENT else PendingIntent.FLAG_IMMUTABLE }, if (Build.VERSION.SDK_INT < 31) PendingIntent.FLAG_UPDATE_CURRENT else PendingIntent.FLAG_IMMUTABLE
) )

View File

@@ -1,6 +1,6 @@
/* /*
* MIUINativeNotifyIcon - Fix the native notification bar icon function abandoned by the MIUI development team. * MIUINativeNotifyIcon - Fix the native notification bar icon function abandoned by the MIUI development team.
* Copyright (C) 2017-2023 Fankes Studio(qzmmcn@163.com) * Copyright (C) 2017 Fankes Studio(qzmmcn@163.com)
* https://github.com/fankes/MIUINativeNotifyIcon * https://github.com/fankes/MIUINativeNotifyIcon
* *
* This software is non-free but opensource software: you can redistribute it * This software is non-free but opensource software: you can redistribute it
@@ -18,16 +18,21 @@
* and eula along with this software. If not, see * and eula along with this software. If not, see
* <https://www.gnu.org/licenses/> * <https://www.gnu.org/licenses/>
* *
* This file is Created by fankes on 2022/2/19. * This file is created by fankes on 2022/2/19.
*/ */
package com.fankes.miui.notify.utils.tool package com.fankes.miui.notify.utils.tool
import android.graphics.* import android.graphics.Bitmap
import android.graphics.Canvas
import android.graphics.Matrix
import android.graphics.Paint
import android.graphics.PorterDuff
import android.graphics.drawable.AnimationDrawable import android.graphics.drawable.AnimationDrawable
import android.graphics.drawable.BitmapDrawable import android.graphics.drawable.BitmapDrawable
import android.graphics.drawable.Drawable import android.graphics.drawable.Drawable
import android.graphics.drawable.VectorDrawable import android.graphics.drawable.VectorDrawable
import android.util.ArrayMap import android.util.ArrayMap
import androidx.core.graphics.createBitmap
import androidx.core.graphics.drawable.toBitmap import androidx.core.graphics.drawable.toBitmap
import com.fankes.miui.notify.utils.factory.safeOfFalse import com.fankes.miui.notify.utils.factory.safeOfFalse
import kotlin.math.abs import kotlin.math.abs
@@ -73,7 +78,7 @@ object BitmapCompatTool {
var width = bitmap.width var width = bitmap.width
if (height > 64 || width > 64) { if (height > 64 || width > 64) {
if (tempCompactBitmap == null) { if (tempCompactBitmap == null) {
tempCompactBitmap = Bitmap.createBitmap(64, 64, Bitmap.Config.ARGB_8888) tempCompactBitmap = createBitmap(64, 64)
.also { tempCompactBitmapCanvas = Canvas(it) } .also { tempCompactBitmapCanvas = Canvas(it) }
tempCompactBitmapPaint = Paint(Paint.FILTER_BITMAP_FLAG).apply { isFilterBitmap = true } tempCompactBitmapPaint = Paint(Paint.FILTER_BITMAP_FLAG).apply { isFilterBitmap = true }
} }
@@ -87,11 +92,12 @@ object BitmapCompatTool {
val size = height * width val size = height * width
ensureBufferSize(size) ensureBufferSize(size)
tempCompactBitmap?.getPixels(tempBuffer, 0, width, 0, 0, width, height) tempCompactBitmap?.getPixels(tempBuffer, 0, width, 0, 0, width, height)
for (i in 0 until size) for (i in 0 until size) {
if (isGrayscaleColor(tempBuffer[i]).not()) { if (isGrayscaleColor(tempBuffer[i]).not()) {
cachedBitmapGrayscales[bitmap.generationId] = false cachedBitmapGrayscales[bitmap.generationId] = false
return@let false return@let false
} }
}
cachedBitmapGrayscales[bitmap.generationId] = true cachedBitmapGrayscales[bitmap.generationId] = true
true true
} }

View File

@@ -1,6 +1,6 @@
/* /*
* MIUINativeNotifyIcon - Fix the native notification bar icon function abandoned by the MIUI development team. * MIUINativeNotifyIcon - Fix the native notification bar icon function abandoned by the MIUI development team.
* Copyright (C) 2017-2023 Fankes Studio(qzmmcn@163.com) * Copyright (C) 2017 Fankes Studio(qzmmcn@163.com)
* https://github.com/fankes/MIUINativeNotifyIcon * https://github.com/fankes/MIUINativeNotifyIcon
* *
* This software is non-free but opensource software: you can redistribute it * This software is non-free but opensource software: you can redistribute it
@@ -18,7 +18,7 @@
* and eula along with this software. If not, see * and eula along with this software. If not, see
* <https://www.gnu.org/licenses/> * <https://www.gnu.org/licenses/>
* *
* This file is Created by fankes on 2022/3/20. * This file is created by fankes on 2022/3/20.
*/ */
package com.fankes.miui.notify.utils.tool package com.fankes.miui.notify.utils.tool
@@ -27,12 +27,20 @@ import android.content.Context
import android.icu.text.SimpleDateFormat import android.icu.text.SimpleDateFormat
import android.icu.util.Calendar import android.icu.util.Calendar
import android.icu.util.TimeZone import android.icu.util.TimeZone
import com.fankes.miui.notify.utils.factory.* import com.fankes.miui.notify.utils.factory.isNetWorkSuccess
import okhttp3.* import com.fankes.miui.notify.utils.factory.openBrowser
import com.fankes.miui.notify.utils.factory.openSelfSetting
import com.fankes.miui.notify.utils.factory.runInSafe
import com.fankes.miui.notify.utils.factory.showDialog
import okhttp3.Call
import okhttp3.Callback
import okhttp3.OkHttpClient
import okhttp3.Request
import okhttp3.Response
import org.json.JSONObject import org.json.JSONObject
import java.io.IOException import java.io.IOException
import java.io.Serializable import java.io.Serializable
import java.util.* import java.util.Locale
/** /**
* 获取 GitHub Release 最新版本工具类 * 获取 GitHub Release 最新版本工具类
@@ -71,7 +79,7 @@ object GithubReleaseTool {
fun showUpdate() = context.showDialog { fun showUpdate() = context.showDialog {
title = "最新版本 $name" title = "最新版本 $name"
msg = "发布于 $date\n\n" + msg = "发布于 $date\n\n" +
"更新日志\n\n" + content "更新日志\n\n" + content
confirmButton(text = "更新") { context.openBrowser(htmlUrl) } confirmButton(text = "更新") { context.openBrowser(htmlUrl) }
cancelButton() cancelButton()
} }

View File

@@ -1,6 +1,6 @@
/* /*
* MIUINativeNotifyIcon - Fix the native notification bar icon function abandoned by the MIUI development team. * MIUINativeNotifyIcon - Fix the native notification bar icon function abandoned by the MIUI development team.
* Copyright (C) 2017-2023 Fankes Studio(qzmmcn@163.com) * Copyright (C) 2017 Fankes Studio(qzmmcn@163.com)
* https://github.com/fankes/MIUINativeNotifyIcon * https://github.com/fankes/MIUINativeNotifyIcon
* *
* This software is non-free but opensource software: you can redistribute it * This software is non-free but opensource software: you can redistribute it
@@ -18,7 +18,7 @@
* and eula along with this software. If not, see * and eula along with this software. If not, see
* <https://www.gnu.org/licenses/> * <https://www.gnu.org/licenses/>
* *
* This file is Created by fankes on 2023/2/3. * This file is created by fankes on 2023/2/3.
*/ */
package com.fankes.miui.notify.utils.tool package com.fankes.miui.notify.utils.tool
@@ -26,7 +26,7 @@ import android.content.Context
import com.fankes.miui.notify.utils.factory.showDialog import com.fankes.miui.notify.utils.factory.showDialog
import com.highcapable.yukihookapi.hook.factory.prefs import com.highcapable.yukihookapi.hook.factory.prefs
import com.highcapable.yukihookapi.hook.xposed.prefs.data.PrefsData import com.highcapable.yukihookapi.hook.xposed.prefs.data.PrefsData
import java.util.* import java.util.Locale
/** /**
* I18n 适配警告提示工具类 * I18n 适配警告提示工具类
@@ -46,8 +46,8 @@ object I18nWarnTool {
context.showDialog { context.showDialog {
title = "Notice of I18n Support" title = "Notice of I18n Support"
msg = "This Xposed Module is only for Chinese and the Chinese region.\n\n" + msg = "This Xposed Module is only for Chinese and the Chinese region.\n\n" +
"Currently, there will be no internationalization adaptation.\n\n" + "Currently, there will be no internationalization adaptation.\n\n" +
"There may be plans for internationalization adaptation in the future, so stay tuned." "There may be plans for internationalization adaptation in the future, so stay tuned."
confirmButton(text = "Got It") { saveReaded() } confirmButton(text = "Got It") { saveReaded() }
noCancelable() noCancelable()
} }

View File

@@ -1,6 +1,6 @@
/* /*
* MIUINativeNotifyIcon - Fix the native notification bar icon function abandoned by the MIUI development team. * MIUINativeNotifyIcon - Fix the native notification bar icon function abandoned by the MIUI development team.
* Copyright (C) 2017-2023 Fankes Studio(qzmmcn@163.com) * Copyright (C) 2017 Fankes Studio(qzmmcn@163.com)
* https://github.com/fankes/MIUINativeNotifyIcon * https://github.com/fankes/MIUINativeNotifyIcon
* *
* This software is non-free but opensource software: you can redistribute it * This software is non-free but opensource software: you can redistribute it
@@ -18,7 +18,7 @@
* and eula along with this software. If not, see * and eula along with this software. If not, see
* <https://www.gnu.org/licenses/> * <https://www.gnu.org/licenses/>
* *
* This file is Created by fankes on 2022/3/21. * This file is created by fankes on 2022/3/21.
*/ */
package com.fankes.miui.notify.utils.tool package com.fankes.miui.notify.utils.tool
@@ -31,11 +31,17 @@ import android.content.Context
import android.content.Intent import android.content.Intent
import android.graphics.drawable.Icon import android.graphics.drawable.Icon
import android.os.Build import android.os.Build
import android.os.Bundle
import androidx.core.graphics.drawable.toBitmap import androidx.core.graphics.drawable.toBitmap
import com.fankes.miui.notify.BuildConfig
import com.fankes.miui.notify.R import com.fankes.miui.notify.R
import com.fankes.miui.notify.hook.HookEntry import com.fankes.miui.notify.hook.HookEntry
import com.fankes.miui.notify.utils.factory.* import com.fankes.miui.notify.utils.factory.appIconOf
import com.fankes.miui.notify.utils.factory.appNameOf
import com.fankes.miui.notify.utils.factory.isDebugApp
import com.fankes.miui.notify.utils.factory.isSystemApp
import com.fankes.miui.notify.utils.factory.runInSafe
import com.fankes.miui.notify.utils.factory.stampToDate
import com.fankes.miui.notify.wrapper.BuildConfigWrapper
/** /**
* 通知图标适配推送通知类 * 通知图标适配推送通知类
@@ -45,7 +51,7 @@ import com.fankes.miui.notify.utils.factory.*
object IconAdaptationTool { object IconAdaptationTool {
/** 当前模块的包名 */ /** 当前模块的包名 */
private const val MODULE_PACKAGE_NAME = BuildConfig.APPLICATION_ID private const val MODULE_PACKAGE_NAME = BuildConfigWrapper.APPLICATION_ID
/** 推送通知的渠道名称 */ /** 推送通知的渠道名称 */
private const val NOTIFY_CHANNEL = "notifyRuleSupportId" private const val NOTIFY_CHANNEL = "notifyRuleSupportId"
@@ -75,14 +81,16 @@ object IconAdaptationTool {
setColor(0xFF2993F0.toInt()) setColor(0xFF2993F0.toInt())
setAutoCancel(true) setAutoCancel(true)
setSmallIcon(Icon.createWithResource(MODULE_PACKAGE_NAME, R.drawable.ic_unsupported)) setSmallIcon(Icon.createWithResource(MODULE_PACKAGE_NAME, R.drawable.ic_unsupported))
setLargeIcon(context.appIconOf(packageName)?.toBitmap()) setExtras(Bundle().apply {
putParcelable("miui.appIcon", Icon.createWithBitmap(context.appIconOf(MODULE_PACKAGE_NAME)?.toBitmap()))
})
setContentIntent( setContentIntent(
PendingIntent.getActivity( PendingIntent.getActivity(
context, packageName.hashCode(), context, packageName.hashCode(),
Intent().apply { Intent().apply {
component = ComponentName( component = ComponentName(
MODULE_PACKAGE_NAME, MODULE_PACKAGE_NAME,
"${MODULE_PACKAGE_NAME}.ui.activity.ConfigureActivity" "$MODULE_PACKAGE_NAME.ui.activity.ConfigureActivity"
) )
flags = Intent.FLAG_ACTIVITY_NEW_TASK flags = Intent.FLAG_ACTIVITY_NEW_TASK
}.apply { }.apply {
@@ -117,7 +125,7 @@ object IconAdaptationTool {
outTimeLimits.add(nowTime) outTimeLimits.add(nowTime)
context.startActivity( context.startActivity(
Intent().apply { Intent().apply {
component = ComponentName(MODULE_PACKAGE_NAME, "${MODULE_PACKAGE_NAME}.ui.activity.auto.NotifyIconRuleUpdateActivity") component = ComponentName(MODULE_PACKAGE_NAME, "$MODULE_PACKAGE_NAME.ui.activity.auto.NotifyIconRuleUpdateActivity")
flags = Intent.FLAG_ACTIVITY_NEW_TASK flags = Intent.FLAG_ACTIVITY_NEW_TASK
} }
) )

View File

@@ -1,6 +1,6 @@
/* /*
* MIUINativeNotifyIcon - Fix the native notification bar icon function abandoned by the MIUI development team. * MIUINativeNotifyIcon - Fix the native notification bar icon function abandoned by the MIUI development team.
* Copyright (C) 2017-2023 Fankes Studio(qzmmcn@163.com) * Copyright (C) 2017 Fankes Studio(qzmmcn@163.com)
* https://github.com/fankes/MIUINativeNotifyIcon * https://github.com/fankes/MIUINativeNotifyIcon
* *
* This software is non-free but opensource software: you can redistribute it * This software is non-free but opensource software: you can redistribute it
@@ -18,7 +18,7 @@
* and eula along with this software. If not, see * and eula along with this software. If not, see
* <https://www.gnu.org/licenses/> * <https://www.gnu.org/licenses/>
* *
* This file is Created by fankes on 2022/2/25. * This file is created by fankes on 2022/2/25.
*/ */
@file:Suppress("TrustAllX509TrustManager", "CustomX509TrustManager", "IMPLICIT_CAST_TO_ANY") @file:Suppress("TrustAllX509TrustManager", "CustomX509TrustManager", "IMPLICIT_CAST_TO_ANY")
@@ -45,13 +45,25 @@ import com.fankes.miui.notify.databinding.DiaSourceFromBinding
import com.fankes.miui.notify.databinding.DiaSourceFromStringBinding import com.fankes.miui.notify.databinding.DiaSourceFromStringBinding
import com.fankes.miui.notify.params.IconPackParams import com.fankes.miui.notify.params.IconPackParams
import com.fankes.miui.notify.ui.activity.ConfigureActivity import com.fankes.miui.notify.ui.activity.ConfigureActivity
import com.fankes.miui.notify.utils.factory.* import com.fankes.miui.notify.utils.factory.delayedRun
import com.highcapable.yukihookapi.hook.log.loggerD import com.fankes.miui.notify.utils.factory.openBrowser
import okhttp3.* import com.fankes.miui.notify.utils.factory.safeOfNull
import com.fankes.miui.notify.utils.factory.showDialog
import com.fankes.miui.notify.utils.factory.snake
import com.highcapable.yukihookapi.hook.log.YLog
import okhttp3.Call
import okhttp3.Callback
import okhttp3.OkHttpClient
import okhttp3.Request
import okhttp3.Response
import java.io.IOException import java.io.IOException
import java.security.SecureRandom import java.security.SecureRandom
import java.security.cert.X509Certificate import java.security.cert.X509Certificate
import javax.net.ssl.* import javax.net.ssl.HostnameVerifier
import javax.net.ssl.SSLContext
import javax.net.ssl.SSLSocketFactory
import javax.net.ssl.TrustManager
import javax.net.ssl.X509TrustManager
/** /**
* 通知图标在线规则管理类 * 通知图标在线规则管理类
@@ -71,7 +83,7 @@ object IconRuleManagerTool {
private const val SYNC_DIRECT_URL = "https://raw.githubusercontent.com/fankes/AndroidNotifyIconAdapt/main" private const val SYNC_DIRECT_URL = "https://raw.githubusercontent.com/fankes/AndroidNotifyIconAdapt/main"
/** 同步地址 - GitHub Raw (代理 - GitHub Proxy) */ /** 同步地址 - GitHub Raw (代理 - GitHub Proxy) */
private const val SYNC_PROXY_1_URL = "https://ghproxy.com/$SYNC_DIRECT_URL" private const val SYNC_PROXY_1_URL = "https://ghp.ci/$SYNC_DIRECT_URL"
/** 同步地址 - GitHub Raw (代理 - 7ED Services) */ /** 同步地址 - GitHub Raw (代理 - 7ED Services) */
private const val SYNC_PROXY_2_URL = "https://raw.githubusercontentS.com/fankes/AndroidNotifyIconAdapt/main" private const val SYNC_PROXY_2_URL = "https://raw.githubusercontentS.com/fankes/AndroidNotifyIconAdapt/main"
@@ -236,7 +248,7 @@ object IconRuleManagerTool {
notifyRefresh(context) notifyRefresh(context)
callback() callback()
} }
else -> (if (context is AppCompatActivity) context.snake(msg = "列表数据已是最新")) else -> (if (context is AppCompatActivity) context.snake(msg = "列表数据已是最新") else Unit)
} }
} }
context is AppCompatActivity -> context is AppCompatActivity ->
@@ -286,7 +298,7 @@ object IconRuleManagerTool {
notifyRefresh(context) notifyRefresh(context)
callback() callback()
} }
else -> (if (context is AppCompatActivity) context.snake(msg = "列表数据已是最新")) else -> (if (context is AppCompatActivity) context.snake(msg = "列表数据已是最新") else Unit)
} }
context is AppCompatActivity -> context is AppCompatActivity ->
context.showDialog { context.showDialog {
@@ -465,11 +477,11 @@ object IconRuleManagerTool {
get() = object : X509TrustManager { get() = object : X509TrustManager {
override fun checkClientTrusted(chain: Array<X509Certificate?>?, authType: String?) { override fun checkClientTrusted(chain: Array<X509Certificate?>?, authType: String?) {
loggerD(msg = "TrustX509 --> $authType") YLog.debug("TrustX509 --> $authType")
} }
override fun checkServerTrusted(chain: Array<X509Certificate?>?, authType: String?) { override fun checkServerTrusted(chain: Array<X509Certificate?>?, authType: String?) {
loggerD(msg = "TrustX509 --> $authType") YLog.debug("TrustX509 --> $authType")
} }
override fun getAcceptedIssuers() = arrayOf<X509Certificate>() override fun getAcceptedIssuers() = arrayOf<X509Certificate>()

View File

@@ -1,6 +1,6 @@
/* /*
* MIUINativeNotifyIcon - Fix the native notification bar icon function abandoned by the MIUI development team. * MIUINativeNotifyIcon - Fix the native notification bar icon function abandoned by the MIUI development team.
* Copyright (C) 2017-2023 Fankes Studio(qzmmcn@163.com) * Copyright (C) 2017 Fankes Studio(qzmmcn@163.com)
* https://github.com/fankes/MIUINativeNotifyIcon * https://github.com/fankes/MIUINativeNotifyIcon
* *
* This software is non-free but opensource software: you can redistribute it * This software is non-free but opensource software: you can redistribute it
@@ -18,7 +18,7 @@
* and eula along with this software. If not, see * and eula along with this software. If not, see
* <https://www.gnu.org/licenses/> * <https://www.gnu.org/licenses/>
* *
* This file is Created by fankes on 2022/2/8. * This file is created by fankes on 2022/2/8.
*/ */
package com.fankes.miui.notify.utils.tool package com.fankes.miui.notify.utils.tool
@@ -32,15 +32,20 @@ import androidx.appcompat.app.AppCompatActivity
import com.fankes.miui.notify.const.PackageName import com.fankes.miui.notify.const.PackageName
import com.fankes.miui.notify.data.ConfigData import com.fankes.miui.notify.data.ConfigData
import com.fankes.miui.notify.ui.activity.MainActivity import com.fankes.miui.notify.ui.activity.MainActivity
import com.fankes.miui.notify.utils.factory.* import com.fankes.miui.notify.utils.factory.delayedRun
import com.fankes.miui.notify.utils.factory.execShell
import com.fankes.miui.notify.utils.factory.isMIOS
import com.fankes.miui.notify.utils.factory.showDialog
import com.fankes.miui.notify.utils.factory.snake
import com.fankes.miui.notify.utils.factory.systemFullVersion
import com.google.android.material.snackbar.Snackbar import com.google.android.material.snackbar.Snackbar
import com.highcapable.yukihookapi.YukiHookAPI import com.highcapable.yukihookapi.YukiHookAPI
import com.highcapable.yukihookapi.hook.factory.dataChannel import com.highcapable.yukihookapi.hook.factory.dataChannel
import com.highcapable.yukihookapi.hook.log.YukiHookLogger import com.highcapable.yukihookapi.hook.log.YLog
import com.highcapable.yukihookapi.hook.log.YukiLoggerData import com.highcapable.yukihookapi.hook.log.data.YLogData
import com.highcapable.yukihookapi.hook.param.PackageParam import com.highcapable.yukihookapi.hook.param.PackageParam
import com.highcapable.yukihookapi.hook.xposed.channel.data.ChannelData import com.highcapable.yukihookapi.hook.xposed.channel.data.ChannelData
import java.util.* import java.util.Locale
/** /**
* 系统界面工具 * 系统界面工具
@@ -51,7 +56,7 @@ object SystemUITool {
private val CALL_MODULE_REFRESH_RESULT = ChannelData("call_module_refresh_result", false) private val CALL_MODULE_REFRESH_RESULT = ChannelData("call_module_refresh_result", false)
/** 当前全部调试日志 */ /** 当前全部调试日志 */
private var debugLogs = ArrayList<YukiLoggerData>() private var debugLogs = listOf<YLogData>()
/** 当前启动器实例 */ /** 当前启动器实例 */
private var launcher: ActivityResultLauncher<String>? = null private var launcher: ActivityResultLauncher<String>? = null
@@ -88,17 +93,17 @@ object SystemUITool {
runCatching { runCatching {
result?.let { e -> result?.let { e ->
val content = "" + val content = "" +
"================================================================\n" + "================================================================\n" +
" Generated by MIUINativeNotifyIcon\n" + " Generated by MIUINativeNotifyIcon\n" +
" Project Url: https://github.com/fankes/MIUINativeNotifyIcon\n" + " Project Url: https://github.com/fankes/MIUINativeNotifyIcon\n" +
"================================================================\n\n" + "================================================================\n\n" +
"[Device Brand]: ${Build.BRAND}\n" + "[Device Brand]: ${Build.BRAND}\n" +
"[Device Model]: ${Build.MODEL}\n" + "[Device Model]: ${Build.MODEL}\n" +
"[Display]: ${Build.DISPLAY}\n" + "[Display]: ${Build.DISPLAY}\n" +
"[Android Version]: ${Build.VERSION.RELEASE}\n" + "[Android Version]: ${Build.VERSION.RELEASE}\n" +
"[Android API Level]: ${Build.VERSION.SDK_INT}\n" + "[Android API Level]: ${Build.VERSION.SDK_INT}\n" +
"[MIUI Version]: $miuiFullVersion\n" + "[${if (isMIOS) "HyperOS" else "MIUI"} Version]: $systemFullVersion\n" +
"[System Locale]: ${Locale.getDefault()}\n\n" + YukiHookLogger.contents(debugLogs).trim() "[System Locale]: ${Locale.getDefault()}\n\n" + YLog.contents(debugLogs).trim()
activity.contentResolver?.openOutputStream(e)?.apply { write(content.toByteArray()) }?.close() activity.contentResolver?.openOutputStream(e)?.apply { write(content.toByteArray()) }?.close()
activity.snake(msg = "导出完成") activity.snake(msg = "导出完成")
} ?: activity.snake(msg = "已取消操作") } ?: activity.snake(msg = "已取消操作")
@@ -125,9 +130,9 @@ object SystemUITool {
context.showDialog { context.showDialog {
title = "导出全部调试日志" title = "导出全部调试日志"
msg = "调试日志中会包含当前系统推送的全部通知内容,其中可能包含你的个人隐私," + msg = "调试日志中会包含当前系统推送的全部通知内容,其中可能包含你的个人隐私," +
"你可以在导出后的日志文件中选择将这些敏感信息模糊化处理再进行共享," + "你可以在导出后的日志文件中选择将这些敏感信息模糊化处理再进行共享," +
"开发者使用并查看你导出的调试日志仅为排查与修复问题,并且在之后会及时销毁这些日志。\n\n" + "开发者使用并查看你导出的调试日志仅为排查与修复问题,并且在之后会及时销毁这些日志。\n\n" +
"继续导出即代表你已阅读并知悉上述内容。" "继续导出即代表你已阅读并知悉上述内容。"
confirmButton(text = "继续") { doExport() } confirmButton(text = "继续") { doExport() }
cancelButton() cancelButton()
} }
@@ -139,8 +144,8 @@ object SystemUITool {
showDialog { showDialog {
title = "获取 Root 权限失败" title = "获取 Root 权限失败"
msg = "当前无法获取 Root 权限,请确认你的设备已经被 Root 且同意授予 Root 权限。\n" + msg = "当前无法获取 Root 权限,请确认你的设备已经被 Root 且同意授予 Root 权限。\n" +
"如果你正在使用 Magisk 并安装了 Shamiko 模块," + "如果你正在使用 Magisk 并安装了 Shamiko 模块," +
"请确认当前是否正处于白名单模式。 (白名单模式将导致无法申请 Root 权限)" "请确认当前是否正处于白名单模式。 (白名单模式将导致无法申请 Root 权限)"
confirmButton(text = "我知道了") confirmButton(text = "我知道了")
} }
@@ -160,8 +165,8 @@ object SystemUITool {
}.onFailure { }.onFailure {
execShell( execShell(
cmd = "am start -a" + cmd = "am start -a" +
"com.miui.notification " + "com.miui.notification " +
"com.miui.notification/miui.notification.management.activity.NotificationDisplaySettingsActivity" "com.miui.notification/miui.notification.management.activity.NotificationDisplaySettingsActivity"
).also { ).also {
when { when {
it.isBlank() -> context.showWhenAccessRootFail() it.isBlank() -> context.showWhenAccessRootFail()
@@ -181,9 +186,9 @@ object SystemUITool {
context.showDialog { context.showDialog {
title = "重启系统界面" title = "重启系统界面"
msg = "你确定要立即重启系统界面吗?\n\n" + msg = "你确定要立即重启系统界面吗?\n\n" +
"部分 MIUI 内测和开发版中使用了状态栏主题可能会发生主题失效的情况,这种情况请再重启一次即可。\n\n" + "部分 MIUI 内测和开发版中使用了状态栏主题可能会发生主题失效的情况,这种情况请再重启一次即可。\n\n" +
"重启过程会黑屏并等待进入锁屏重新解锁。" + (if (isDynamicAvailable) "重启过程会黑屏并等待进入锁屏重新解锁。" + (if (isDynamicAvailable)
"\n\n你也可以选择“立即生效”来动态刷新系统界面并生效当前模块设置。" else "") "\n\n你也可以选择“立即生效”来动态刷新系统界面并生效当前模块设置。" else "")
confirmButton { confirmButton {
execShell(cmd = "pgrep systemui").also { pid -> execShell(cmd = "pgrep systemui").also { pid ->
if (pid.isNotBlank()) if (pid.isNotBlank())

View File

@@ -1,60 +0,0 @@
/*
* MIUINativeNotifyIcon - Fix the native notification bar icon function abandoned by the MIUI development team.
* Copyright (C) 2017-2023 Fankes Studio(qzmmcn@163.com)
* https://github.com/fankes/MIUINativeNotifyIcon
*
* This software is non-free but opensource software: you can redistribute it
* and/or modify it under the terms of the GNU Affero General Public License
* as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
* <p>
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* and eula along with this software. If not, see
* <https://www.gnu.org/licenses/>
*
* This file is Created by fankes on 2022/5/30.
*/
package com.fankes.miui.notify.utils.tool
import android.content.Context
import com.fankes.miui.notify.BuildConfig
import com.fankes.miui.notify.utils.factory.openBrowser
import com.fankes.miui.notify.utils.factory.showDialog
import com.highcapable.yukihookapi.YukiHookAPI
import com.highcapable.yukihookapi.hook.factory.prefs
import com.highcapable.yukihookapi.hook.xposed.prefs.data.PrefsData
/**
* [YukiHookAPI] 的自动推广工具类
*/
object YukiPromoteTool {
/** 推广已读存储键值 */
private val YUKI_PROMOTE_READED = PrefsData("yuki_promote_readed_${BuildConfig.VERSION_NAME}", false)
/**
* 显示推广对话框
* @param context 实例
*/
fun promote(context: Context) {
fun saveReaded() = context.prefs().edit { put(YUKI_PROMOTE_READED, value = true) }
if (context.prefs().get(YUKI_PROMOTE_READED).not())
context.showDialog {
title = "面向开发者的推广"
msg = "你想快速拥有一个自己的 Xposed 模块吗,你只需要拥有基础的 Android 开发经验以及使用 Kotlin 编程语言即可。\n\n" +
"快来体验 YukiHookAPI这是一个使用 Kotlin 构建的高效 Hook API 与 Xposed 模块解决方案,助你的开发变得更轻松。"
confirmButton(text = "去看看") {
context.openBrowser(url = "https://github.com/fankes/YukiHookAPI")
saveReaded()
}
cancelButton(text = "我不是开发者") { saveReaded() }
noCancelable()
}
}
}

View File

@@ -0,0 +1,37 @@
/*
* MIUINativeNotifyIcon - Fix the native notification bar icon function abandoned by the MIUI development team.
* Copyright (C) 2017 Fankes Studio(qzmmcn@163.com)
* https://github.com/fankes/MIUINativeNotifyIcon
*
* This software is non-free but opensource software: you can redistribute it
* and/or modify it under the terms of the GNU Affero General Public License
* as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
* <p>
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* and eula along with this software. If not, see
* <https://www.gnu.org/licenses/>
*
* This file is created by fankes on 2023/9/17.
*/
@file:Suppress("unused")
package com.fankes.miui.notify.wrapper
import com.fankes.miui.notify.BuildConfig
/**
* 对 [BuildConfig] 的包装
*/
object BuildConfigWrapper {
const val APPLICATION_ID = BuildConfig.APPLICATION_ID
const val VERSION_NAME = BuildConfig.VERSION_NAME
const val VERSION_CODE = BuildConfig.VERSION_CODE
val isDebug = BuildConfig.DEBUG
}

View File

@@ -20,6 +20,7 @@
android:paddingBottom="5dp"> android:paddingBottom="5dp">
<TextView <TextView
android:id="@+id/main_title"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1" android:layout_weight="1"
@@ -270,68 +271,50 @@
android:textColor="@color/colorTextDark" android:textColor="@color/colorTextDark"
android:textSize="12sp" /> android:textSize="12sp" />
<com.fankes.miui.notify.ui.widget.MaterialSwitch <LinearLayout
android:id="@+id/module_prefs_cache_enable_switch" android:id="@+id/module_enable_log_item"
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginBottom="10dp"
android:text="启用数据缓存"
android:textColor="@color/colorTextGray"
android:textSize="15sp" />
<TextView
android:id="@+id/module_prefs_cache_enable_text"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginBottom="5dp"
android:alpha="0.6"
android:lineSpacingExtra="6dp"
android:text="此选项默认开启,默认情况下模块会将数据缓存在内存中,防止每次重复读取数据造成卡顿,如果开启此选项后一段时间导致系统界面 (系统 UI) 崩溃 (内存溢出),你可以尝试关闭此选项,但是这有可能会造成在通知较多时下拉通知栏出现卡顿。"
android:textColor="@color/colorTextDark"
android:textSize="12sp" />
<com.fankes.miui.notify.ui.widget.MaterialSwitch
android:id="@+id/module_enable_log_switch"
android:layout_width="match_parent"
android:layout_height="35dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginBottom="5dp"
android:text="启用调试日志"
android:textColor="@color/colorTextGray"
android:textSize="15sp" />
<TextView
android:id="@+id/exp_all_debug_log_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="13dp"
android:layout_marginRight="13dp"
android:layout_marginBottom="10dp" android:layout_marginBottom="10dp"
android:background="@drawable/bg_button_round" android:orientation="vertical">
android:gravity="center"
android:padding="10dp"
android:singleLine="true"
android:text="导出全部调试日志"
android:textColor="@color/colorTextGray"
android:textSize="15sp" />
<TextView <com.fankes.miui.notify.ui.widget.MaterialSwitch
android:id="@+id/module_enable_log_text" android:id="@+id/module_enable_log_switch"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="30dp"
android:layout_marginLeft="15dp" android:layout_marginLeft="15dp"
android:layout_marginRight="15dp" android:layout_marginRight="15dp"
android:layout_marginBottom="10dp" android:layout_marginBottom="10dp"
android:alpha="0.6" android:text="启用调试日志"
android:lineSpacingExtra="6dp" android:textColor="@color/colorTextGray"
android:text="默认情况下不建议开启此选项,仅在模块故障时开启,此时你可以发送调试日志给开发者帮助我们快速定位问题。" android:textSize="15sp" />
android:textColor="@color/colorTextDark"
android:textSize="12sp" /> <TextView
android:id="@+id/exp_all_debug_log_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="13dp"
android:layout_marginRight="13dp"
android:layout_marginBottom="10dp"
android:background="@drawable/bg_button_round"
android:gravity="center"
android:padding="10dp"
android:singleLine="true"
android:text="导出全部调试日志"
android:textColor="@color/colorTextGray"
android:textSize="15sp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:alpha="0.6"
android:lineSpacingExtra="6dp"
android:text="默认情况下不建议开启此选项,仅在模块故障时开启,此时你可以发送调试日志给开发者帮助我们快速定位问题。"
android:textColor="@color/colorTextDark"
android:textSize="12sp" />
</LinearLayout>
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout
@@ -395,7 +378,7 @@
android:layout_marginBottom="10dp" android:layout_marginBottom="10dp"
android:alpha="0.6" android:alpha="0.6"
android:lineSpacingExtra="6dp" android:lineSpacingExtra="6dp"
android:text="此选项默认开启MIUI 默认最多只能显示 3 个图标,其余图标将变成省略号,你可以在下方自定义最多显示的图标个数,修改为 0 则只会显示省略号代表图标个数,为防止发生异常,最大限制 100 个,超出的图标可能会被信号或网速指示器遮挡。" android:text="此选项默认开启MIUI 默认最多只能显示 3 个图标 (HyperOS 是 1 个),其余图标将变成省略号,你可以在下方自定义最多显示的图标个数,修改为 0 则只会显示省略号代表图标个数,为防止发生异常,最大限制 100 个,超出的图标可能会被信号或网速指示器遮挡。"
android:textColor="@color/colorTextDark" android:textColor="@color/colorTextDark"
android:textSize="12sp" /> android:textSize="12sp" />
@@ -405,7 +388,7 @@
android:layout_marginBottom="10dp" android:layout_marginBottom="10dp"
android:alpha="0.6" android:alpha="0.6"
android:lineSpacingExtra="6dp" android:lineSpacingExtra="6dp"
android:text="此功能针对不同类型的异形屏设备所搭载的 MIUI 会有不同的效果,如果你正在使用的是中置挖孔屏设备,那么通知图标的个数无论多少都不会超过挖孔区域,如果是居左或居右挖孔屏设备则通知图标的个数不会超过右侧信号图标区域。" android:text="此功能针对不同类型的异形屏设备所搭载的 MIUI、HyperOS 会有不同的效果,如果你正在使用的是中置挖孔屏设备,那么通知图标的个数无论多少都不会超过挖孔区域,如果是居左或居右挖孔屏设备则通知图标的个数不会超过右侧信号图标区域。"
android:textColor="@color/colorTextDark" android:textColor="@color/colorTextDark"
android:textSize="12sp" android:textSize="12sp"
android:textStyle="bold" /> android:textStyle="bold" />
@@ -781,7 +764,7 @@
android:gravity="center" android:gravity="center"
android:padding="10dp" android:padding="10dp"
android:singleLine="true" android:singleLine="true"
android:text="打开 MIUI 通知显示设置" android:text="打开系统通知显示设置"
android:textColor="@color/colorTextGray" android:textColor="@color/colorTextGray"
android:textSize="15sp" /> android:textSize="15sp" />
@@ -792,7 +775,7 @@
android:layout_marginRight="15dp" android:layout_marginRight="15dp"
android:alpha="0.6" android:alpha="0.6"
android:lineSpacingExtra="6dp" android:lineSpacingExtra="6dp"
android:text="点击上方按钮可以直接打开 MIUI 的通知显示设置界面,可以调整当前通知栏显示的通知样式为 MIUI 经典样式或原生样式,如果无法打开则是当前系统不支持此功能。" android:text="点击上方按钮可以直接打开系统的通知显示设置界面,可以调整当前通知栏显示的通知样式为 MIUI 经典样式或原生样式,如果无法打开则是当前系统不支持此功能。"
android:textColor="@color/colorTextDark" android:textColor="@color/colorTextDark"
android:textSize="12sp" /> android:textSize="12sp" />
@@ -894,12 +877,40 @@
android:layout_marginRight="15dp" android:layout_marginRight="15dp"
android:alpha="0.6" android:alpha="0.6"
android:lineSpacingExtra="6dp" android:lineSpacingExtra="6dp"
android:text="此功能仅支持 Android 12 及以上系统的 Material 3 通知图标风格以及 MIUI 后期的经典样式通知图标风格。" android:text="此功能仅支持 Android 12 及以上系统的 Material 3 通知图标风格以及 MIUI、HyperOS 后期的经典样式通知图标风格。"
android:textColor="@color/colorTextDark" android:textColor="@color/colorTextDark"
android:textSize="12sp" android:textSize="12sp"
android:textStyle="bold" /> android:textStyle="bold" />
</LinearLayout> </LinearLayout>
<LinearLayout
android:id="@+id/miui_notify_icon_replacement_item"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.fankes.miui.notify.ui.widget.MaterialSwitch
android:id="@+id/miui_notify_icon_replacement_switch"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="15dp"
android:paddingRight="15dp"
android:text="替换经典样式通知栏的通知图标"
android:textColor="@color/colorTextGray"
android:textSize="15sp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:alpha="0.6"
android:lineSpacingExtra="6dp"
android:paddingLeft="15dp"
android:paddingRight="15dp"
android:text="此选项默认开启,开启后经典 (MIUI) 样式的下拉通知栏中的通知图标将同样应用替换后的通知图标,否则将保持系统自己设置的图标。(此功能无法对所有系统版本兼容)"
android:textColor="@color/colorTextDark"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/notify_icon_force_system_color_item" android:id="@+id/notify_icon_force_system_color_item"
android:layout_width="match_parent" android:layout_width="match_parent"
@@ -1094,6 +1105,34 @@
android:textSize="12sp" /> android:textSize="12sp" />
</LinearLayout> </LinearLayout>
<LinearLayout
android:id="@+id/miui_focus_notify_icon_fix_item"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<com.fankes.miui.notify.ui.widget.MaterialSwitch
android:id="@+id/miui_focus_notify_icon_fix_switch"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="15dp"
android:paddingRight="15dp"
android:text="是否强制启用焦点通知反色"
android:textColor="@color/colorTextGray"
android:textSize="15sp" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:alpha="0.6"
android:lineSpacingExtra="6dp"
android:paddingLeft="15dp"
android:paddingRight="15dp"
android:text="是否强制启用焦点通知反色,由于无法准确判断反色,所以给了个强制开关。(默认关闭)"
android:textColor="@color/colorTextDark"
android:textSize="12sp" />
</LinearLayout>
<LinearLayout <LinearLayout
android:id="@+id/notify_icon_fix_notify_item" android:id="@+id/notify_icon_fix_notify_item"
android:layout_width="match_parent" android:layout_width="match_parent"
@@ -1403,7 +1442,8 @@
<ImageView <ImageView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:src="@mipmap/bg_qr_pay" /> android:adjustViewBounds="true"
android:src="@mipmap/bg_payment_code" />
</androidx.cardview.widget.CardView> </androidx.cardview.widget.CardView>
<TextView <TextView
@@ -1441,7 +1481,36 @@
android:ellipsize="end" android:ellipsize="end"
android:lineSpacingExtra="6dp" android:lineSpacingExtra="6dp"
android:maxLines="2" android:maxLines="2"
android:text="此模块使用 YukiHookAPI 构建。\n了解更多 https://github.com/fankes/YukiHookAPI" android:text="此模块使用 YukiHookAPI 构建。\n了解更多 https://github.com/HighCapable/YukiHookAPI"
android:textColor="@color/colorTextGray"
android:textSize="11sp" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginBottom="10dp"
android:background="@drawable/bg_permotion_round"
android:gravity="center|start"
android:orientation="horizontal"
android:padding="10dp">
<ImageView
android:layout_width="35dp"
android:layout_height="35dp"
android:layout_marginEnd="10dp"
android:src="@mipmap/ic_kavaref" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:autoLink="web"
android:ellipsize="end"
android:lineSpacingExtra="6dp"
android:maxLines="2"
android:text="此模块使用 KavaRef 强力驱动。\n了解更多 https://github.com/HighCapable/KavaRef"
android:textColor="@color/colorTextGray" android:textColor="@color/colorTextGray"
android:textSize="11sp" /> android:textSize="11sp" />
</LinearLayout> </LinearLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 122 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 201 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

View File

@@ -1,26 +0,0 @@
plugins {
id 'com.android.application' version '7.4.1' apply false
id 'com.android.library' version '7.4.1' apply false
id 'org.jetbrains.kotlin.android' version '1.8.20' apply false
id 'com.google.devtools.ksp' version '1.8.20-1.0.10' apply false
}
ext {
android = [
compileSdk: 33,
minSdk : 28,
targetSdk : 33
]
app = [
versionName : '2.98',
versionCode : 38,
signingConfigs: [
secretConfigsDirPath : "${projectDir.getAbsolutePath()}/.secret",
secretConfigsFileName: "key_store_secret.json"
]
]
}
task clean(type: Delete) {
delete rootProject.buildDir
}

21
build.gradle.kts Normal file
View File

@@ -0,0 +1,21 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile
plugins {
autowire(libs.plugins.android.application) apply false
autowire(libs.plugins.kotlin.android) apply false
autowire(libs.plugins.kotlin.ksp) apply false
}
allprojects {
tasks.withType<KotlinJvmCompile>().configureEach {
compilerOptions {
jvmTarget = JvmTarget.JVM_17
freeCompilerArgs.addAll(
"-Xno-param-assertions",
"-Xno-call-assertions",
"-Xno-receiver-assertions"
)
}
}
}

View File

@@ -1,23 +1,17 @@
# Project-wide Gradle settings. # Compiler Configuration
# IDE (e.g. Android Studio) users: org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-XX:+UseParallelGC
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app"s APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX android.nonTransitiveRClass=true
android.enableJetifier=true
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official kotlin.code.style=official
# Incremental # Project Configuration
kotlin.incremental.useClasspathSnapshot=true project.name=MIUINativeNotifyIcon
project.android.compileSdk=36
project.android.minSdk=28
project.android.targetSdk=36
project.app.packageName=com.fankes.miui.notify
project.app.versionName="2.110"
project.app.versionCode=42
project.app.signing.keyAlias=public
project.app.signing.keyPassword="123456"
project.app.signing.storePassword="123456"
project.app.signing.storeFilePath=.secret/universal.p12

View File

@@ -0,0 +1,84 @@
preferences:
autowire-on-sync-mode: UPDATE_OPTIONAL_DEPENDENCIES
repositories-mode: FAIL_ON_PROJECT_REPOS
repositories:
gradle-plugin-portal:
scope: PLUGINS
google:
maven-central:
jit-pack:
sonatype-oss-releases:
rovo89-xposed-api:
scope: LIBRARIES
url: https://api.xposed.info/
content:
include:
group:
de.robv.android.xposed
fankes-maven-releases:
url: https://raw.githubusercontent.com/fankes/maven-repository/main/repository/releases
plugins:
com.android.application:
alias: android-application
version: 8.12.1
org.jetbrains.kotlin.android:
alias: kotlin-android
version: 2.2.10
com.google.devtools.ksp:
alias: kotlin-ksp
version: 2.2.10-2.0.2
libraries:
com.fankes.projectpromote:
project-promote:
version: 1.0.0
repositories:
fankes-maven-releases
de.robv.android.xposed:
api:
version: 82
repositories:
rovo89-xposed-api
com.highcapable.yukihookapi:
api:
version: 1.3.0
ksp-xposed:
version-ref: <this>::api
com.highcapable.kavaref:
kavaref-core:
version: 1.0.1
kavaref-extension:
version: 1.0.1
com.github.topjohnwu.libsu:
core:
version: 5.2.2
auto-update: false
com.github.duanhong169:
drawabletoolbox:
version: 1.0.7
com.squareup.okhttp3:
okhttp:
version: 5.1.0
androidx.core:
core-ktx:
version: 1.17.0
androidx.appcompat:
appcompat:
version: 1.7.1
com.google.android.material:
material:
version: 1.12.0
androidx.constraintlayout:
constraintlayout:
version: 2.2.1
androidx.test.ext:
junit:
version: 1.3.0
androidx.test.espresso:
espresso-core:
version: 3.7.0
junit:
junit:
version: 4.13.2

View File

@@ -1,6 +1,5 @@
#Wed May 25 04:36:53 CST 2022
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME

BIN
img-src/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

Before

Width:  |  Height:  |  Size: 9.8 KiB

After

Width:  |  Height:  |  Size: 9.8 KiB

View File

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 35 KiB

View File

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 37 KiB

View File

Before

Width:  |  Height:  |  Size: 9.1 KiB

After

Width:  |  Height:  |  Size: 9.1 KiB

View File

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 35 KiB

View File

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 41 KiB

View File

Before

Width:  |  Height:  |  Size: 72 KiB

After

Width:  |  Height:  |  Size: 72 KiB

View File

@@ -1,19 +0,0 @@
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
maven { url "https://api.xposed.info/" }
maven { url "https://www.jitpack.io" }
maven { url "https://s01.oss.sonatype.org/content/repositories/releases" }
mavenCentral()
}
}
rootProject.name = "MIUINativeNotifyIcon"
include ':app'

27
settings.gradle.kts Normal file
View File

@@ -0,0 +1,27 @@
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
}
plugins {
id("com.highcapable.sweetdependency") version "1.0.4"
id("com.highcapable.sweetproperty") version "1.0.8"
}
sweetProperty {
global {
all {
permanentKeyValues("GITHUB_CI_COMMIT_ID" to "")
generateFrom(ROOT_PROJECT, SYSTEM_ENV)
}
sourcesCode {
includeKeys("GITHUB_CI_COMMIT_ID")
// 关闭类型自动转换功能,防止一些特殊 "COMMIT ID" 被生成为数值
isEnableTypeAutoConversion = false
}
}
rootProject { all { isEnable = false } }
}
rootProject.name = "MIUINativeNotifyIcon"
include(":app")