mirror of
https://github.com/fankes/MIUINativeNotifyIcon.git
synced 2025-09-05 18:25:23 +08:00
合并代码到新项目
This commit is contained in:
@@ -1,50 +0,0 @@
|
|||||||
# 开始贡献
|
|
||||||
|
|
||||||
欢迎为通知图标优化名单贡献宝贵资源!<br/>
|
|
||||||
|
|
||||||
## 分支规定
|
|
||||||
|
|
||||||
不管是直接 Push 代码还是提交 Pull Request,都必须使 commit 指向 master 分支。
|
|
||||||
|
|
||||||
## 代码格式规范
|
|
||||||
|
|
||||||
- 1.全部提交代码必须使用 IDE(Android Studio 或 IDEA) 进行格式化,未经格式化的代码将拒绝合并提交请求
|
|
||||||
- 2.代码必须使用 4 spaces 缩进格式化
|
|
||||||
|
|
||||||
## 贡献方法
|
|
||||||
|
|
||||||
- 2022.02.25 适配数据已变更为云端更新
|
|
||||||
- 在下方的 JSON 文件中添加新的 APP 通知图标适配条目
|
|
||||||
- [NotifyIconsSupportConfig.json](https://github.com/fankes/MIUINativeNotifyIcon/blob/master/iconPack/NotifyIconsSupportConfig.json)
|
|
||||||
- 使用灰度位图转 Base64 来得到 Base64 的位图数据字符串
|
|
||||||
- [BitmapToBase64](https://github.com/fankes/BitmapToBase64)
|
|
||||||
- 新增条目的模板如下所示
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"appName": "", // APP 名称
|
|
||||||
"packageName": "", // APP 包名
|
|
||||||
"isEnabled": true, // 是否默认启用替换彩色图标 - 关闭后将全部停止替换
|
|
||||||
"isEnabledAll": false, // 是否默认启用替换全部图标
|
|
||||||
"iconBitmap": "", // 位图数据 Base64 字符串
|
|
||||||
"iconColor": "#ff232323", // 通知栏中显示的图标颜色 - 不设置使用系统默认颜色 (不设置颜色可删除此项)
|
|
||||||
"contributorName": "" // 贡献者昵称
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
- 图标大小建议保持在 50x50
|
|
||||||
- 提交时请将后方的注释删除,否则不予合并代码
|
|
||||||
|
|
||||||
## 同步列表地址
|
|
||||||
|
|
||||||
- Github 直连地址 [Raw](https://raw.githubusercontent.com/fankes/MIUINativeNotifyIcon/master/iconPack/NotifyIconsSupportConfig.json)
|
|
||||||
- 数据将在稍后同步至 [Surge](https://fankes.mnn.surge.sh/NotifyIconsSupportConfig.json)
|
|
||||||
|
|
||||||
## 其它要求
|
|
||||||
|
|
||||||
- 1.调试性质或大批量注释代码,禁止提交
|
|
||||||
- 2.类名和方法名仅能由开发者进行修改和提交,禁止随意修改项目名称、方法名称以及类名
|
|
||||||
- 3.禁止随意更新项目依赖以及增加新的依赖,有问题请提前提交到 issues 进行说明
|
|
||||||
- 4.禁止更新项目版本号,版本号交由开发者合并代码并发布 release 版本
|
|
||||||
- 5.代码语言要求,请统一使用 Kotlin,除特殊情况外,不接受其他语言的提交
|
|
||||||
- 6.以上
|
|
11
README.md
11
README.md
@@ -29,16 +29,11 @@ Fix the native notification bar icon function abandoned by the MIUI development
|
|||||||
[Release](https://github.com/fankes/MIUINativeNotifyIcon/releases)
|
[Release](https://github.com/fankes/MIUINativeNotifyIcon/releases)
|
||||||
及[蓝奏云](https://fankes.lanzouy.com/b030o2e8h),从其他非正规渠道下载到的版本或对您造成任何影响均与我们无关。
|
及[蓝奏云](https://fankes.lanzouy.com/b030o2e8h),从其他非正规渠道下载到的版本或对您造成任何影响均与我们无关。
|
||||||
|
|
||||||
# 开始贡献
|
# 贡献通知优化图标
|
||||||
|
|
||||||
由于国内厂商 APP 的不规范彩色图标影响整体图标的美观,现在开放第三方 APP 的通知图标适配。<br/>
|
此项目是 `AndroidNotifyIconAdapt` 项目的一部分,详情请参考下方。<br/>
|
||||||
欢迎为通知图标优化名单贡献宝贵资源!<br/>
|
|
||||||
|
|
||||||
- [CONTRIBUTING](https://github.com/fankes/MIUINativeNotifyIcon/blob/master/CONTRIBUTING.md)
|
- [AndroidNotifyIconAdapt](https://github.com/fankes/AndroidNotifyIconAdapt)
|
||||||
|
|
||||||
# 通知测试
|
|
||||||
|
|
||||||
你可以 [点击这里](https://github.com/fankes/MIUINativeNotifyIcon/blob/master/tool/NotifyTester.apk) 下载工具测试通知图标是否生效。
|
|
||||||
|
|
||||||
# 历史背景
|
# 历史背景
|
||||||
|
|
||||||
|
@@ -27,6 +27,7 @@ import android.graphics.Color
|
|||||||
import com.fankes.miui.notify.bean.IconDataBean
|
import com.fankes.miui.notify.bean.IconDataBean
|
||||||
import com.fankes.miui.notify.hook.HookConst.NOTIFY_ICON_DATAS
|
import com.fankes.miui.notify.hook.HookConst.NOTIFY_ICON_DATAS
|
||||||
import com.fankes.miui.notify.utils.bitmap
|
import com.fankes.miui.notify.utils.bitmap
|
||||||
|
import com.fankes.miui.notify.utils.safeOf
|
||||||
import com.fankes.miui.notify.utils.safeOfNan
|
import com.fankes.miui.notify.utils.safeOfNan
|
||||||
import com.highcapable.yukihookapi.hook.factory.modulePrefs
|
import com.highcapable.yukihookapi.hook.factory.modulePrefs
|
||||||
import com.highcapable.yukihookapi.hook.param.PackageParam
|
import com.highcapable.yukihookapi.hook.param.PackageParam
|
||||||
@@ -76,6 +77,16 @@ class IconPackParams(private val context: Context? = null, private val param: Pa
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拼接图标数组数据
|
||||||
|
* @param dataJson1 图标数据 JSON
|
||||||
|
* @param dataJson2 图标数据 JSON
|
||||||
|
* @return [String] 拼接后的数据
|
||||||
|
*/
|
||||||
|
fun splicingJsonArray(dataJson1: String, dataJson2: String) = safeOf(default = "[]") {
|
||||||
|
dataJson1.replace(oldValue = "]", newValue = "") + "," + dataJson2.replace(oldValue = "[", newValue = "")
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 比较图标数据不相等
|
* 比较图标数据不相等
|
||||||
* @param dataJson 图标数据 JSON
|
* @param dataJson 图标数据 JSON
|
||||||
|
@@ -195,7 +195,7 @@ class ConfigureActivity : BaseActivity() {
|
|||||||
runCatching {
|
runCatching {
|
||||||
startActivity(Intent().apply {
|
startActivity(Intent().apply {
|
||||||
action = "android.intent.action.VIEW"
|
action = "android.intent.action.VIEW"
|
||||||
data = Uri.parse("https://github.com/fankes/MIUINativeNotifyIcon/blob/master/CONTRIBUTING.md")
|
data = Uri.parse("https://github.com/fankes/AndroidNotifyIconAdapt/blob/main/CONTRIBUTING.md")
|
||||||
/** 防止顶栈一样重叠在自己的 APP 中 */
|
/** 防止顶栈一样重叠在自己的 APP 中 */
|
||||||
flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
flags = Intent.FLAG_ACTIVITY_NEW_TASK
|
||||||
})
|
})
|
||||||
@@ -221,45 +221,45 @@ class ConfigureActivity : BaseActivity() {
|
|||||||
title = if (iconAllDatas.isNotEmpty()) "同步列表" else "初始化"
|
title = if (iconAllDatas.isNotEmpty()) "同步列表" else "初始化"
|
||||||
msg = (if (iconAllDatas.isNotEmpty()) "建议定期从云端拉取数据以获得最新的通知图标优化名单适配数据。\n\n"
|
msg = (if (iconAllDatas.isNotEmpty()) "建议定期从云端拉取数据以获得最新的通知图标优化名单适配数据。\n\n"
|
||||||
else "首次装载需要从云端下载最新适配数据,后续可继续前往这里检查更新。\n\n") +
|
else "首次装载需要从云端下载最新适配数据,后续可继续前往这里检查更新。\n\n") +
|
||||||
"[Github] 同步最新数据,无法连接可能需要魔法上网。\n\n[Surge] 缓存 CDN 数据,可以直连,但数据可能会有更新延迟。\n\n" +
|
"通过从 Github 同步最新数据,无法连接可能需要魔法上网。"
|
||||||
"如果以上地址均无法使用,建议魔法上网或修改 Host 文件直连。"
|
confirmButton(text = "开始同步") { onRefreshing() }
|
||||||
confirmButton(text = "Surge") {
|
cancelButton()
|
||||||
onRefreshing(url = "https://fankes.mnn.surge.sh/NotifyIconsSupportConfig.json")
|
|
||||||
}
|
|
||||||
cancelButton(text = "Github") {
|
|
||||||
onRefreshing(url = "https://raw.githubusercontent.com/fankes/MIUINativeNotifyIcon/master/iconPack/NotifyIconsSupportConfig.json")
|
|
||||||
}
|
|
||||||
neutralButton(text = "取消")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/** 开始更新数据 */
|
||||||
* 开始更新数据
|
private fun onRefreshing() {
|
||||||
* @param url 使用的地址
|
|
||||||
*/
|
|
||||||
private fun onRefreshing(url: String) {
|
|
||||||
ProgressDialog(this).apply {
|
ProgressDialog(this).apply {
|
||||||
setDefaultStyle(context = this@ConfigureActivity)
|
setDefaultStyle(context = this@ConfigureActivity)
|
||||||
setCancelable(false)
|
setCancelable(false)
|
||||||
setTitle("同步中")
|
setTitle("同步中")
|
||||||
setMessage("正在同步云端数据")
|
setMessage("正在同步 OS 数据")
|
||||||
show()
|
show()
|
||||||
}.also {
|
}.also {
|
||||||
ClientRequestTool.wait(context = this, url) { isDone, content ->
|
ClientRequestTool.wait(
|
||||||
it.cancel()
|
context = this,
|
||||||
IconPackParams(context = this).also { params ->
|
url = "https://raw.githubusercontent.com/fankes/AndroidNotifyIconAdapt/main/OS/MIUI/NotifyIconsSupportConfig.json"
|
||||||
if (isDone)
|
) { isDone1, ctOS ->
|
||||||
if (params.isCompareDifferent(content)) {
|
it.setMessage("正在同步 APP 数据")
|
||||||
params.save(content)
|
ClientRequestTool.wait(
|
||||||
filterText = ""
|
context = this,
|
||||||
mockLocalData()
|
url = "https://raw.githubusercontent.com/fankes/AndroidNotifyIconAdapt/main/APP/NotifyIconsSupportConfig.json"
|
||||||
SystemUITool.showNeedUpdateApplySnake(context = this)
|
) { isDone2, ctAPP ->
|
||||||
} else snake(msg = "列表数据已是最新")
|
it.cancel()
|
||||||
else
|
IconPackParams(context = this).also { params ->
|
||||||
showDialog {
|
if (isDone1 && isDone2) params.splicingJsonArray(ctOS, ctAPP).also {
|
||||||
title = "连接失败"
|
if (params.isCompareDifferent(it)) {
|
||||||
msg = "连接失败,错误如下:\n$content"
|
params.save(it)
|
||||||
confirmButton(text = "我知道了")
|
filterText = ""
|
||||||
}
|
mockLocalData()
|
||||||
|
SystemUITool.showNeedUpdateApplySnake(context = this)
|
||||||
|
} else snake(msg = "列表数据已是最新")
|
||||||
|
} else
|
||||||
|
showDialog {
|
||||||
|
title = "连接失败"
|
||||||
|
msg = "连接失败,错误如下:\n${if (!isDone1) ctOS else ctAPP}"
|
||||||
|
confirmButton(text = "我知道了")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Reference in New Issue
Block a user