| 
					
				 | 
			
			
				@@ -2,6 +2,7 @@ package eu.kanade.tachiyomi.ui.reader.notification 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import android.content.Context 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import android.graphics.Bitmap 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import android.media.Image 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import android.support.v4.app.NotificationCompat 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.bumptech.glide.Glide 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.bumptech.glide.load.engine.DiskCacheStrategy 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -32,34 +33,44 @@ class ImageNotifier(private val context: Context) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      * @param file image file containing downloaded page image 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				      */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     fun onComplete(file: File) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        with(notificationBuilder) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            Glide.with(context).load(file).asBitmap().diskCacheStrategy(DiskCacheStrategy.NONE).skipMemoryCache(true).into(object : SimpleTarget<Bitmap>(720, 1280) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                 * The method that will be called when the resource load has finished. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                 * @param resource the loaded resource. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                 */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                override fun onResourceReady(resource: Bitmap?, glideAnimation: GlideAnimation<in Bitmap>?) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    setContentTitle(context.getString(R.string.picture_saved)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    setSmallIcon(R.drawable.ic_insert_photo_white_24dp) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    setStyle(NotificationCompat.BigPictureStyle().bigPicture(resource)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    setLargeIcon(resource) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    setAutoCancel(true) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    // Clear old actions if they exist 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    if (!mActions.isEmpty()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        mActions.clear() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    setContentIntent(ImageNotificationReceiver.showImageIntent(context, file.absolutePath)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    // Share action 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    addAction(R.drawable.ic_share_grey_24dp, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            context.getString(R.string.action_share), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            ImageNotificationReceiver.shareImageIntent(context, file.absolutePath, notificationId)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    // Delete action 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    addAction(R.drawable.ic_delete_grey_24dp, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            context.getString(R.string.action_delete), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                            ImageNotificationReceiver.deleteImageIntent(context, file.absolutePath, notificationId)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    updateNotification() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Glide.with(context).load(file).asBitmap().diskCacheStrategy(DiskCacheStrategy.NONE).skipMemoryCache(true).into(object : SimpleTarget<Bitmap>(720, 1280) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            /** 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+             * The method that will be called when the resource load has finished. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+             * @param resource the loaded resource. 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+             */ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            override fun onResourceReady(resource: Bitmap?, glideAnimation: GlideAnimation<in Bitmap>?) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                if (resource!= null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    showCompleteNotification(file, resource) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                }else{ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    onError(null) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private fun showCompleteNotification(file: File, image: Bitmap) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        with(notificationBuilder) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            setContentTitle(context.getString(R.string.picture_saved)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            setSmallIcon(R.drawable.ic_insert_photo_white_24dp) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            setStyle(NotificationCompat.BigPictureStyle().bigPicture(image)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            setLargeIcon(image) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            setAutoCancel(true) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // Clear old actions if they exist 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (!mActions.isEmpty()) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                mActions.clear() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            setContentIntent(ImageNotificationReceiver.showImageIntent(context, file.absolutePath)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // Share action 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            addAction(R.drawable.ic_share_grey_24dp, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    context.getString(R.string.action_share), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    ImageNotificationReceiver.shareImageIntent(context, file.absolutePath, notificationId)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            // Delete action 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            addAction(R.drawable.ic_delete_grey_24dp, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    context.getString(R.string.action_delete), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    ImageNotificationReceiver.deleteImageIntent(context, file.absolutePath, notificationId)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            updateNotification() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 |