mirror of
https://github.com/sudoxnym/audiobookshelf-atv.git
synced 2026-04-14 11:36:27 +00:00
Fix android cover image not showing in notification for downloaded media #1493, upgrade glide
This commit is contained in:
parent
fd34ea8124
commit
e7ad62760f
3 changed files with 2 additions and 18 deletions
|
|
@ -7,7 +7,6 @@ import android.net.Uri
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.provider.MediaStore
|
import android.provider.MediaStore
|
||||||
import android.support.v4.media.session.MediaControllerCompat
|
import android.support.v4.media.session.MediaControllerCompat
|
||||||
import android.util.Log
|
|
||||||
import com.audiobookshelf.app.BuildConfig
|
import com.audiobookshelf.app.BuildConfig
|
||||||
import com.audiobookshelf.app.R
|
import com.audiobookshelf.app.R
|
||||||
import com.bumptech.glide.Glide
|
import com.bumptech.glide.Glide
|
||||||
|
|
@ -41,7 +40,6 @@ class AbMediaDescriptionAdapter constructor(private val controller: MediaControl
|
||||||
// Cache the bitmap for the current audiobook so that successive calls to
|
// Cache the bitmap for the current audiobook so that successive calls to
|
||||||
// `getCurrentLargeIcon` don't cause the bitmap to be recreated.
|
// `getCurrentLargeIcon` don't cause the bitmap to be recreated.
|
||||||
currentIconUri = albumArtUri
|
currentIconUri = albumArtUri
|
||||||
Log.d(tag, "ART $currentIconUri")
|
|
||||||
|
|
||||||
if (currentIconUri.toString().startsWith("content://")) {
|
if (currentIconUri.toString().startsWith("content://")) {
|
||||||
currentBitmap = if (Build.VERSION.SDK_INT < 28) {
|
currentBitmap = if (Build.VERSION.SDK_INT < 28) {
|
||||||
|
|
|
||||||
|
|
@ -312,19 +312,6 @@ class PlayerNotificationService : MediaBrowserServiceCompat() {
|
||||||
|
|
||||||
val coverUri = currentPlaybackSession!!.getCoverUri(ctx)
|
val coverUri = currentPlaybackSession!!.getCoverUri(ctx)
|
||||||
|
|
||||||
var bitmap: Bitmap? = null
|
|
||||||
// Local covers get bitmap
|
|
||||||
if (currentPlaybackSession!!.localLibraryItem?.coverContentUrl != null) {
|
|
||||||
bitmap =
|
|
||||||
if (Build.VERSION.SDK_INT < 28) {
|
|
||||||
MediaStore.Images.Media.getBitmap(ctx.contentResolver, coverUri)
|
|
||||||
} else {
|
|
||||||
val source: ImageDecoder.Source =
|
|
||||||
ImageDecoder.createSource(ctx.contentResolver, coverUri)
|
|
||||||
ImageDecoder.decodeBitmap(source)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fix for local images crashing on Android 11 for specific devices
|
// Fix for local images crashing on Android 11 for specific devices
|
||||||
// https://stackoverflow.com/questions/64186578/android-11-mediastyle-notification-crash/64232958#64232958
|
// https://stackoverflow.com/questions/64186578/android-11-mediastyle-notification-crash/64232958#64232958
|
||||||
try {
|
try {
|
||||||
|
|
@ -348,8 +335,7 @@ class PlayerNotificationService : MediaBrowserServiceCompat() {
|
||||||
.setExtras(extra)
|
.setExtras(extra)
|
||||||
.setTitle(currentPlaybackSession!!.displayTitle)
|
.setTitle(currentPlaybackSession!!.displayTitle)
|
||||||
|
|
||||||
bitmap?.let { mediaDescriptionBuilder.setIconBitmap(it) }
|
mediaDescriptionBuilder.setIconUri(coverUri)
|
||||||
?: mediaDescriptionBuilder.setIconUri(coverUri)
|
|
||||||
|
|
||||||
return mediaDescriptionBuilder.build()
|
return mediaDescriptionBuilder.build()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ ext {
|
||||||
androidx_core_ktx_version = '1.16.0'
|
androidx_core_ktx_version = '1.16.0'
|
||||||
androidx_media_version = '1.7.0'
|
androidx_media_version = '1.7.0'
|
||||||
exoplayer_version = '2.18.7'
|
exoplayer_version = '2.18.7'
|
||||||
glide_version = '4.11.0'
|
glide_version = '4.16.0'
|
||||||
junit_version = '4.13.2'
|
junit_version = '4.13.2'
|
||||||
kotlin_version = '2.1.0'
|
kotlin_version = '2.1.0'
|
||||||
kotlin_coroutines_version = '1.10.1'
|
kotlin_coroutines_version = '1.10.1'
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue