more offline stuff/bugfixes

This commit is contained in:
Finnley Somdahl 2023-11-20 00:39:14 -06:00
parent 3dfcc9fc31
commit 4db301ca7a
29 changed files with 341 additions and 119 deletions

View file

@ -94,7 +94,7 @@ class MangaChapterAdapter(
fun bind(chapterNumber: String) {
if (activeDownloads.contains(chapterNumber)) {
// Show spinner
binding.itemDownload.setImageResource(R.drawable.spinner_icon_manga)
binding.itemDownload.setImageResource(R.drawable.ic_round_refresh_24)
} else if(downloadedChapters.contains(chapterNumber)) {
// Show checkmark
binding.itemDownload.setImageResource(R.drawable.ic_check)

View file

@ -74,7 +74,9 @@ class MangaReadAdapter(
setLanguageList(0,i)
}
subscribeButton(false)
fragment.loadChapters(i, false)
//invalidate if it's the last source
val invalidate = i == mangaReadSources.names.size - 1
fragment.loadChapters(i, invalidate)
}
binding.animeSourceLanguage.setOnItemClickListener { _, _, i, _ ->

View file

@ -118,7 +118,7 @@ abstract class BaseImageAdapter(
abstract suspend fun loadImage(position: Int, parent: View): Boolean
companion object {
suspend fun Context.loadBitmap_old(link: FileUrl, transforms: List<BitmapTransformation>): Bitmap? {
suspend fun Context.loadBitmap_old(link: FileUrl, transforms: List<BitmapTransformation>): Bitmap? { //still used in some places
return tryWithSuspend {
withContext(Dispatchers.IO) {
Glide.with(this@loadBitmap_old)
@ -154,8 +154,9 @@ abstract class BaseImageAdapter(
.asBitmap()
.let {
val fileUri = Uri.fromFile(File(link.url)).toString()
if (fileUri.startsWith("file://")) {
it.load(fileUri)
val localFile = File(link.url)
if (localFile.exists()) {
it.load(localFile.absoluteFile)
.skipMemoryCache(true)
.diskCacheStrategy(DiskCacheStrategy.NONE)
} else {