mirror of
https://github.com/libre-tube/LibreTube.git
synced 2025-04-28 16:00:31 +05:30
Fix that the notification thumbnail doesn't load sometimes
This commit is contained in:
parent
930df73efa
commit
1641c75146
@ -110,20 +110,19 @@ class NowPlayingNotification(
|
|||||||
val request = ImageRequest.Builder(context)
|
val request = ImageRequest.Builder(context)
|
||||||
.data(streams?.thumbnailUrl)
|
.data(streams?.thumbnailUrl)
|
||||||
.target { result ->
|
.target { result ->
|
||||||
bitmap = (result as BitmapDrawable).bitmap
|
val bm = (result as BitmapDrawable).bitmap
|
||||||
|
// returns the bitmap on Android 13+, for everything below scaled down to a square
|
||||||
|
bitmap = if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) {
|
||||||
|
ImageHelper.getSquareBitmap(bm)
|
||||||
|
} else bm
|
||||||
|
callback.onBitmap(bitmap!!)
|
||||||
}
|
}
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
|
// enqueue the thumbnail loading request
|
||||||
ImageHelper.imageLoader.enqueue(request)
|
ImageHelper.imageLoader.enqueue(request)
|
||||||
|
|
||||||
// returns the bitmap on Android 13+, for everything below scaled down to a square
|
return bitmap
|
||||||
return if (
|
|
||||||
Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU
|
|
||||||
) {
|
|
||||||
ImageHelper.getSquareBitmap(bitmap)
|
|
||||||
} else {
|
|
||||||
bitmap
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getCurrentSubText(player: Player): CharSequence? {
|
override fun getCurrentSubText(player: Player): CharSequence? {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user