fix: offline mode failing
This commit is contained in:
parent
ea29449413
commit
7ca44480a9
6 changed files with 28 additions and 8 deletions
|
@ -1350,7 +1350,11 @@ fun blurImage(imageView: ImageView, banner: String?) {
|
|||
if (!(context as Activity).isDestroyed) {
|
||||
val url = PrefManager.getVal<String>(PrefName.ImageUrl).ifEmpty { banner }
|
||||
Glide.with(context as Context)
|
||||
.load(GlideUrl(url))
|
||||
.load(
|
||||
if (banner.startsWith("http")) GlideUrl(url) else if (banner.startsWith("content://")) Uri.parse(
|
||||
url
|
||||
) else File(url)
|
||||
)
|
||||
.diskCacheStrategy(DiskCacheStrategy.RESOURCE).override(400)
|
||||
.apply(RequestOptions.bitmapTransform(BlurTransformation(radius, sampling)))
|
||||
.into(imageView)
|
||||
|
|
|
@ -36,6 +36,7 @@ import ani.dantotsu.download.DownloadsManager
|
|||
import ani.dantotsu.download.DownloadsManager.Companion.compareName
|
||||
import ani.dantotsu.download.anime.AnimeDownloaderService
|
||||
import ani.dantotsu.dp
|
||||
import ani.dantotsu.isOnline
|
||||
import ani.dantotsu.media.Media
|
||||
import ani.dantotsu.media.MediaDetailsActivity
|
||||
import ani.dantotsu.media.MediaDetailsViewModel
|
||||
|
@ -198,10 +199,15 @@ class AnimeWatchFragment : Fragment() {
|
|||
ConcatAdapter(headerAdapter, episodeAdapter)
|
||||
|
||||
lifecycleScope.launch(Dispatchers.IO) {
|
||||
awaitAll(
|
||||
async { model.loadKitsuEpisodes(media) },
|
||||
async { model.loadFillerEpisodes(media) }
|
||||
)
|
||||
val offline = !isOnline(binding.root.context) || PrefManager.getVal(PrefName.OfflineMode)
|
||||
if (offline) {
|
||||
media.selected!!.sourceIndex = model.watchSources!!.list.lastIndex
|
||||
} else {
|
||||
awaitAll(
|
||||
async { model.loadKitsuEpisodes(media) },
|
||||
async { model.loadFillerEpisodes(media) }
|
||||
)
|
||||
}
|
||||
model.loadEpisodes(media, media.selected!!.sourceIndex)
|
||||
}
|
||||
loaded = true
|
||||
|
|
|
@ -38,6 +38,7 @@ import ani.dantotsu.download.DownloadsManager.Companion.compareName
|
|||
import ani.dantotsu.download.manga.MangaDownloaderService
|
||||
import ani.dantotsu.download.manga.MangaServiceDataSingleton
|
||||
import ani.dantotsu.dp
|
||||
import ani.dantotsu.isOnline
|
||||
import ani.dantotsu.media.Media
|
||||
import ani.dantotsu.media.MediaDetailsActivity
|
||||
import ani.dantotsu.media.MediaDetailsViewModel
|
||||
|
@ -202,6 +203,8 @@ open class MangaReadFragment : Fragment(), ScanlatorSelectionListener {
|
|||
ConcatAdapter(headerAdapter, chapterAdapter)
|
||||
|
||||
lifecycleScope.launch(Dispatchers.IO) {
|
||||
val offline = !isOnline(binding.root.context) || PrefManager.getVal(PrefName.OfflineMode)
|
||||
if (offline) media.selected!!.sourceIndex = model.mangaReadSources!!.list.lastIndex
|
||||
model.loadMangaChapters(media, media.selected!!.sourceIndex)
|
||||
}
|
||||
loaded = true
|
||||
|
|
|
@ -1,5 +1,8 @@
|
|||
package ani.dantotsu.profile
|
||||
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@Serializable
|
||||
data class User(
|
||||
val id: Int,
|
||||
val name: String,
|
||||
|
@ -11,4 +14,8 @@ data class User(
|
|||
val progress: Int? = null,
|
||||
val totalEpisodes : Int? = null,
|
||||
val nextAiringEpisode : Int? = null,
|
||||
)
|
||||
) : java.io.Serializable {
|
||||
companion object {
|
||||
private const val serialVersionUID: Long = 1
|
||||
}
|
||||
}
|
|
@ -65,7 +65,7 @@ class StoragePermissions {
|
|||
force: Boolean = false,
|
||||
complete: (Boolean) -> Unit
|
||||
) {
|
||||
if ((PrefManager.getVal<String>(PrefName.DownloadsDir).isNotEmpty() || hasDirAccess(this)) && !force) {
|
||||
if (hasDirAccess(this) && !force) {
|
||||
complete(true)
|
||||
return
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ buildscript {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:8.3.1'
|
||||
classpath 'com.android.tools.build:gradle:8.3.2'
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
|
||||
classpath "com.google.devtools.ksp:symbol-processing-api:$ksp_version"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue