mirror of
https://github.com/fankes/MIUINativeNotifyIcon.git
synced 2025-09-06 18:55:25 +08:00
Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
9af735e252 | |||
c67fe2fa31 | |||
b03cf30e0a |
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||

|

|
||||||

|

|
||||||

|

|
||||||
<br/><br/>
|
<br/><br/>
|
||||||
<img src="https://github.com/fankes/MIUINativeNotifyIcon/blob/master/app/src/main/ic_launcher-playstore.png" width = "100" height = "100"/>
|
<img src="https://github.com/fankes/MIUINativeNotifyIcon/blob/master/app/src/main/ic_launcher-playstore.png" width = "100" height = "100"/>
|
||||||
<br/>
|
<br/>
|
||||||
@@ -12,7 +12,7 @@ Fix the native notification bar icon function abandoned by the MIUI development
|
|||||||
# 开始使用
|
# 开始使用
|
||||||
|
|
||||||
点击下载最新版本
|
点击下载最新版本
|
||||||
<a href='https://github.com/fankes/MIUINativeNotifyIcon/releases'></a>
|
<a href='https://github.com/fankes/MIUINativeNotifyIcon/releases'></a>
|
||||||
<br/><br/>
|
<br/><br/>
|
||||||
⚠️ 适配说明<br/>
|
⚠️ 适配说明<br/>
|
||||||
|
|
||||||
@@ -35,6 +35,10 @@ Fix the native notification bar icon function abandoned by the MIUI development
|
|||||||
|
|
||||||
- [CONTRIBUTING](https://github.com/fankes/MIUINativeNotifyIcon/blob/master/CONTRIBUTING.md)
|
- [CONTRIBUTING](https://github.com/fankes/MIUINativeNotifyIcon/blob/master/CONTRIBUTING.md)
|
||||||
|
|
||||||
|
# 通知测试
|
||||||
|
|
||||||
|
你可以 [点击这里下载](https://github.com/fankes/MIUINativeNotifyIcon/blob/master/tool/NotifyTester.apk) 工具测试通知图标是否生效。
|
||||||
|
|
||||||
# 历史背景
|
# 历史背景
|
||||||
|
|
||||||
这个模块诞生来源于 MIUI 的乱改和不规范,本来 MIUI 9 之后,官方给出了原生通知图标样式,后面由于用户反应通知栏经常出现黑白块。<br/><br/>
|
这个模块诞生来源于 MIUI 的乱改和不规范,本来 MIUI 9 之后,官方给出了原生通知图标样式,后面由于用户反应通知栏经常出现黑白块。<br/><br/>
|
||||||
|
@@ -253,7 +253,7 @@ class HookEntry : YukiHookXposedInitProxy {
|
|||||||
/** 处理自定义通知图标优化 */
|
/** 处理自定义通知图标优化 */
|
||||||
customIcon != null -> it(customIcon!!)
|
customIcon != null -> it(customIcon!!)
|
||||||
/** 若不是灰度图标自动处理为圆角 */
|
/** 若不是灰度图标自动处理为圆角 */
|
||||||
isNotGrayscaleIcon -> it(notifyInstance.compatNotifyIcon(context, iconDrawable).toBitmap().round(15.dp(context)))
|
isNotGrayscaleIcon -> it(notifyInstance.compatNotifyIcon(context, iconDrawable).toBitmap())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -29,8 +29,9 @@ import android.content.Context
|
|||||||
import android.content.pm.PackageInfo
|
import android.content.pm.PackageInfo
|
||||||
import android.content.pm.PackageManager
|
import android.content.pm.PackageManager
|
||||||
import android.content.res.Configuration
|
import android.content.res.Configuration
|
||||||
import android.graphics.*
|
import android.graphics.Bitmap
|
||||||
import android.graphics.Bitmap.createBitmap
|
import android.graphics.BitmapFactory
|
||||||
|
import android.graphics.Color
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.provider.Settings
|
import android.provider.Settings
|
||||||
import android.util.Base64
|
import android.util.Base64
|
||||||
@@ -214,25 +215,6 @@ val ByteArray.bitmap: Bitmap get() = BitmapFactory.decodeByteArray(this, 0, size
|
|||||||
*/
|
*/
|
||||||
val String.bitmap: Bitmap get() = unbase64.bitmap
|
val String.bitmap: Bitmap get() = unbase64.bitmap
|
||||||
|
|
||||||
/**
|
|
||||||
* 圆角图片
|
|
||||||
* @param radius 圆角度
|
|
||||||
* @return [Bitmap] 圆角后的位图 - 失败会返回处理之前的位图
|
|
||||||
*/
|
|
||||||
fun Bitmap.round(radius: Float): Bitmap =
|
|
||||||
createBitmap(width, height, Bitmap.Config.ARGB_8888).also { out ->
|
|
||||||
Canvas(out).also { canvas ->
|
|
||||||
Paint().also { paint ->
|
|
||||||
paint.isAntiAlias = true
|
|
||||||
canvas.drawARGB(0, 0, 0, 0)
|
|
||||||
paint.color = Color.WHITE
|
|
||||||
canvas.drawRoundRect(RectF(Rect(0, 0, width, height)), radius, radius, paint)
|
|
||||||
paint.xfermode = PorterDuffXfermode(PorterDuff.Mode.SRC_IN)
|
|
||||||
canvas.drawBitmap(this, Rect(0, 0, width, height), Rect(0, 0, width, height), paint)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取系统 Prop 值
|
* 获取系统 Prop 值
|
||||||
* @param key Key
|
* @param key Key
|
||||||
|
@@ -5,8 +5,8 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ext {
|
ext {
|
||||||
appVersionName = "1.7"
|
appVersionName = "1.71"
|
||||||
appVersionCode = 15
|
appVersionCode = 16
|
||||||
}
|
}
|
||||||
|
|
||||||
task clean(type: Delete) {
|
task clean(type: Delete) {
|
||||||
|
BIN
tool/NotifyTester.apk
Normal file
BIN
tool/NotifyTester.apk
Normal file
Binary file not shown.
Reference in New Issue
Block a user