mirror of
https://github.com/fankes/MIUINativeNotifyIcon.git
synced 2025-09-06 10:45:20 +08:00
再次修复通知图标个数对旧版本 MIUI 不生效的问题
This commit is contained in:
@@ -122,6 +122,10 @@ class HookEntry : YukiHookXposedInitProxy {
|
|||||||
/** 是否显示通知图标 - 跟随 Hook 保存 */
|
/** 是否显示通知图标 - 跟随 Hook 保存 */
|
||||||
private var isShowNotificationIcons = true
|
private var isShowNotificationIcons = true
|
||||||
|
|
||||||
|
/** 是否有最大图标设置功能 */
|
||||||
|
private val PackageParam.hasMaxStaticIcons
|
||||||
|
get() = safeOfFalse { NotificationIconContainerClass.clazz.hasField(name = "MAX_STATIC_ICONS") }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* - 这个是修复彩色图标的关键核心代码判断
|
* - 这个是修复彩色图标的关键核心代码判断
|
||||||
*
|
*
|
||||||
@@ -549,6 +553,7 @@ class HookEntry : YukiHookXposedInitProxy {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (hasMaxStaticIcons)
|
||||||
NotificationIconContainerClass.hook {
|
NotificationIconContainerClass.hook {
|
||||||
injectMember {
|
injectMember {
|
||||||
method { name = "calculateIconTranslations" }
|
method { name = "calculateIconTranslations" }
|
||||||
@@ -567,13 +572,22 @@ class HookEntry : YukiHookXposedInitProxy {
|
|||||||
.let { if (it in 0..100) it else 5 })
|
.let { if (it in 0..100) it else 5 })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/** 旧版方法 - 新版不存在 */
|
||||||
|
injectMember {
|
||||||
|
method {
|
||||||
|
name = "setMaxStaticIcons"
|
||||||
|
param(IntType)
|
||||||
|
beforeHook { isShowNotificationIcons = firstArgs as Int > 0 }
|
||||||
|
}
|
||||||
|
}.ignoredHookingFailure()
|
||||||
|
/** 新版方法 - 旧版不存在 */
|
||||||
injectMember {
|
injectMember {
|
||||||
method {
|
method {
|
||||||
name = "miuiShowNotificationIcons"
|
name = "miuiShowNotificationIcons"
|
||||||
param(BooleanType)
|
param(BooleanType)
|
||||||
}
|
}
|
||||||
beforeHook { isShowNotificationIcons = firstArgs as Boolean }
|
beforeHook { isShowNotificationIcons = firstArgs as Boolean }
|
||||||
}
|
}.ignoredHookingFailure()
|
||||||
}
|
}
|
||||||
NotificationHeaderViewWrapperClass.hook {
|
NotificationHeaderViewWrapperClass.hook {
|
||||||
/** 修复下拉通知图标自动设置回 APP 图标的方法 */
|
/** 修复下拉通知图标自动设置回 APP 图标的方法 */
|
||||||
|
@@ -33,6 +33,7 @@ import android.widget.LinearLayout
|
|||||||
import android.widget.TextView
|
import android.widget.TextView
|
||||||
import androidx.appcompat.widget.SwitchCompat
|
import androidx.appcompat.widget.SwitchCompat
|
||||||
import androidx.constraintlayout.utils.widget.ImageFilterView
|
import androidx.constraintlayout.utils.widget.ImageFilterView
|
||||||
|
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.BuildConfig
|
||||||
import com.fankes.miui.notify.R
|
import com.fankes.miui.notify.R
|
||||||
@@ -192,6 +193,8 @@ class MainActivity : BaseActivity() {
|
|||||||
}
|
}
|
||||||
/** 通知图标优化名单按钮点击事件 */
|
/** 通知图标优化名单按钮点击事件 */
|
||||||
notifyIconFixButton.setOnClickListener { startActivity(Intent(this, ConfigureActivity::class.java)) }
|
notifyIconFixButton.setOnClickListener { startActivity(Intent(this, ConfigureActivity::class.java)) }
|
||||||
|
/** 设置警告 */
|
||||||
|
findViewById<View>(R.id.config_warn_s_count_dis_tip).isGone = miuiVersionCode > 12.5
|
||||||
/** 修改状态栏通知图标个数按钮点击事件 */
|
/** 修改状态栏通知图标个数按钮点击事件 */
|
||||||
findViewById<View>(R.id.config_status_icon_count_button).setOnClickListener {
|
findViewById<View>(R.id.config_status_icon_count_button).setOnClickListener {
|
||||||
showDialog {
|
showDialog {
|
||||||
|
@@ -129,8 +129,7 @@ inline val isNotSupportMiuiVersion get() = !isSupportMiuiVersion
|
|||||||
* @return [String]
|
* @return [String]
|
||||||
*/
|
*/
|
||||||
val miuiVersion
|
val miuiVersion
|
||||||
get() =
|
get() = if (isMIUI)
|
||||||
if (isMIUI)
|
|
||||||
findPropString(key = "ro.miui.ui.version.name", default = "V无法获取").let {
|
findPropString(key = "ro.miui.ui.version.name", default = "V无法获取").let {
|
||||||
when (it) {
|
when (it) {
|
||||||
"V110" -> "11"
|
"V110" -> "11"
|
||||||
@@ -145,6 +144,12 @@ val miuiVersion
|
|||||||
}.trim()
|
}.trim()
|
||||||
else "NULL"
|
else "NULL"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取 MIUI 版本号
|
||||||
|
* @return [Float]
|
||||||
|
*/
|
||||||
|
val miuiVersionCode get() = safeOf(default = 0f) { miuiVersion.toFloat() }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取 MIUI 完全版本
|
* 获取 MIUI 完全版本
|
||||||
* @return [String]
|
* @return [String]
|
||||||
|
@@ -233,6 +233,17 @@
|
|||||||
android:textColor="@color/colorTextDark"
|
android:textColor="@color/colorTextDark"
|
||||||
android:textSize="12sp" />
|
android:textSize="12sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/config_warn_s_count_dis_tip"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="10dp"
|
||||||
|
android:alpha="0.6"
|
||||||
|
android:lineSpacingExtra="6dp"
|
||||||
|
android:text="⚠️ 仅支持 MIUI 12.5 后期开发版以及最新版本"
|
||||||
|
android:textColor="@color/colorTextDark"
|
||||||
|
android:textSize="12sp" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/config_item_s_count_child_hook"
|
android:id="@+id/config_item_s_count_child_hook"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
Reference in New Issue
Block a user