mirror of
https://github.com/null2264/yokai.git
synced 2025-06-20 18:24:42 +00:00
feat(source/local): Button to invalidate local source manga cover
In case Android somehow messing up the URI the first time
This commit is contained in:
parent
931a4e84c3
commit
4f46d0ee28
5 changed files with 34 additions and 12 deletions
|
@ -9,6 +9,10 @@
|
|||
|
||||
## Other ?? Technical stuff, what happened behind the scene
|
||||
-->
|
||||
## Additions
|
||||
- Add button to local source's entry info editor to invalidate cover,
|
||||
in case Android messing it up (especially on heavily modified ROMs)
|
||||
|
||||
## Changes
|
||||
- Add more info to WorkerInfo page
|
||||
- Added "next scheduled run"
|
||||
|
|
|
@ -72,6 +72,13 @@ class LocalSource(private val context: Context) : CatalogueSource, UnmeteredSour
|
|||
}
|
||||
}
|
||||
|
||||
fun invalidateCover(manga: SManga) {
|
||||
val dir = getBaseDirectory()?.findFile(manga.url) ?: return
|
||||
val cover = getCoverFile(dir) ?: return
|
||||
|
||||
manga.thumbnail_url = cover.uri.toString()
|
||||
}
|
||||
|
||||
fun updateCover(manga: SManga, input: InputStream): UniFile? {
|
||||
val dir = getBaseDirectory()?.findFile(manga.url)
|
||||
if (dir == null) {
|
||||
|
|
|
@ -216,14 +216,22 @@ class EditMangaDialog : DialogController {
|
|||
true
|
||||
}
|
||||
|
||||
binding.resetCover.isVisible = !isLocal
|
||||
binding.resetCover.setOnClickListener {
|
||||
binding.mangaCover.load(
|
||||
manga,
|
||||
) {
|
||||
extras[MangaCoverFetcher.USE_CUSTOM_COVER_KEY] = false
|
||||
binding.resetCover.text = context.getString(
|
||||
if (isLocal) {
|
||||
MR.strings.invalidate_cover
|
||||
} else {
|
||||
MR.strings.reset_cover
|
||||
}
|
||||
)
|
||||
binding.resetCover.setOnClickListener {
|
||||
if (!isLocal) {
|
||||
binding.mangaCover.load(
|
||||
manga,
|
||||
) {
|
||||
extras[MangaCoverFetcher.USE_CUSTOM_COVER_KEY] = false
|
||||
}
|
||||
customCoverUri = null
|
||||
}
|
||||
customCoverUri = null
|
||||
willResetCover = true
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,10 +12,6 @@ import coil3.request.SuccessResult
|
|||
import com.hippo.unifile.UniFile
|
||||
import dev.icerock.moko.resources.StringResource
|
||||
import eu.kanade.tachiyomi.BuildConfig
|
||||
import eu.kanade.tachiyomi.R
|
||||
import yokai.i18n.MR
|
||||
import yokai.util.lang.getString
|
||||
import dev.icerock.moko.resources.compose.stringResource
|
||||
import eu.kanade.tachiyomi.data.cache.CoverCache
|
||||
import eu.kanade.tachiyomi.data.database.DatabaseHelper
|
||||
import eu.kanade.tachiyomi.data.database.models.Category
|
||||
|
@ -81,6 +77,8 @@ import yokai.domain.library.custom.model.CustomMangaInfo
|
|||
import yokai.domain.manga.interactor.UpdateManga
|
||||
import yokai.domain.manga.models.MangaUpdate
|
||||
import yokai.domain.storage.StorageManager
|
||||
import yokai.i18n.MR
|
||||
import yokai.util.lang.getString
|
||||
import java.io.File
|
||||
import java.io.FileOutputStream
|
||||
import java.io.OutputStream
|
||||
|
@ -854,7 +852,11 @@ class MangaDetailsPresenter(
|
|||
if (uri != null) {
|
||||
editCoverWithStream(uri)
|
||||
} else if (resetCover) {
|
||||
coverCache.deleteCustomCover(manga)
|
||||
if (!manga.isLocal()) {
|
||||
coverCache.deleteCustomCover(manga)
|
||||
} else {
|
||||
LocalSource.invalidateCover(manga)
|
||||
}
|
||||
view?.setPaletteColor()
|
||||
}
|
||||
view?.updateHeader()
|
||||
|
|
|
@ -553,6 +553,7 @@
|
|||
<string name="add_tag">Add tag</string>
|
||||
<string name="clear_tags">Clear tags</string>
|
||||
<string name="reset_tags">Reset tags</string>
|
||||
<string name="invalidate_cover">Invalidate cover</string>
|
||||
<string name="reset_cover">Reset cover</string>
|
||||
<string name="failed_to_update_cover">Failed to update cover</string>
|
||||
<string name="must_be_in_library_to_edit">Series must be in your library to edit</string>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue