This commit is contained in:
Bram van de Kerkhof 2016-10-25 16:08:33 +02:00
parent c2b113ac0a
commit 93f90b5a62
3 changed files with 39 additions and 30 deletions

View File

@ -384,9 +384,7 @@ class ReaderPresenter : BasePresenter<ReaderActivity>() {
val removeAfterReadSlots = prefs.removeAfterReadSlots() val removeAfterReadSlots = prefs.removeAfterReadSlots()
when (removeAfterReadSlots) { when (removeAfterReadSlots) {
// Setting disabled // Setting disabled
-1 -> { -1 -> { /**Empty function**/ }
/**Empty function**/
}
// Remove current read chapter // Remove current read chapter
0 -> deleteChapter(chapter, manga) 0 -> deleteChapter(chapter, manga)
// Remove previous chapter specified by user in settings. // Remove previous chapter specified by user in settings.

View File

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