3 Commits
1.7 ... 1.71

Author SHA1 Message Date
9af735e252 Update README.md 2022-02-20 14:01:45 +08:00
c67fe2fa31 Update version to 1.71,fix more bugs 2022-02-20 13:57:46 +08:00
b03cf30e0a 取消圆角彩色图标优化 2022-02-20 13:52:40 +08:00
5 changed files with 12 additions and 26 deletions

View File

@@ -2,7 +2,7 @@
![Eclipse Marketplace](https://img.shields.io/badge/build-passing-brightgreen)
![Eclipse Marketplace](https://img.shields.io/badge/license-AGPL3.0-blue)
![Eclipse Marketplace](https://img.shields.io/badge/version-v1.7-green)
![Eclipse Marketplace](https://img.shields.io/badge/version-v1.71-green)
<br/><br/>
<img src="https://github.com/fankes/MIUINativeNotifyIcon/blob/master/app/src/main/ic_launcher-playstore.png" width = "100" height = "100"/>
<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'>![Eclipse Marketplace](https://img.shields.io/badge/download-v1.7-green)</a>
<a href='https://github.com/fankes/MIUINativeNotifyIcon/releases'>![Eclipse Marketplace](https://img.shields.io/badge/download-v1.71-green)</a>
<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)
# 通知测试
你可以 [点击这里下载](https://github.com/fankes/MIUINativeNotifyIcon/blob/master/tool/NotifyTester.apk) 工具测试通知图标是否生效。
# 历史背景
这个模块诞生来源于 MIUI 的乱改和不规范,本来 MIUI 9 之后,官方给出了原生通知图标样式,后面由于用户反应通知栏经常出现黑白块。<br/><br/>

View File

@@ -253,7 +253,7 @@ class HookEntry : YukiHookXposedInitProxy {
/** 处理自定义通知图标优化 */
customIcon != null -> it(customIcon!!)
/** 若不是灰度图标自动处理为圆角 */
isNotGrayscaleIcon -> it(notifyInstance.compatNotifyIcon(context, iconDrawable).toBitmap().round(15.dp(context)))
isNotGrayscaleIcon -> it(notifyInstance.compatNotifyIcon(context, iconDrawable).toBitmap())
}
}
}

View File

@@ -29,8 +29,9 @@ import android.content.Context
import android.content.pm.PackageInfo
import android.content.pm.PackageManager
import android.content.res.Configuration
import android.graphics.*
import android.graphics.Bitmap.createBitmap
import android.graphics.Bitmap
import android.graphics.BitmapFactory
import android.graphics.Color
import android.os.Build
import android.provider.Settings
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
/**
* 圆角图片
* @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 值
* @param key Key

View File

@@ -5,8 +5,8 @@ plugins {
}
ext {
appVersionName = "1.7"
appVersionCode = 15
appVersionName = "1.71"
appVersionCode = 16
}
task clean(type: Delete) {

BIN
tool/NotifyTester.apk Normal file

Binary file not shown.