Skip to content

Commit

Permalink
OP QS Header: Use app icon if media icon not available
Browse files Browse the repository at this point in the history
Signed-off-by: DrDisagree <[email protected]>
  • Loading branch information
Mahmud0808 committed Sep 4, 2024
1 parent 7991591 commit 4d1fdf8
Showing 1 changed file with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1354,10 +1354,19 @@ class OpQsHeader(context: Context?) : ModPack(context!!) {

withContext(Dispatchers.Main) {
val appIcon = mNotificationMediaManager?.let {
callMethod(
it,
"getMediaIcon"
) as Icon?
try {
callMethod(it, "getMediaIcon") as Icon?
} catch (ignored: Throwable) {
try {
mMediaController?.packageName?.let { packageName ->
val drawable =
mContext.packageManager.getApplicationIcon(packageName)
Icon.createWithBitmap((drawable as BitmapDrawable).bitmap)
}
} catch (ignored: Throwable) {
null
}
}
}
if (appIcon != null && mMediaTitle != null) {
if (mAppIcon.drawable != appIcon.loadDrawable(mContext)) {
Expand Down

0 comments on commit 4d1fdf8

Please sign in to comment.