mirror of
https://github.com/fankes/MIUINativeNotifyIcon.git
synced 2025-09-04 01:35:26 +08:00
Modify support MIUI 14 and add unsupported note in FunctionFactory, MainActivity
This commit is contained in:
@@ -51,7 +51,7 @@ object HookEntry : IYukiHookXposedInit {
|
||||
/** 系统版本低于 Android P 停止 Hook */
|
||||
isLowerAndroidP -> loggerW(msg = "Aborted Hook -> This System is lower than Android P")
|
||||
/** 不是支持的 MIUI 系统停止 Hook */
|
||||
isNotSupportMiuiVersion -> loggerW(msg = "Aborted Hook -> This MIUI Version $miuiVersion not supported")
|
||||
isNotSupportMiuiVersion -> loggerW(msg = "Aborted Hook -> This MIUI Version ${miuiVersion.ifBlank { "unknown" }} not supported")
|
||||
/** Hook 被手动关闭停止 Hook */
|
||||
prefs.get(DataConst.ENABLE_MODULE).not() -> loggerW(msg = "Aborted Hook -> Hook Closed")
|
||||
/** 开始 Hook */
|
||||
|
@@ -80,27 +80,40 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
||||
isNotMIUI ->
|
||||
showDialog {
|
||||
title = "不是 MIUI 系统"
|
||||
msg = "此模块专为 MIUI 系统打造,当前无法识别你的系统为 MIUI,所以模块无法工作。\n" +
|
||||
"如有问题请联系 酷安 @星夜不荟"
|
||||
confirmButton(text = "退出") { finish() }
|
||||
msg = "此模块专为 MIUI 系统打造,当前无法识别你的系统为 MIUI,所以模块无法工作。"
|
||||
confirmButton(text = "查看支持的模块") {
|
||||
openBrowser(url = "https://github.com/fankes/AndroidNotifyIconAdapt")
|
||||
finish()
|
||||
}
|
||||
cancelButton(text = "退出") { finish() }
|
||||
noCancelable()
|
||||
}
|
||||
/** 判断最低 Android 系统版本 */
|
||||
isLowerAndroidP ->
|
||||
showDialog {
|
||||
title = "Android 系统版本过低"
|
||||
msg = "此模块最低支持基于 Android 9 的 MIUI 系统,你的系统版本过低不再进行适配。\n" +
|
||||
"如有问题请联系 酷安 @星夜不荟"
|
||||
confirmButton(text = "退出") { finish() }
|
||||
msg = "此模块最低支持基于 Android 9 的 MIUI 系统,你的系统版本过低不再进行适配。\n\n" +
|
||||
"若有其它疑问,你可以点击下方按钮前往项目地址进行反馈。"
|
||||
confirmButton(text = "前往项目地址") {
|
||||
openProjectUrl()
|
||||
finish()
|
||||
}
|
||||
cancelButton(text = "退出") { finish() }
|
||||
noCancelable()
|
||||
}
|
||||
/** 判断最低 MIUI 版本 */
|
||||
/** 判断支持的 MIUI 版本 */
|
||||
isNotSupportMiuiVersion ->
|
||||
showDialog {
|
||||
title = "MIUI 版本过低"
|
||||
msg = "此模块最低支持 MIUI 12 系统,你的 MIUI 版本为 ${miuiVersion},不再进行适配。\n" +
|
||||
"如有问题请联系 酷安 @星夜不荟"
|
||||
confirmButton(text = "退出") { finish() }
|
||||
title = "不支持的 MIUI 版本"
|
||||
msg = (if (miuiVersion.isNotBlank())
|
||||
"此模块目前仅支持 MIUI 12~14 系统,你的 MIUI 版本为 ${miuiVersion},暂不支持。\n\n" +
|
||||
"如果你的 MIUI 版本识别有误,请检查是否有相关插件修改了系统版本。\n\n"
|
||||
else "无法获取 MIUI 版本,请检查你是否修改了系统参数或使用非官方系统。\n\n") + "若有其它疑问,你可以点击下方按钮前往项目地址进行反馈。"
|
||||
confirmButton(text = "前往项目地址") {
|
||||
openProjectUrl()
|
||||
finish()
|
||||
}
|
||||
cancelButton(text = "退出") { finish() }
|
||||
noCancelable()
|
||||
}
|
||||
/** 判断是否 Hook */
|
||||
@@ -306,13 +319,18 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
||||
/** 重启按钮点击事件 */
|
||||
binding.titleRestartIcon.setOnClickListener { SystemUITool.restartSystemUI(context = this) }
|
||||
/** 项目地址按钮点击事件 */
|
||||
binding.titleGithubIcon.setOnClickListener { openBrowser(url = "https://github.com/fankes/MIUINativeNotifyIcon") }
|
||||
binding.titleGithubIcon.setOnClickListener { openProjectUrl() }
|
||||
/** 恰饭! */
|
||||
binding.linkWithFollowMe.setOnClickListener {
|
||||
openBrowser(url = "https://www.coolapk.com/u/876977", packageName = "com.coolapk.market")
|
||||
}
|
||||
}
|
||||
|
||||
/** 前往项目地址 */
|
||||
private fun openProjectUrl() {
|
||||
openBrowser(url = "https://github.com/fankes/MIUINativeNotifyIcon")
|
||||
}
|
||||
|
||||
/** 刷新模块状态 */
|
||||
private fun refreshModuleStatus() {
|
||||
binding.mainLinStatus.setBackgroundResource(
|
||||
|
@@ -131,6 +131,7 @@ val isSupportMiuiVersion
|
||||
"12" -> true
|
||||
"12.5" -> true
|
||||
"13" -> true
|
||||
"14" -> true
|
||||
else -> false
|
||||
}
|
||||
|
||||
@@ -146,19 +147,17 @@ inline val isNotSupportMiuiVersion get() = !isSupportMiuiVersion
|
||||
*/
|
||||
val miuiVersion
|
||||
get() = if (isMIUI)
|
||||
findPropString("ro.miui.ui.version.name", "V无法获取").let {
|
||||
findPropString("ro.miui.ui.version.name").let {
|
||||
when (it) {
|
||||
"V110" -> "11"
|
||||
"V11" -> "11"
|
||||
"V120" -> "12"
|
||||
"V12" -> "12"
|
||||
"V11", "V110" -> "11"
|
||||
"V12", "V120" -> "12"
|
||||
"V125" -> "12.5"
|
||||
"V130" -> "13"
|
||||
"V13" -> "13"
|
||||
else -> it.replace(oldValue = "V", newValue = "")
|
||||
"V13", "V130" -> "13"
|
||||
"V14", "V140" -> "14"
|
||||
else -> it.replace("V", "")
|
||||
}
|
||||
}.trim()
|
||||
else "NULL"
|
||||
else ""
|
||||
|
||||
/**
|
||||
* 获取 MIUI 版本号
|
||||
@@ -178,33 +177,9 @@ val miuiIncrementalVersion get() = findPropString("ro.system.build.version.incre
|
||||
*/
|
||||
val miuiFullVersion
|
||||
get() = if (isMIUI) miuiIncrementalVersion.let {
|
||||
if (it.lowercase().contains("a") ||
|
||||
it.lowercase().contains("b") ||
|
||||
it.lowercase().contains("c") ||
|
||||
it.lowercase().contains("d") ||
|
||||
it.lowercase().contains("e") ||
|
||||
it.lowercase().contains("f") ||
|
||||
it.lowercase().contains("g") ||
|
||||
it.lowercase().contains("h") ||
|
||||
it.lowercase().contains("i") ||
|
||||
it.lowercase().contains("j") ||
|
||||
it.lowercase().contains("k") ||
|
||||
it.lowercase().contains("l") ||
|
||||
it.lowercase().contains("m") ||
|
||||
it.lowercase().contains("n") ||
|
||||
it.lowercase().contains("o") ||
|
||||
it.lowercase().contains("p") ||
|
||||
it.lowercase().contains("q") ||
|
||||
it.lowercase().contains("r") ||
|
||||
it.lowercase().contains("s") ||
|
||||
it.lowercase().contains("t") ||
|
||||
it.lowercase().contains("u") ||
|
||||
it.lowercase().contains("v") ||
|
||||
it.lowercase().contains("w") ||
|
||||
it.lowercase().contains("x") ||
|
||||
it.lowercase().contains("y") ||
|
||||
it.lowercase().contains("z")
|
||||
) "$it 稳定版" else "V$miuiVersion $it 开发版"
|
||||
if (it.lowercase().endsWith(".dev").not() && it.lowercase().any { e -> e.code in 97..122 })
|
||||
"$it 稳定版"
|
||||
else "V$miuiVersion $it 开发版"
|
||||
} else "不是 MIUI 系统"
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user