mirror of
https://github.com/fankes/MIUINativeNotifyIcon.git
synced 2025-09-06 02:35:32 +08:00
Merge code
This commit is contained in:
@@ -26,11 +26,15 @@ package com.fankes.miui.notify.application
|
|||||||
|
|
||||||
import android.app.Application
|
import android.app.Application
|
||||||
import androidx.appcompat.app.AppCompatDelegate
|
import androidx.appcompat.app.AppCompatDelegate
|
||||||
|
import com.fankes.miui.notify.BuildConfig
|
||||||
|
|
||||||
class MNNApplication : Application() {
|
class MNNApplication : Application() {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
|
/** 当前模块的包名 */
|
||||||
|
const val MODULE_PACKAGE_NAME = BuildConfig.APPLICATION_ID
|
||||||
|
|
||||||
/** 全局静态实例 */
|
/** 全局静态实例 */
|
||||||
private var context: MNNApplication? = null
|
private var context: MNNApplication? = null
|
||||||
|
|
||||||
|
@@ -37,6 +37,7 @@ import android.view.ViewGroup
|
|||||||
import android.view.ViewOutlineProvider
|
import android.view.ViewOutlineProvider
|
||||||
import android.widget.ImageView
|
import android.widget.ImageView
|
||||||
import androidx.core.graphics.drawable.toBitmap
|
import androidx.core.graphics.drawable.toBitmap
|
||||||
|
import com.fankes.miui.notify.application.MNNApplication.Companion.MODULE_PACKAGE_NAME
|
||||||
import com.fankes.miui.notify.bean.IconDataBean
|
import com.fankes.miui.notify.bean.IconDataBean
|
||||||
import com.fankes.miui.notify.hook.HookConst.ENABLE_COLOR_ICON_COMPAT
|
import com.fankes.miui.notify.hook.HookConst.ENABLE_COLOR_ICON_COMPAT
|
||||||
import com.fankes.miui.notify.hook.HookConst.ENABLE_COLOR_ICON_HOOK
|
import com.fankes.miui.notify.hook.HookConst.ENABLE_COLOR_ICON_HOOK
|
||||||
@@ -54,6 +55,7 @@ import com.fankes.miui.notify.utils.drawable.drawabletoolbox.DrawableBuilder
|
|||||||
import com.fankes.miui.notify.utils.factory.*
|
import com.fankes.miui.notify.utils.factory.*
|
||||||
import com.fankes.miui.notify.utils.tool.BitmapCompatTool
|
import com.fankes.miui.notify.utils.tool.BitmapCompatTool
|
||||||
import com.fankes.miui.notify.utils.tool.IconAdaptationTool
|
import com.fankes.miui.notify.utils.tool.IconAdaptationTool
|
||||||
|
import com.fankes.miui.notify.utils.tool.IconRuleManagerTool
|
||||||
import com.highcapable.yukihookapi.annotation.xposed.InjectYukiHookWithXposed
|
import com.highcapable.yukihookapi.annotation.xposed.InjectYukiHookWithXposed
|
||||||
import com.highcapable.yukihookapi.hook.bean.VariousClass
|
import com.highcapable.yukihookapi.hook.bean.VariousClass
|
||||||
import com.highcapable.yukihookapi.hook.factory.*
|
import com.highcapable.yukihookapi.hook.factory.*
|
||||||
@@ -473,6 +475,11 @@ class HookEntry : YukiHookXposedInitProxy {
|
|||||||
} else false.also { printLogcat(tag = "IconColor", context, expandedNf, isCustom = false, isGrayscale = true) }
|
} else false.also { printLogcat(tag = "IconColor", context, expandedNf, isCustom = false, isGrayscale = true) }
|
||||||
else true.also { printLogcat(tag = "IconColor", context, expandedNf, isCustom = false, isGrayscale = false) }
|
else true.also { printLogcat(tag = "IconColor", context, expandedNf, isCustom = false, isGrayscale = false) }
|
||||||
|
|
||||||
|
/** 缓存图标数据 */
|
||||||
|
private fun PackageParam.cachingIconDatas() {
|
||||||
|
iconDatas = IconPackParams(param = this).iconDatas
|
||||||
|
}
|
||||||
|
|
||||||
override fun onInit() = configs {
|
override fun onInit() = configs {
|
||||||
debugTag = "MIUINativeNotifyIcon"
|
debugTag = "MIUINativeNotifyIcon"
|
||||||
isDebug = false
|
isDebug = false
|
||||||
@@ -492,7 +499,7 @@ class HookEntry : YukiHookXposedInitProxy {
|
|||||||
/** 开始 Hook */
|
/** 开始 Hook */
|
||||||
else -> {
|
else -> {
|
||||||
/** 缓存图标数据 */
|
/** 缓存图标数据 */
|
||||||
iconDatas = IconPackParams(param = this).iconDatas
|
cachingIconDatas()
|
||||||
/** 执行 Hook */
|
/** 执行 Hook */
|
||||||
NotificationUtilClass.hook {
|
NotificationUtilClass.hook {
|
||||||
/** 强制回写系统的状态栏图标样式为原生 */
|
/** 强制回写系统的状态栏图标样式为原生 */
|
||||||
@@ -525,11 +532,17 @@ class HookEntry : YukiHookXposedInitProxy {
|
|||||||
}
|
}
|
||||||
afterHook {
|
afterHook {
|
||||||
(globalContext ?: firstArgs as Context).also { context ->
|
(globalContext ?: firstArgs as Context).also { context ->
|
||||||
|
val expandedNf = args[if (isUseLegacy) 1 else 0] as? StatusBarNotification?
|
||||||
|
/** Hook 状态栏小图标 */
|
||||||
hookSmallIconOnSet(
|
hookSmallIconOnSet(
|
||||||
context = context,
|
context = context,
|
||||||
args[if (isUseLegacy) 1 else 0] as? StatusBarNotification?,
|
expandedNf,
|
||||||
(result as Icon).loadDrawable(context)
|
(result as Icon).loadDrawable(context)
|
||||||
) { icon -> result = Icon.createWithBitmap(icon) }
|
) { icon -> result = Icon.createWithBitmap(icon) }
|
||||||
|
/** 刷新图标缓存 */
|
||||||
|
if (expandedNf?.compatOpPkgName == MODULE_PACKAGE_NAME &&
|
||||||
|
expandedNf.notification?.channelId == IconRuleManagerTool.NOTIFY_CHANNEL
|
||||||
|
) cachingIconDatas()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -646,6 +659,10 @@ class HookEntry : YukiHookXposedInitProxy {
|
|||||||
if (importance != 1) isExpanded = true
|
if (importance != 1) isExpanded = true
|
||||||
/** 执行 Hook */
|
/** 执行 Hook */
|
||||||
hookNotifyIconOnSet(iconImageView.context, expandedNf, iconImageView, isExpanded)
|
hookNotifyIconOnSet(iconImageView.context, expandedNf, iconImageView, isExpanded)
|
||||||
|
/** 刷新图标缓存 */
|
||||||
|
if (expandedNf?.compatOpPkgName == MODULE_PACKAGE_NAME &&
|
||||||
|
expandedNf.notification?.channelId == IconRuleManagerTool.NOTIFY_CHANNEL
|
||||||
|
) cachingIconDatas()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -182,6 +182,14 @@ class ConfigureActivity : BaseActivity<ActivityConfigBinding>() {
|
|||||||
mockLocalData()
|
mockLocalData()
|
||||||
/** 更新数据 */
|
/** 更新数据 */
|
||||||
when {
|
when {
|
||||||
|
intent?.getBooleanExtra("isShowNeedRestart", false) == true ->
|
||||||
|
showDialog {
|
||||||
|
title = "规则列表已同步至最新"
|
||||||
|
msg = "同步完成,部分通知图标可能需要重新启动系统界面才能生效。"
|
||||||
|
confirmButton(text = "重新启动") { SystemUITool.restartSystemUI(context) }
|
||||||
|
cancelButton()
|
||||||
|
noCancelable()
|
||||||
|
}
|
||||||
intent?.getBooleanExtra("isNewAppSupport", false) == true ->
|
intent?.getBooleanExtra("isNewAppSupport", false) == true ->
|
||||||
showDialog {
|
showDialog {
|
||||||
val appName = intent?.getStringExtra("appName") ?: ""
|
val appName = intent?.getStringExtra("appName") ?: ""
|
||||||
@@ -190,6 +198,7 @@ class ConfigureActivity : BaseActivity<ActivityConfigBinding>() {
|
|||||||
msg = "你已安装 $appName($pkgName)\n\n" +
|
msg = "你已安装 $appName($pkgName)\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)") }
|
||||||
@@ -200,6 +209,7 @@ class ConfigureActivity : BaseActivity<ActivityConfigBinding>() {
|
|||||||
}
|
}
|
||||||
/** 清除数据 */
|
/** 清除数据 */
|
||||||
intent?.apply {
|
intent?.apply {
|
||||||
|
removeExtra("isShowNeedRestart")
|
||||||
removeExtra("isNewAppSupport")
|
removeExtra("isNewAppSupport")
|
||||||
removeExtra("isShowUpdDialog")
|
removeExtra("isShowUpdDialog")
|
||||||
}
|
}
|
||||||
|
@@ -58,6 +58,9 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
|||||||
|
|
||||||
/** 模块版本 */
|
/** 模块版本 */
|
||||||
private const val moduleVersion = BuildConfig.VERSION_NAME
|
private const val moduleVersion = BuildConfig.VERSION_NAME
|
||||||
|
|
||||||
|
/** 预发布的版本标识 */
|
||||||
|
private const val pendingFlag = "[pending]"
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 警告对话框是否显示 */
|
/** 警告对话框是否显示 */
|
||||||
@@ -65,7 +68,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>() {
|
|||||||
|
|
||||||
override fun onCreate() {
|
override fun onCreate() {
|
||||||
/** 设置文本 */
|
/** 设置文本 */
|
||||||
binding.mainTextVersion.text = "模块版本:$moduleVersion"
|
binding.mainTextVersion.text = "模块版本:$moduleVersion $pendingFlag"
|
||||||
binding.mainTextMiuiVersion.text = "系统版本:$miuiFullVersion"
|
binding.mainTextMiuiVersion.text = "系统版本:$miuiFullVersion"
|
||||||
/** 检查更新 */
|
/** 检查更新 */
|
||||||
GithubReleaseTool.checkingForUpdate(context = this, moduleVersion) { version, function ->
|
GithubReleaseTool.checkingForUpdate(context = this, moduleVersion) { version, function ->
|
||||||
|
@@ -36,10 +36,10 @@ import java.io.Serializable
|
|||||||
object GithubReleaseTool {
|
object GithubReleaseTool {
|
||||||
|
|
||||||
/** 仓库作者 */
|
/** 仓库作者 */
|
||||||
private const val repoAuthor = "fankes"
|
private const val REPO_AUTHOR = "fankes"
|
||||||
|
|
||||||
/** 仓库名称 */
|
/** 仓库名称 */
|
||||||
private const val repoName = "MIUINativeNotifyIcon"
|
private const val REPO_NAME = "MIUINativeNotifyIcon"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取最新版本信息
|
* 获取最新版本信息
|
||||||
@@ -50,7 +50,7 @@ object GithubReleaseTool {
|
|||||||
fun checkingForUpdate(context: Context, version: String, it: (String, () -> Unit) -> Unit) = checkingInternetConnect(context) {
|
fun checkingForUpdate(context: Context, version: String, it: (String, () -> Unit) -> Unit) = checkingInternetConnect(context) {
|
||||||
OkHttpClient().newBuilder().build().newCall(
|
OkHttpClient().newBuilder().build().newCall(
|
||||||
Request.Builder()
|
Request.Builder()
|
||||||
.url("https://api.github.com/repos/$repoAuthor/$repoName/releases/latest")
|
.url("https://api.github.com/repos/$REPO_AUTHOR/$REPO_NAME/releases/latest")
|
||||||
.get()
|
.get()
|
||||||
.build()
|
.build()
|
||||||
).enqueue(object : Callback {
|
).enqueue(object : Callback {
|
||||||
|
@@ -32,7 +32,7 @@ import android.content.Intent
|
|||||||
import android.graphics.Bitmap
|
import android.graphics.Bitmap
|
||||||
import android.graphics.drawable.Icon
|
import android.graphics.drawable.Icon
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import com.fankes.miui.notify.BuildConfig
|
import com.fankes.miui.notify.application.MNNApplication.Companion.MODULE_PACKAGE_NAME
|
||||||
import com.fankes.miui.notify.hook.HookEntry
|
import com.fankes.miui.notify.hook.HookEntry
|
||||||
import com.fankes.miui.notify.utils.factory.bitmap
|
import com.fankes.miui.notify.utils.factory.bitmap
|
||||||
import com.fankes.miui.notify.utils.factory.findAppIcon
|
import com.fankes.miui.notify.utils.factory.findAppIcon
|
||||||
@@ -46,9 +46,6 @@ import com.fankes.miui.notify.utils.factory.runInSafe
|
|||||||
*/
|
*/
|
||||||
object IconAdaptationTool {
|
object IconAdaptationTool {
|
||||||
|
|
||||||
/** 当前模块的包名 */
|
|
||||||
private const val PACKAGE_NAME = BuildConfig.APPLICATION_ID
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 使用的小图标
|
* 使用的小图标
|
||||||
* @return [Bitmap]
|
* @return [Bitmap]
|
||||||
@@ -103,8 +100,8 @@ object IconAdaptationTool {
|
|||||||
context, packageName.hashCode(),
|
context, packageName.hashCode(),
|
||||||
Intent().apply {
|
Intent().apply {
|
||||||
component = ComponentName(
|
component = ComponentName(
|
||||||
PACKAGE_NAME,
|
MODULE_PACKAGE_NAME,
|
||||||
"$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 {
|
||||||
|
@@ -32,6 +32,7 @@ import android.content.Context
|
|||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
|
import android.os.Handler
|
||||||
import android.provider.Settings
|
import android.provider.Settings
|
||||||
import androidx.appcompat.app.AppCompatActivity
|
import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.core.app.NotificationCompat
|
import androidx.core.app.NotificationCompat
|
||||||
@@ -39,6 +40,7 @@ import androidx.core.content.getSystemService
|
|||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
import androidx.core.widget.doOnTextChanged
|
import androidx.core.widget.doOnTextChanged
|
||||||
import com.fankes.miui.notify.R
|
import com.fankes.miui.notify.R
|
||||||
|
import com.fankes.miui.notify.application.MNNApplication.Companion.appContext
|
||||||
import com.fankes.miui.notify.databinding.DiaSourceFromBinding
|
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.hook.HookConst.SOURCE_SYNC_WAY
|
import com.fankes.miui.notify.hook.HookConst.SOURCE_SYNC_WAY
|
||||||
@@ -64,6 +66,9 @@ import javax.net.ssl.*
|
|||||||
*/
|
*/
|
||||||
object IconRuleManagerTool {
|
object IconRuleManagerTool {
|
||||||
|
|
||||||
|
/** 推送通知的渠道名称 */
|
||||||
|
const val NOTIFY_CHANNEL = "notifyRuleUpdateId"
|
||||||
|
|
||||||
/** 当前规则的系统名称 */
|
/** 当前规则的系统名称 */
|
||||||
private const val OS_TAG = "MIUI"
|
private const val OS_TAG = "MIUI"
|
||||||
|
|
||||||
@@ -138,6 +143,7 @@ object IconRuleManagerTool {
|
|||||||
dataJson2 = jsonString.takeIf { params.isJsonArray(it) } ?: "[$jsonString]"
|
dataJson2 = jsonString.takeIf { params.isJsonArray(it) } ?: "[$jsonString]"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
pushWithRefresh(context)
|
||||||
it()
|
it()
|
||||||
}
|
}
|
||||||
else -> context.snake(msg = "请输入有效内容")
|
else -> context.snake(msg = "请输入有效内容")
|
||||||
@@ -150,6 +156,7 @@ object IconRuleManagerTool {
|
|||||||
jsonString.isNotBlank() && params.isNotVaildJson(jsonString) -> context.snake(msg = "不是有效的 JSON 数据")
|
jsonString.isNotBlank() && params.isNotVaildJson(jsonString) -> context.snake(msg = "不是有效的 JSON 数据")
|
||||||
jsonString.isNotBlank() -> {
|
jsonString.isNotBlank() -> {
|
||||||
params.save(dataJson = jsonString.takeIf { params.isJsonArray(it) } ?: "[$jsonString]")
|
params.save(dataJson = jsonString.takeIf { params.isJsonArray(it) } ?: "[$jsonString]")
|
||||||
|
pushWithRefresh(context)
|
||||||
it()
|
it()
|
||||||
}
|
}
|
||||||
else -> context.snake(msg = "请输入有效内容")
|
else -> context.snake(msg = "请输入有效内容")
|
||||||
@@ -208,6 +215,7 @@ object IconRuleManagerTool {
|
|||||||
params.isCompareDifferent(it) -> {
|
params.isCompareDifferent(it) -> {
|
||||||
params.save(it)
|
params.save(it)
|
||||||
pushNotify(context, title = "同步完成", msg = "已更新通知图标优化名单,点击查看")
|
pushNotify(context, title = "同步完成", msg = "已更新通知图标优化名单,点击查看")
|
||||||
|
pushWithRefresh(context)
|
||||||
it()
|
it()
|
||||||
}
|
}
|
||||||
else -> (if (context is AppCompatActivity) context.snake(msg = "列表数据已是最新"))
|
else -> (if (context is AppCompatActivity) context.snake(msg = "列表数据已是最新"))
|
||||||
@@ -256,6 +264,7 @@ object IconRuleManagerTool {
|
|||||||
params.isCompareDifferent(content) -> {
|
params.isCompareDifferent(content) -> {
|
||||||
params.save(content)
|
params.save(content)
|
||||||
pushNotify(context, title = "同步完成", msg = "已更新通知图标优化名单,点击查看")
|
pushNotify(context, title = "同步完成", msg = "已更新通知图标优化名单,点击查看")
|
||||||
|
pushWithRefresh(context)
|
||||||
it()
|
it()
|
||||||
}
|
}
|
||||||
else -> (if (context is AppCompatActivity) context.snake(msg = "列表数据已是最新"))
|
else -> (if (context is AppCompatActivity) context.snake(msg = "列表数据已是最新"))
|
||||||
@@ -348,6 +357,18 @@ object IconRuleManagerTool {
|
|||||||
})
|
})
|
||||||
}.onFailure { it(false, "URL 无效") }
|
}.onFailure { it(false, "URL 无效") }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 推送通知图标更新通知
|
||||||
|
* @param context 实例
|
||||||
|
*/
|
||||||
|
private fun pushWithRefresh(context: Context) {
|
||||||
|
if (context !is AppCompatActivity) return
|
||||||
|
SystemUITool.showNeedUpdateApplySnake(context)
|
||||||
|
pushNotify(appContext, title = "更新完成", msg = "部分通知图标需要重启系统界面生效", isAction = false)
|
||||||
|
/** 刷新成功后取消通知 */
|
||||||
|
Handler().postDelayed({ context.getSystemService<NotificationManager>()?.cancel(1) }, 1500)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据实例类型决定推送通知还是弹出提示
|
* 根据实例类型决定推送通知还是弹出提示
|
||||||
* @param title 标题 - 仅对通知生效
|
* @param title 标题 - 仅对通知生效
|
||||||
@@ -364,17 +385,18 @@ object IconRuleManagerTool {
|
|||||||
* @param context 实例 - 类型为 [AppCompatActivity] 时将不会推送通知
|
* @param context 实例 - 类型为 [AppCompatActivity] 时将不会推送通知
|
||||||
* @param title 通知标题
|
* @param title 通知标题
|
||||||
* @param msg 通知消息
|
* @param msg 通知消息
|
||||||
|
* @param isAction 是否增加点击跳转事件 - 默认:是
|
||||||
*/
|
*/
|
||||||
private fun pushNotify(context: Context, title: String, msg: String) {
|
private fun pushNotify(context: Context, title: String, msg: String, isAction: Boolean = true) {
|
||||||
if (context !is AppCompatActivity)
|
if (context !is AppCompatActivity)
|
||||||
context.getSystemService<NotificationManager>()?.apply {
|
context.getSystemService<NotificationManager>()?.apply {
|
||||||
createNotificationChannel(
|
createNotificationChannel(
|
||||||
NotificationChannel(
|
NotificationChannel(
|
||||||
"notifyRuleUpdateId", "通知图标优化规则",
|
NOTIFY_CHANNEL, "通知图标优化规则",
|
||||||
NotificationManager.IMPORTANCE_DEFAULT
|
NotificationManager.IMPORTANCE_DEFAULT
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
notify(0, NotificationCompat.Builder(context, "notifyRuleUpdateId").apply {
|
notify(if (isAction) 0 else 1, NotificationCompat.Builder(context, NOTIFY_CHANNEL).apply {
|
||||||
setContentTitle(title)
|
setContentTitle(title)
|
||||||
setContentText(msg)
|
setContentText(msg)
|
||||||
color = OS_COLOR.toInt()
|
color = OS_COLOR.toInt()
|
||||||
@@ -382,11 +404,13 @@ object IconRuleManagerTool {
|
|||||||
setSmallIcon(R.drawable.ic_nf_icon_update)
|
setSmallIcon(R.drawable.ic_nf_icon_update)
|
||||||
setSound(null)
|
setSound(null)
|
||||||
setDefaults(NotificationCompat.DEFAULT_ALL)
|
setDefaults(NotificationCompat.DEFAULT_ALL)
|
||||||
setContentIntent(
|
if (isAction) setContentIntent(
|
||||||
PendingIntent.getActivity(
|
PendingIntent.getActivity(
|
||||||
context, 1,
|
context, msg.hashCode(),
|
||||||
Intent(context, ConfigureActivity::class.java).apply { putExtra("isShowUpdDialog", false) },
|
Intent(context, ConfigureActivity::class.java).apply {
|
||||||
if (Build.VERSION.SDK_INT < 31) PendingIntent.FLAG_UPDATE_CURRENT else PendingIntent.FLAG_IMMUTABLE
|
putExtra("isShowNeedRestart", true)
|
||||||
|
putExtra("isShowUpdDialog", false)
|
||||||
|
}, if (Build.VERSION.SDK_INT < 31) PendingIntent.FLAG_UPDATE_CURRENT else PendingIntent.FLAG_IMMUTABLE
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}.build())
|
}.build())
|
||||||
|
@@ -23,10 +23,7 @@
|
|||||||
package com.fankes.miui.notify.utils.tool
|
package com.fankes.miui.notify.utils.tool
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import com.fankes.miui.notify.utils.factory.execShellSu
|
import com.fankes.miui.notify.utils.factory.*
|
||||||
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.google.android.material.snackbar.Snackbar
|
import com.google.android.material.snackbar.Snackbar
|
||||||
import com.highcapable.yukihookapi.hook.factory.isXposedModuleActive
|
import com.highcapable.yukihookapi.hook.factory.isXposedModuleActive
|
||||||
|
|
||||||
@@ -69,6 +66,8 @@ object SystemUITool {
|
|||||||
*/
|
*/
|
||||||
fun showNeedUpdateApplySnake(context: Context) =
|
fun showNeedUpdateApplySnake(context: Context) =
|
||||||
if (isXposedModuleActive)
|
if (isXposedModuleActive)
|
||||||
context.snake(msg = "数据已更新,请重启系统界面使更改生效", actionText = "立即重启") { restartSystemUI(context) }
|
if (isNotNoificationEnabled)
|
||||||
|
context.snake(msg = "无通知权限,请重启系统界面使更改生效", actionText = "立即重启") { restartSystemUI(context) }
|
||||||
|
else context.snake(msg = "数据已更新,已推送的通知将在下次生效", actionText = "立即重启") { restartSystemUI(context) }
|
||||||
else context.snake(msg = "模块没有激活,更改不会生效")
|
else context.snake(msg = "模块没有激活,更改不会生效")
|
||||||
}
|
}
|
Reference in New Issue
Block a user