@@ -1,11 +1,8 @@
|
|||||||
package io.legado.app.ui.book.read.page.provider
|
package io.legado.app.ui.book.read.page.provider
|
||||||
|
|
||||||
import android.graphics.Bitmap
|
import android.graphics.Bitmap
|
||||||
import com.bumptech.glide.load.DataSource
|
|
||||||
import com.bumptech.glide.load.engine.GlideException
|
|
||||||
import com.bumptech.glide.request.RequestListener
|
|
||||||
import com.bumptech.glide.request.target.Target
|
|
||||||
import io.legado.app.R
|
import io.legado.app.R
|
||||||
|
import io.legado.app.constant.AppLog.putDebug
|
||||||
import io.legado.app.data.entities.Book
|
import io.legado.app.data.entities.Book
|
||||||
import io.legado.app.data.entities.BookSource
|
import io.legado.app.data.entities.BookSource
|
||||||
import io.legado.app.help.BookHelp
|
import io.legado.app.help.BookHelp
|
||||||
@@ -14,6 +11,7 @@ import io.legado.app.help.glide.ImageLoader
|
|||||||
import io.legado.app.model.localBook.EpubFile
|
import io.legado.app.model.localBook.EpubFile
|
||||||
import io.legado.app.utils.FileUtils
|
import io.legado.app.utils.FileUtils
|
||||||
import io.legado.app.utils.BitmapUtils
|
import io.legado.app.utils.BitmapUtils
|
||||||
|
import io.legado.app.utils.isXml
|
||||||
import kotlinx.coroutines.runBlocking
|
import kotlinx.coroutines.runBlocking
|
||||||
import splitties.init.appCtx
|
import splitties.init.appCtx
|
||||||
import java.io.File
|
import java.io.File
|
||||||
@@ -52,11 +50,17 @@ object ImageProvider {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return try {
|
return try {
|
||||||
ImageLoader.loadBitmap(appCtx, vFile.absolutePath).submit().get()
|
ImageLoader.loadBitmap(appCtx, vFile.absolutePath)
|
||||||
|
.submit(ChapterProvider.visibleWidth,ChapterProvider.visibleHeight)
|
||||||
|
.get()
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Coroutine.async { vFile.delete() }
|
Coroutine.async {
|
||||||
//must call this method on a background thread
|
putDebug("${vFile.absolutePath} 解码失败", e)
|
||||||
//ImageLoader.loadBitmap(appCtx, R.drawable.image_loading_error).submit().get()
|
if (FileUtils.readText(vFile.absolutePath).isXml()) {
|
||||||
|
putDebug("${vFile.absolutePath}为xml,自动删除")
|
||||||
|
vFile.delete()
|
||||||
|
}
|
||||||
|
}
|
||||||
errorBitmap
|
errorBitmap
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user