mirror of
https://github.com/fankes/ColorOSNotifyIcon.git
synced 2025-09-06 10:45:49 +08:00
Merge code
This commit is contained in:
@@ -221,7 +221,7 @@ class HookEntry : YukiHookXposedInitProxy {
|
|||||||
/** 移除诡异的间距 FIXME 间距总是有问题不知道为什么 */
|
/** 移除诡异的间距 FIXME 间距总是有问题不知道为什么 */
|
||||||
methodUnused.get(it).call()
|
methodUnused.get(it).call()
|
||||||
// FIXME ignored this mabe bugss --> iconScaleField.get(it).set(if (icon.second) 0.75f else 0.68f)
|
// FIXME ignored this mabe bugss --> iconScaleField.get(it).set(if (icon.second) 0.75f else 0.68f)
|
||||||
it.setImageDrawable(icon.first)
|
it.setImageDrawable(icon.first.rounded(it.context))
|
||||||
it.invalidate()
|
it.invalidate()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -253,6 +253,13 @@ class HookEntry : YukiHookXposedInitProxy {
|
|||||||
}.get().invoke(context)).invoke<Boolean>(drawable) ?: false
|
}.get().invoke(context)).invoke<Boolean>(drawable) ?: false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理为圆角图标
|
||||||
|
* @return [Drawable]
|
||||||
|
*/
|
||||||
|
private fun Drawable.rounded(context: Context) =
|
||||||
|
safeOf(default = this) { BitmapDrawable(context.resources, toBitmap().round(10.dpFloat(context))) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 自动适配状态栏、通知栏自定义小图标
|
* 自动适配状态栏、通知栏自定义小图标
|
||||||
* @param isGrayscaleIcon 是否为灰度图标
|
* @param isGrayscaleIcon 是否为灰度图标
|
||||||
|
@@ -34,9 +34,7 @@ import android.content.Intent
|
|||||||
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.Bitmap
|
import android.graphics.*
|
||||||
import android.graphics.BitmapFactory
|
|
||||||
import android.graphics.Color
|
|
||||||
import android.net.ConnectivityManager
|
import android.net.ConnectivityManager
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
@@ -274,6 +272,26 @@ 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 = safeOf(default = this) {
|
||||||
|
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
|
||||||
|
Reference in New Issue
Block a user