mirror of
				https://github.com/mihonapp/mihon.git
				synced 2025-11-04 08:08:55 +01:00 
			
		
		
		
	Don't attempt to show non-bitmap image in notification when saving
Fixes #9758
This commit is contained in:
		@@ -35,12 +35,8 @@ class SaveImageNotifier(private val context: Context) {
 | 
			
		||||
            .memoryCachePolicy(CachePolicy.DISABLED)
 | 
			
		||||
            .size(720, 1280)
 | 
			
		||||
            .target(
 | 
			
		||||
                onSuccess = { result ->
 | 
			
		||||
                    showCompleteNotification(uri, (result as BitmapDrawable).bitmap)
 | 
			
		||||
                },
 | 
			
		||||
                onError = {
 | 
			
		||||
                    onError(null)
 | 
			
		||||
                },
 | 
			
		||||
                onSuccess = { showCompleteNotification(uri, (it as? BitmapDrawable)?.bitmap) },
 | 
			
		||||
                onError = { onError(null) },
 | 
			
		||||
            )
 | 
			
		||||
            .build()
 | 
			
		||||
        context.imageLoader.enqueue(request)
 | 
			
		||||
@@ -67,11 +63,11 @@ class SaveImageNotifier(private val context: Context) {
 | 
			
		||||
        updateNotification()
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    private fun showCompleteNotification(uri: Uri, image: Bitmap) {
 | 
			
		||||
    private fun showCompleteNotification(uri: Uri, image: Bitmap?) {
 | 
			
		||||
        with(notificationBuilder) {
 | 
			
		||||
            setContentTitle(context.getString(R.string.picture_saved))
 | 
			
		||||
            setSmallIcon(R.drawable.ic_photo_24dp)
 | 
			
		||||
            setStyle(NotificationCompat.BigPictureStyle().bigPicture(image))
 | 
			
		||||
            image?.let { setStyle(NotificationCompat.BigPictureStyle().bigPicture(it)) }
 | 
			
		||||
            setLargeIcon(image)
 | 
			
		||||
            setAutoCancel(true)
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user