Add custom Thumbnail Url. Support backup & restore (#1059)
* Add custom thumbnail url. Support backup & restore - add custom thumbnail url in edit info/custom - include it in backup n restore * increase chop char * edit chop char again to match screenshoot * tweak truncating middle part * apply edited cover to history, updates , others * simplify placeholder logic --------- Co-authored-by: jobobby04 <jobobby04@users.noreply.github.com>
This commit is contained in:
parent
f35031db7e
commit
c835140fe8
@ -55,6 +55,7 @@ fun Manga.copyFrom(other: SManga): Manga {
|
|||||||
// SY -->
|
// SY -->
|
||||||
val author = other.author ?: ogAuthor
|
val author = other.author ?: ogAuthor
|
||||||
val artist = other.artist ?: ogArtist
|
val artist = other.artist ?: ogArtist
|
||||||
|
val thumbnailUrl = other.thumbnail_url ?: ogThumbnailUrl
|
||||||
val description = other.description ?: ogDescription
|
val description = other.description ?: ogDescription
|
||||||
val genres = if (other.genre != null) {
|
val genres = if (other.genre != null) {
|
||||||
other.getGenres()
|
other.getGenres()
|
||||||
@ -62,15 +63,14 @@ fun Manga.copyFrom(other: SManga): Manga {
|
|||||||
ogGenre
|
ogGenre
|
||||||
}
|
}
|
||||||
// SY <--
|
// SY <--
|
||||||
val thumbnailUrl = other.thumbnail_url ?: thumbnailUrl
|
|
||||||
return this.copy(
|
return this.copy(
|
||||||
// SY -->
|
// SY -->
|
||||||
ogAuthor = author,
|
ogAuthor = author,
|
||||||
ogArtist = artist,
|
ogArtist = artist,
|
||||||
|
ogThumbnailUrl = thumbnailUrl,
|
||||||
ogDescription = description,
|
ogDescription = description,
|
||||||
ogGenre = genres,
|
ogGenre = genres,
|
||||||
// SY <--
|
// SY <--
|
||||||
thumbnailUrl = thumbnailUrl,
|
|
||||||
// SY -->
|
// SY -->
|
||||||
ogStatus = other.status.toLong(),
|
ogStatus = other.status.toLong(),
|
||||||
// SY <--
|
// SY <--
|
||||||
@ -86,11 +86,11 @@ fun SManga.toDomainManga(sourceId: Long): Manga {
|
|||||||
ogTitle = title,
|
ogTitle = title,
|
||||||
ogArtist = artist,
|
ogArtist = artist,
|
||||||
ogAuthor = author,
|
ogAuthor = author,
|
||||||
|
ogThumbnailUrl = thumbnail_url,
|
||||||
ogDescription = description,
|
ogDescription = description,
|
||||||
ogGenre = getGenres(),
|
ogGenre = getGenres(),
|
||||||
ogStatus = status.toLong(),
|
ogStatus = status.toLong(),
|
||||||
// SY <--
|
// SY <--
|
||||||
thumbnailUrl = thumbnail_url,
|
|
||||||
updateStrategy = update_strategy,
|
updateStrategy = update_strategy,
|
||||||
initialized = initialized,
|
initialized = initialized,
|
||||||
source = sourceId,
|
source = sourceId,
|
||||||
|
@ -86,7 +86,7 @@ private fun BrowseSourceComfortableGridItem(
|
|||||||
mangaId = manga.id,
|
mangaId = manga.id,
|
||||||
sourceId = manga.source,
|
sourceId = manga.source,
|
||||||
isMangaFavorite = manga.favorite,
|
isMangaFavorite = manga.favorite,
|
||||||
url = manga.thumbnailUrl,
|
ogUrl = manga.thumbnailUrl,
|
||||||
lastModified = manga.coverLastModified,
|
lastModified = manga.coverLastModified,
|
||||||
),
|
),
|
||||||
coverAlpha = if (manga.favorite) CommonMangaItemDefaults.BrowseFavoriteCoverAlpha else 1f,
|
coverAlpha = if (manga.favorite) CommonMangaItemDefaults.BrowseFavoriteCoverAlpha else 1f,
|
||||||
|
@ -86,7 +86,7 @@ private fun BrowseSourceCompactGridItem(
|
|||||||
mangaId = manga.id,
|
mangaId = manga.id,
|
||||||
sourceId = manga.source,
|
sourceId = manga.source,
|
||||||
isMangaFavorite = manga.favorite,
|
isMangaFavorite = manga.favorite,
|
||||||
url = manga.thumbnailUrl,
|
ogUrl = manga.thumbnailUrl,
|
||||||
lastModified = manga.coverLastModified,
|
lastModified = manga.coverLastModified,
|
||||||
),
|
),
|
||||||
coverAlpha = if (manga.favorite) CommonMangaItemDefaults.BrowseFavoriteCoverAlpha else 1f,
|
coverAlpha = if (manga.favorite) CommonMangaItemDefaults.BrowseFavoriteCoverAlpha else 1f,
|
||||||
|
@ -79,7 +79,7 @@ private fun BrowseSourceListItem(
|
|||||||
mangaId = manga.id,
|
mangaId = manga.id,
|
||||||
sourceId = manga.source,
|
sourceId = manga.source,
|
||||||
isMangaFavorite = manga.favorite,
|
isMangaFavorite = manga.favorite,
|
||||||
url = manga.thumbnailUrl,
|
ogUrl = manga.thumbnailUrl,
|
||||||
lastModified = manga.coverLastModified,
|
lastModified = manga.coverLastModified,
|
||||||
),
|
),
|
||||||
coverAlpha = if (manga.favorite) CommonMangaItemDefaults.BrowseFavoriteCoverAlpha else 1f,
|
coverAlpha = if (manga.favorite) CommonMangaItemDefaults.BrowseFavoriteCoverAlpha else 1f,
|
||||||
|
@ -103,7 +103,7 @@ class HistoryScreenModelStateProvider : PreviewParameterProvider<HistoryScreenMo
|
|||||||
mangaId = Random.nextLong(),
|
mangaId = Random.nextLong(),
|
||||||
sourceId = Random.nextLong(),
|
sourceId = Random.nextLong(),
|
||||||
isMangaFavorite = Random.nextBoolean(),
|
isMangaFavorite = Random.nextBoolean(),
|
||||||
url = "https://example.com/cover.png",
|
ogUrl = "https://example.com/cover.png",
|
||||||
lastModified = Random.nextLong(),
|
lastModified = Random.nextLong(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -20,7 +20,7 @@ internal class HistoryWithRelationsProvider : PreviewParameterProvider<HistoryWi
|
|||||||
mangaId = 3L,
|
mangaId = 3L,
|
||||||
sourceId = 4L,
|
sourceId = 4L,
|
||||||
isMangaFavorite = false,
|
isMangaFavorite = false,
|
||||||
url = "https://example.com/cover.png",
|
ogUrl = "https://example.com/cover.png",
|
||||||
lastModified = 5L,
|
lastModified = 5L,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
@ -39,7 +39,7 @@ internal class HistoryWithRelationsProvider : PreviewParameterProvider<HistoryWi
|
|||||||
mangaId = 3L,
|
mangaId = 3L,
|
||||||
sourceId = 4L,
|
sourceId = 4L,
|
||||||
isMangaFavorite = false,
|
isMangaFavorite = false,
|
||||||
url = "https://example.com/cover.png",
|
ogUrl = "https://example.com/cover.png",
|
||||||
lastModified = 5L,
|
lastModified = 5L,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
@ -58,7 +58,7 @@ internal class HistoryWithRelationsProvider : PreviewParameterProvider<HistoryWi
|
|||||||
mangaId = 3L,
|
mangaId = 3L,
|
||||||
sourceId = 4L,
|
sourceId = 4L,
|
||||||
isMangaFavorite = false,
|
isMangaFavorite = false,
|
||||||
url = "https://example.com/cover.png",
|
ogUrl = "https://example.com/cover.png",
|
||||||
lastModified = 5L,
|
lastModified = 5L,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
@ -41,7 +41,7 @@ internal fun LibraryComfortableGrid(
|
|||||||
mangaId = manga.id,
|
mangaId = manga.id,
|
||||||
sourceId = manga.source,
|
sourceId = manga.source,
|
||||||
isMangaFavorite = manga.favorite,
|
isMangaFavorite = manga.favorite,
|
||||||
url = manga.thumbnailUrl,
|
ogUrl = manga.thumbnailUrl,
|
||||||
lastModified = manga.coverLastModified,
|
lastModified = manga.coverLastModified,
|
||||||
),
|
),
|
||||||
coverBadgeStart = {
|
coverBadgeStart = {
|
||||||
|
@ -42,7 +42,7 @@ internal fun LibraryCompactGrid(
|
|||||||
mangaId = manga.id,
|
mangaId = manga.id,
|
||||||
sourceId = manga.source,
|
sourceId = manga.source,
|
||||||
isMangaFavorite = manga.favorite,
|
isMangaFavorite = manga.favorite,
|
||||||
url = manga.thumbnailUrl,
|
ogUrl = manga.thumbnailUrl,
|
||||||
lastModified = manga.coverLastModified,
|
lastModified = manga.coverLastModified,
|
||||||
),
|
),
|
||||||
coverBadgeStart = {
|
coverBadgeStart = {
|
||||||
|
@ -51,7 +51,7 @@ internal fun LibraryList(
|
|||||||
mangaId = manga.id,
|
mangaId = manga.id,
|
||||||
sourceId = manga.source,
|
sourceId = manga.source,
|
||||||
isMangaFavorite = manga.favorite,
|
isMangaFavorite = manga.favorite,
|
||||||
url = manga.thumbnailUrl,
|
ogUrl = manga.thumbnailUrl,
|
||||||
lastModified = manga.coverLastModified,
|
lastModified = manga.coverLastModified,
|
||||||
),
|
),
|
||||||
badge = {
|
badge = {
|
||||||
|
@ -140,6 +140,7 @@ private fun Manga.toBackupManga(/* SY --> */customMangaInfo: CustomMangaInfo?/*
|
|||||||
backupManga.customTitle = it.title
|
backupManga.customTitle = it.title
|
||||||
backupManga.customArtist = it.artist
|
backupManga.customArtist = it.artist
|
||||||
backupManga.customAuthor = it.author
|
backupManga.customAuthor = it.author
|
||||||
|
backupManga.customThumbnailUrl = it.thumbnailUrl
|
||||||
backupManga.customDescription = it.description
|
backupManga.customDescription = it.description
|
||||||
backupManga.customGenre = it.genre
|
backupManga.customGenre = it.genre
|
||||||
backupManga.customStatus = it.status?.toInt() ?: 0
|
backupManga.customStatus = it.status?.toInt() ?: 0
|
||||||
|
@ -45,6 +45,7 @@ data class BackupManga(
|
|||||||
@ProtoNumber(600) var mergedMangaReferences: List<BackupMergedMangaReference> = emptyList(),
|
@ProtoNumber(600) var mergedMangaReferences: List<BackupMergedMangaReference> = emptyList(),
|
||||||
@ProtoNumber(601) var flatMetadata: BackupFlatMetadata? = null,
|
@ProtoNumber(601) var flatMetadata: BackupFlatMetadata? = null,
|
||||||
@ProtoNumber(602) var customStatus: Int = 0,
|
@ProtoNumber(602) var customStatus: Int = 0,
|
||||||
|
@ProtoNumber(603) var customThumbnailUrl: String? = null,
|
||||||
|
|
||||||
// J2K specific values
|
// J2K specific values
|
||||||
@ProtoNumber(800) var customTitle: String? = null,
|
@ProtoNumber(800) var customTitle: String? = null,
|
||||||
@ -53,6 +54,7 @@ data class BackupManga(
|
|||||||
// skipping 803 due to using duplicate value in previous builds
|
// skipping 803 due to using duplicate value in previous builds
|
||||||
@ProtoNumber(804) var customDescription: String? = null,
|
@ProtoNumber(804) var customDescription: String? = null,
|
||||||
@ProtoNumber(805) var customGenre: List<String>? = null,
|
@ProtoNumber(805) var customGenre: List<String>? = null,
|
||||||
|
|
||||||
) {
|
) {
|
||||||
fun getMangaImpl(): Manga {
|
fun getMangaImpl(): Manga {
|
||||||
return Manga.create().copy(
|
return Manga.create().copy(
|
||||||
@ -61,11 +63,11 @@ data class BackupManga(
|
|||||||
ogTitle = this@BackupManga.title,
|
ogTitle = this@BackupManga.title,
|
||||||
ogArtist = this@BackupManga.artist,
|
ogArtist = this@BackupManga.artist,
|
||||||
ogAuthor = this@BackupManga.author,
|
ogAuthor = this@BackupManga.author,
|
||||||
|
ogThumbnailUrl = this@BackupManga.thumbnailUrl,
|
||||||
ogDescription = this@BackupManga.description,
|
ogDescription = this@BackupManga.description,
|
||||||
ogGenre = this@BackupManga.genre,
|
ogGenre = this@BackupManga.genre,
|
||||||
ogStatus = this@BackupManga.status.toLong(),
|
ogStatus = this@BackupManga.status.toLong(),
|
||||||
// SY <--
|
// SY <--
|
||||||
thumbnailUrl = this@BackupManga.thumbnailUrl,
|
|
||||||
favorite = this@BackupManga.favorite,
|
favorite = this@BackupManga.favorite,
|
||||||
source = this@BackupManga.source,
|
source = this@BackupManga.source,
|
||||||
dateAdded = this@BackupManga.dateAdded,
|
dateAdded = this@BackupManga.dateAdded,
|
||||||
|
@ -120,7 +120,7 @@ class MangaRestorer(
|
|||||||
ogArtist = newer.artist,
|
ogArtist = newer.artist,
|
||||||
ogDescription = newer.description,
|
ogDescription = newer.description,
|
||||||
ogGenre = newer.genre,
|
ogGenre = newer.genre,
|
||||||
thumbnailUrl = newer.thumbnailUrl,
|
ogThumbnailUrl = newer.thumbnailUrl,
|
||||||
ogStatus = newer.status,
|
ogStatus = newer.status,
|
||||||
// SY <--
|
// SY <--
|
||||||
initialized = this.initialized || newer.initialized,
|
initialized = this.initialized || newer.initialized,
|
||||||
@ -507,6 +507,7 @@ class MangaRestorer(
|
|||||||
if (customTitle != null ||
|
if (customTitle != null ||
|
||||||
customArtist != null ||
|
customArtist != null ||
|
||||||
customAuthor != null ||
|
customAuthor != null ||
|
||||||
|
customThumbnailUrl != null ||
|
||||||
customDescription != null ||
|
customDescription != null ||
|
||||||
customGenre != null ||
|
customGenre != null ||
|
||||||
customStatus != 0
|
customStatus != 0
|
||||||
@ -516,6 +517,7 @@ class MangaRestorer(
|
|||||||
title = customTitle,
|
title = customTitle,
|
||||||
author = customAuthor,
|
author = customAuthor,
|
||||||
artist = customArtist,
|
artist = customArtist,
|
||||||
|
thumbnailUrl = customThumbnailUrl,
|
||||||
description = customDescription,
|
description = customDescription,
|
||||||
genre = customGenre,
|
genre = customGenre,
|
||||||
status = customStatus.takeUnless { it == 0 }?.toLong(),
|
status = customStatus.takeUnless { it == 0 }?.toLong(),
|
||||||
|
@ -729,6 +729,7 @@ class LibraryScreenModel(
|
|||||||
title = editedTitle.nullIfBlank(),
|
title = editedTitle.nullIfBlank(),
|
||||||
author = manga.author.takeUnless { it == manga.ogAuthor },
|
author = manga.author.takeUnless { it == manga.ogAuthor },
|
||||||
artist = manga.artist.takeUnless { it == manga.ogArtist },
|
artist = manga.artist.takeUnless { it == manga.ogArtist },
|
||||||
|
thumbnailUrl = manga.thumbnailUrl.takeUnless { it == manga.ogThumbnailUrl },
|
||||||
description = manga.description.takeUnless { it == manga.ogDescription },
|
description = manga.description.takeUnless { it == manga.ogDescription },
|
||||||
genre = manga.genre.takeUnless { it == manga.ogGenre },
|
genre = manga.genre.takeUnless { it == manga.ogGenre },
|
||||||
status = manga.status.takeUnless { it == manga.ogStatus }?.toLong(),
|
status = manga.status.takeUnless { it == manga.ogStatus }?.toLong(),
|
||||||
|
@ -50,6 +50,7 @@ fun EditMangaDialog(
|
|||||||
title: String?,
|
title: String?,
|
||||||
author: String?,
|
author: String?,
|
||||||
artist: String?,
|
artist: String?,
|
||||||
|
thumbnailUrl: String?,
|
||||||
description: String?,
|
description: String?,
|
||||||
tags: List<String>?,
|
tags: List<String>?,
|
||||||
status: Long?,
|
status: Long?,
|
||||||
@ -69,6 +70,7 @@ fun EditMangaDialog(
|
|||||||
binding.title.text.toString(),
|
binding.title.text.toString(),
|
||||||
binding.mangaAuthor.text.toString(),
|
binding.mangaAuthor.text.toString(),
|
||||||
binding.mangaArtist.text.toString(),
|
binding.mangaArtist.text.toString(),
|
||||||
|
binding.thumbnailUrl.text.toString(),
|
||||||
binding.mangaDescription.text.toString(),
|
binding.mangaDescription.text.toString(),
|
||||||
binding.mangaGenresTags.getTextStrings(),
|
binding.mangaGenresTags.getTextStrings(),
|
||||||
binding.status.selectedItemPosition.let {
|
binding.status.selectedItemPosition.let {
|
||||||
@ -157,6 +159,7 @@ private fun onViewCreated(manga: Manga, context: Context, binding: EditMangaDial
|
|||||||
binding.title.hint = context.stringResource(SYMR.strings.title_hint, manga.url)
|
binding.title.hint = context.stringResource(SYMR.strings.title_hint, manga.url)
|
||||||
binding.mangaAuthor.setText(manga.author.orEmpty())
|
binding.mangaAuthor.setText(manga.author.orEmpty())
|
||||||
binding.mangaArtist.setText(manga.artist.orEmpty())
|
binding.mangaArtist.setText(manga.artist.orEmpty())
|
||||||
|
binding.thumbnailUrl.setText(manga.thumbnailUrl.orEmpty())
|
||||||
binding.mangaDescription.setText(manga.description.orEmpty())
|
binding.mangaDescription.setText(manga.description.orEmpty())
|
||||||
binding.mangaGenresTags.setChips(manga.genre.orEmpty().dropBlank(), scope)
|
binding.mangaGenresTags.setChips(manga.genre.orEmpty().dropBlank(), scope)
|
||||||
} else {
|
} else {
|
||||||
@ -169,12 +172,16 @@ private fun onViewCreated(manga: Manga, context: Context, binding: EditMangaDial
|
|||||||
if (manga.artist != manga.ogArtist) {
|
if (manga.artist != manga.ogArtist) {
|
||||||
binding.mangaArtist.append(manga.artist.orEmpty())
|
binding.mangaArtist.append(manga.artist.orEmpty())
|
||||||
}
|
}
|
||||||
|
if (manga.thumbnailUrl != manga.ogThumbnailUrl) {
|
||||||
|
binding.thumbnailUrl.append(manga.thumbnailUrl.orEmpty())
|
||||||
|
}
|
||||||
if (manga.description != manga.ogDescription) {
|
if (manga.description != manga.ogDescription) {
|
||||||
binding.mangaDescription.append(manga.description.orEmpty())
|
binding.mangaDescription.append(manga.description.orEmpty())
|
||||||
}
|
}
|
||||||
binding.mangaGenresTags.setChips(manga.genre.orEmpty().dropBlank(), scope)
|
binding.mangaGenresTags.setChips(manga.genre.orEmpty().dropBlank(), scope)
|
||||||
|
|
||||||
binding.title.hint = context.stringResource(SYMR.strings.title_hint, manga.ogTitle)
|
binding.title.hint = context.stringResource(SYMR.strings.title_hint, manga.ogTitle)
|
||||||
|
|
||||||
binding.mangaAuthor.hint = context.stringResource(SYMR.strings.author_hint, manga.ogAuthor ?: "")
|
binding.mangaAuthor.hint = context.stringResource(SYMR.strings.author_hint, manga.ogAuthor ?: "")
|
||||||
binding.mangaArtist.hint = context.stringResource(SYMR.strings.artist_hint, manga.ogArtist ?: "")
|
binding.mangaArtist.hint = context.stringResource(SYMR.strings.artist_hint, manga.ogArtist ?: "")
|
||||||
binding.mangaDescription.hint =
|
binding.mangaDescription.hint =
|
||||||
@ -182,6 +189,13 @@ private fun onViewCreated(manga: Manga, context: Context, binding: EditMangaDial
|
|||||||
SYMR.strings.description_hint,
|
SYMR.strings.description_hint,
|
||||||
manga.ogDescription?.takeIf { it.isNotBlank() }?.let { it.replace("\n", " ").chop(20) } ?: ""
|
manga.ogDescription?.takeIf { it.isNotBlank() }?.let { it.replace("\n", " ").chop(20) } ?: ""
|
||||||
)
|
)
|
||||||
|
binding.thumbnailUrl.hint =
|
||||||
|
context.stringResource(
|
||||||
|
SYMR.strings.thumbnail_url_hint,
|
||||||
|
manga.ogThumbnailUrl?.let {
|
||||||
|
it.chop(40) + if (it.length > 46) "." + it.substringAfterLast(".").chop(6) else ""
|
||||||
|
} ?: ""
|
||||||
|
)
|
||||||
}
|
}
|
||||||
binding.mangaGenresTags.clearFocus()
|
binding.mangaGenresTags.clearFocus()
|
||||||
|
|
||||||
|
@ -488,6 +488,7 @@ class MangaScreenModel(
|
|||||||
title: String?,
|
title: String?,
|
||||||
author: String?,
|
author: String?,
|
||||||
artist: String?,
|
artist: String?,
|
||||||
|
thumbnailUrl: String?,
|
||||||
description: String?,
|
description: String?,
|
||||||
tags: List<String>?,
|
tags: List<String>?,
|
||||||
status: Long?,
|
status: Long?,
|
||||||
@ -498,11 +499,13 @@ class MangaScreenModel(
|
|||||||
val newTitle = if (title.isNullOrBlank()) manga.url else title.trim()
|
val newTitle = if (title.isNullOrBlank()) manga.url else title.trim()
|
||||||
val newAuthor = author?.trimOrNull()
|
val newAuthor = author?.trimOrNull()
|
||||||
val newArtist = artist?.trimOrNull()
|
val newArtist = artist?.trimOrNull()
|
||||||
|
val newThumbnailUrl = thumbnailUrl?.trimOrNull()
|
||||||
val newDesc = description?.trimOrNull()
|
val newDesc = description?.trimOrNull()
|
||||||
manga = manga.copy(
|
manga = manga.copy(
|
||||||
ogTitle = newTitle,
|
ogTitle = newTitle,
|
||||||
ogAuthor = author?.trimOrNull(),
|
ogAuthor = author?.trimOrNull(),
|
||||||
ogArtist = artist?.trimOrNull(),
|
ogArtist = artist?.trimOrNull(),
|
||||||
|
ogThumbnailUrl = thumbnailUrl?.trimOrNull(),
|
||||||
ogDescription = description?.trimOrNull(),
|
ogDescription = description?.trimOrNull(),
|
||||||
ogGenre = tags?.nullIfEmpty(),
|
ogGenre = tags?.nullIfEmpty(),
|
||||||
ogStatus = status ?: 0,
|
ogStatus = status ?: 0,
|
||||||
@ -516,6 +519,7 @@ class MangaScreenModel(
|
|||||||
title = newTitle,
|
title = newTitle,
|
||||||
author = newAuthor,
|
author = newAuthor,
|
||||||
artist = newArtist,
|
artist = newArtist,
|
||||||
|
thumbnailUrl = newThumbnailUrl,
|
||||||
description = newDesc,
|
description = newDesc,
|
||||||
genre = tags,
|
genre = tags,
|
||||||
status = status,
|
status = status,
|
||||||
@ -534,6 +538,7 @@ class MangaScreenModel(
|
|||||||
title?.trimOrNull(),
|
title?.trimOrNull(),
|
||||||
author?.trimOrNull(),
|
author?.trimOrNull(),
|
||||||
artist?.trimOrNull(),
|
artist?.trimOrNull(),
|
||||||
|
thumbnailUrl?.trimOrNull(),
|
||||||
description?.trimOrNull(),
|
description?.trimOrNull(),
|
||||||
genre,
|
genre,
|
||||||
status.takeUnless { it == state.manga.ogStatus },
|
status.takeUnless { it == state.manga.ogStatus },
|
||||||
|
@ -87,6 +87,22 @@
|
|||||||
|
|
||||||
</com.google.android.material.textfield.TextInputLayout>
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
|
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="16dp"
|
||||||
|
android:layout_marginEnd="16dp">
|
||||||
|
|
||||||
|
<eu.kanade.tachiyomi.widget.TachiyomiTextInputEditText
|
||||||
|
android:id="@+id/thumbnail_url"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:inputType="text|textMultiLine"
|
||||||
|
android:textAppearance="@style/TextAppearance.AppCompat.Body1" />
|
||||||
|
|
||||||
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
<com.google.android.material.textfield.TextInputLayout
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense"
|
style="@style/Widget.MaterialComponents.TextInputLayout.OutlinedBox.Dense"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -44,7 +44,7 @@ object HistoryMapper {
|
|||||||
mangaId = mangaId,
|
mangaId = mangaId,
|
||||||
sourceId = sourceId,
|
sourceId = sourceId,
|
||||||
isMangaFavorite = isFavorite,
|
isMangaFavorite = isFavorite,
|
||||||
url = thumbnailUrl,
|
ogUrl = thumbnailUrl,
|
||||||
lastModified = coverLastModified,
|
lastModified = coverLastModified,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
@ -42,6 +42,7 @@ class CustomMangaRepositoryImpl(context: Context) : CustomMangaRepository {
|
|||||||
mangaInfo.title == null &&
|
mangaInfo.title == null &&
|
||||||
mangaInfo.author == null &&
|
mangaInfo.author == null &&
|
||||||
mangaInfo.artist == null &&
|
mangaInfo.artist == null &&
|
||||||
|
mangaInfo.thumbnailUrl == null &&
|
||||||
mangaInfo.description == null &&
|
mangaInfo.description == null &&
|
||||||
mangaInfo.genre == null &&
|
mangaInfo.genre == null &&
|
||||||
mangaInfo.status == null
|
mangaInfo.status == null
|
||||||
@ -72,6 +73,7 @@ class CustomMangaRepositoryImpl(context: Context) : CustomMangaRepository {
|
|||||||
val title: String? = null,
|
val title: String? = null,
|
||||||
val author: String? = null,
|
val author: String? = null,
|
||||||
val artist: String? = null,
|
val artist: String? = null,
|
||||||
|
val thumbnailUrl: String? = null,
|
||||||
val description: String? = null,
|
val description: String? = null,
|
||||||
val genre: List<String>? = null,
|
val genre: List<String>? = null,
|
||||||
val status: Long? = null,
|
val status: Long? = null,
|
||||||
@ -82,6 +84,7 @@ class CustomMangaRepositoryImpl(context: Context) : CustomMangaRepository {
|
|||||||
title = this@MangaJson.title?.takeUnless { it.isBlank() },
|
title = this@MangaJson.title?.takeUnless { it.isBlank() },
|
||||||
author = this@MangaJson.author,
|
author = this@MangaJson.author,
|
||||||
artist = this@MangaJson.artist,
|
artist = this@MangaJson.artist,
|
||||||
|
thumbnailUrl = this@MangaJson.thumbnailUrl,
|
||||||
description = this@MangaJson.description,
|
description = this@MangaJson.description,
|
||||||
genre = this@MangaJson.genre,
|
genre = this@MangaJson.genre,
|
||||||
status = this@MangaJson.status?.takeUnless { it == 0L },
|
status = this@MangaJson.status?.takeUnless { it == 0L },
|
||||||
@ -94,6 +97,7 @@ class CustomMangaRepositoryImpl(context: Context) : CustomMangaRepository {
|
|||||||
title,
|
title,
|
||||||
author,
|
author,
|
||||||
artist,
|
artist,
|
||||||
|
thumbnailUrl,
|
||||||
description,
|
description,
|
||||||
genre,
|
genre,
|
||||||
status,
|
status,
|
||||||
|
@ -49,11 +49,11 @@ object MangaMapper {
|
|||||||
ogTitle = title,
|
ogTitle = title,
|
||||||
ogArtist = artist,
|
ogArtist = artist,
|
||||||
ogAuthor = author,
|
ogAuthor = author,
|
||||||
|
ogThumbnailUrl = thumbnailUrl,
|
||||||
ogDescription = description,
|
ogDescription = description,
|
||||||
ogGenre = genre,
|
ogGenre = genre,
|
||||||
ogStatus = status,
|
ogStatus = status,
|
||||||
// SY <--
|
// SY <--
|
||||||
thumbnailUrl = thumbnailUrl,
|
|
||||||
updateStrategy = updateStrategy,
|
updateStrategy = updateStrategy,
|
||||||
initialized = initialized,
|
initialized = initialized,
|
||||||
lastModifiedAt = lastModifiedAt,
|
lastModifiedAt = lastModifiedAt,
|
||||||
@ -150,7 +150,7 @@ object MangaMapper {
|
|||||||
ogDescription = libraryView.description,
|
ogDescription = libraryView.description,
|
||||||
ogGenre = libraryView.genre,
|
ogGenre = libraryView.genre,
|
||||||
ogStatus = libraryView.status,
|
ogStatus = libraryView.status,
|
||||||
thumbnailUrl = libraryView.thumbnail_url,
|
ogThumbnailUrl = libraryView.thumbnail_url,
|
||||||
updateStrategy = libraryView.update_strategy,
|
updateStrategy = libraryView.update_strategy,
|
||||||
initialized = libraryView.initialized,
|
initialized = libraryView.initialized,
|
||||||
fetchInterval = libraryView.calculate_interval.toInt(),
|
fetchInterval = libraryView.calculate_interval.toInt(),
|
||||||
|
@ -86,7 +86,7 @@ class UpdatesRepositoryImpl(
|
|||||||
mangaId = mangaId,
|
mangaId = mangaId,
|
||||||
sourceId = sourceId,
|
sourceId = sourceId,
|
||||||
isMangaFavorite = favorite,
|
isMangaFavorite = favorite,
|
||||||
url = thumbnailUrl,
|
ogUrl = thumbnailUrl,
|
||||||
lastModified = coverLastModified,
|
lastModified = coverLastModified,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
@ -107,7 +107,7 @@ class UpdatesRepositoryImpl(
|
|||||||
mangaId = updatesView.mangaId,
|
mangaId = updatesView.mangaId,
|
||||||
sourceId = updatesView.source,
|
sourceId = updatesView.source,
|
||||||
isMangaFavorite = updatesView.favorite,
|
isMangaFavorite = updatesView.favorite,
|
||||||
url = updatesView.thumbnailUrl,
|
ogUrl = updatesView.thumbnailUrl,
|
||||||
lastModified = updatesView.coverLastModified,
|
lastModified = updatesView.coverLastModified,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
@ -5,6 +5,7 @@ data class CustomMangaInfo(
|
|||||||
val title: String?,
|
val title: String?,
|
||||||
val author: String? = null,
|
val author: String? = null,
|
||||||
val artist: String? = null,
|
val artist: String? = null,
|
||||||
|
val thumbnailUrl: String? = null,
|
||||||
val description: String? = null,
|
val description: String? = null,
|
||||||
val genre: List<String>? = null,
|
val genre: List<String>? = null,
|
||||||
val status: Long? = null,
|
val status: Long? = null,
|
||||||
|
@ -24,11 +24,11 @@ data class Manga(
|
|||||||
val ogTitle: String,
|
val ogTitle: String,
|
||||||
val ogArtist: String?,
|
val ogArtist: String?,
|
||||||
val ogAuthor: String?,
|
val ogAuthor: String?,
|
||||||
|
val ogThumbnailUrl: String?,
|
||||||
val ogDescription: String?,
|
val ogDescription: String?,
|
||||||
val ogGenre: List<String>?,
|
val ogGenre: List<String>?,
|
||||||
val ogStatus: Long,
|
val ogStatus: Long,
|
||||||
// SY <--
|
// SY <--
|
||||||
val thumbnailUrl: String?,
|
|
||||||
val updateStrategy: UpdateStrategy,
|
val updateStrategy: UpdateStrategy,
|
||||||
val initialized: Boolean,
|
val initialized: Boolean,
|
||||||
val lastModifiedAt: Long,
|
val lastModifiedAt: Long,
|
||||||
@ -51,6 +51,9 @@ data class Manga(
|
|||||||
val artist: String?
|
val artist: String?
|
||||||
get() = customMangaInfo?.artist ?: ogArtist
|
get() = customMangaInfo?.artist ?: ogArtist
|
||||||
|
|
||||||
|
val thumbnailUrl: String?
|
||||||
|
get() = customMangaInfo?.thumbnailUrl ?: ogThumbnailUrl
|
||||||
|
|
||||||
val description: String?
|
val description: String?
|
||||||
get() = customMangaInfo?.description ?: ogDescription
|
get() = customMangaInfo?.description ?: ogDescription
|
||||||
|
|
||||||
@ -147,11 +150,11 @@ data class Manga(
|
|||||||
// SY -->
|
// SY -->
|
||||||
ogArtist = null,
|
ogArtist = null,
|
||||||
ogAuthor = null,
|
ogAuthor = null,
|
||||||
|
ogThumbnailUrl = null,
|
||||||
ogDescription = null,
|
ogDescription = null,
|
||||||
ogGenre = null,
|
ogGenre = null,
|
||||||
ogStatus = 0L,
|
ogStatus = 0L,
|
||||||
// SY <--
|
// SY <--
|
||||||
thumbnailUrl = null,
|
|
||||||
updateStrategy = UpdateStrategy.ALWAYS_UPDATE,
|
updateStrategy = UpdateStrategy.ALWAYS_UPDATE,
|
||||||
initialized = false,
|
initialized = false,
|
||||||
lastModifiedAt = 0L,
|
lastModifiedAt = 0L,
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
package tachiyomi.domain.manga.model
|
package tachiyomi.domain.manga.model
|
||||||
|
|
||||||
|
import tachiyomi.domain.manga.interactor.GetCustomMangaInfo
|
||||||
|
import uy.kohesive.injekt.injectLazy
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Contains the required data for MangaCoverFetcher
|
* Contains the required data for MangaCoverFetcher
|
||||||
*/
|
*/
|
||||||
@ -7,16 +10,26 @@ data class MangaCover(
|
|||||||
val mangaId: Long,
|
val mangaId: Long,
|
||||||
val sourceId: Long,
|
val sourceId: Long,
|
||||||
val isMangaFavorite: Boolean,
|
val isMangaFavorite: Boolean,
|
||||||
val url: String?,
|
// SY -->
|
||||||
|
val ogUrl: String?,
|
||||||
|
// SY <--
|
||||||
val lastModified: Long,
|
val lastModified: Long,
|
||||||
)
|
) {
|
||||||
|
// SY -->
|
||||||
|
val url: String = getCustomMangaInfo.get(mangaId)?.thumbnailUrl ?: ogUrl!!
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
private val getCustomMangaInfo: GetCustomMangaInfo by injectLazy()
|
||||||
|
}
|
||||||
|
// SY <--
|
||||||
|
}
|
||||||
|
|
||||||
fun Manga.asMangaCover(): MangaCover {
|
fun Manga.asMangaCover(): MangaCover {
|
||||||
return MangaCover(
|
return MangaCover(
|
||||||
mangaId = id,
|
mangaId = id,
|
||||||
sourceId = source,
|
sourceId = source,
|
||||||
isMangaFavorite = favorite,
|
isMangaFavorite = favorite,
|
||||||
url = thumbnailUrl,
|
ogUrl = thumbnailUrl,
|
||||||
lastModified = coverLastModified,
|
lastModified = coverLastModified,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -45,11 +45,11 @@ fun Manga.toMangaUpdate(): MangaUpdate {
|
|||||||
title = ogTitle,
|
title = ogTitle,
|
||||||
artist = ogArtist,
|
artist = ogArtist,
|
||||||
author = ogAuthor,
|
author = ogAuthor,
|
||||||
|
thumbnailUrl = ogThumbnailUrl,
|
||||||
description = ogDescription,
|
description = ogDescription,
|
||||||
genre = ogGenre,
|
genre = ogGenre,
|
||||||
status = ogStatus,
|
status = ogStatus,
|
||||||
// SY <--
|
// SY <--
|
||||||
thumbnailUrl = thumbnailUrl,
|
|
||||||
updateStrategy = updateStrategy,
|
updateStrategy = updateStrategy,
|
||||||
initialized = initialized,
|
initialized = initialized,
|
||||||
)
|
)
|
||||||
|
@ -344,6 +344,7 @@
|
|||||||
<string name="description_hint">Description: %1$s</string>
|
<string name="description_hint">Description: %1$s</string>
|
||||||
<string name="author_hint">Author: %1$s</string>
|
<string name="author_hint">Author: %1$s</string>
|
||||||
<string name="artist_hint">Artist: %1$s</string>
|
<string name="artist_hint">Artist: %1$s</string>
|
||||||
|
<string name="thumbnail_url_hint">Thumbnail Url: %1$s</string>
|
||||||
|
|
||||||
<!-- Browse -->
|
<!-- Browse -->
|
||||||
<!-- Sources Tab -->
|
<!-- Sources Tab -->
|
||||||
|
@ -298,6 +298,7 @@
|
|||||||
<string name="description_hint">Deskripsi: %1$s</string>
|
<string name="description_hint">Deskripsi: %1$s</string>
|
||||||
<string name="author_hint">Author: %1$s</string>
|
<string name="author_hint">Author: %1$s</string>
|
||||||
<string name="artist_hint">Artist: %1$s</string>
|
<string name="artist_hint">Artist: %1$s</string>
|
||||||
|
<string name="thumbnail_url_hint">Thumbnail Url: %1$s</string>
|
||||||
|
|
||||||
<!-- Browse -->
|
<!-- Browse -->
|
||||||
<!-- Sources Tab -->
|
<!-- Sources Tab -->
|
||||||
|
@ -124,7 +124,7 @@ abstract class BaseUpdatesGridGlanceWidget(
|
|||||||
mangaId = updatesView.mangaId,
|
mangaId = updatesView.mangaId,
|
||||||
sourceId = updatesView.sourceId,
|
sourceId = updatesView.sourceId,
|
||||||
isMangaFavorite = true,
|
isMangaFavorite = true,
|
||||||
url = updatesView.coverData.url,
|
ogUrl = updatesView.coverData.url,
|
||||||
lastModified = updatesView.coverData.lastModified,
|
lastModified = updatesView.coverData.lastModified,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
@ -33,6 +33,7 @@ interface SManga : Serializable {
|
|||||||
val originalTitle: String
|
val originalTitle: String
|
||||||
val originalAuthor: String?
|
val originalAuthor: String?
|
||||||
val originalArtist: String?
|
val originalArtist: String?
|
||||||
|
val originalThumbnailUrl: String?
|
||||||
val originalDescription: String?
|
val originalDescription: String?
|
||||||
val originalGenre: String?
|
val originalGenre: String?
|
||||||
val originalStatus: Int
|
val originalStatus: Int
|
||||||
@ -44,11 +45,11 @@ interface SManga : Serializable {
|
|||||||
it.title = originalTitle
|
it.title = originalTitle
|
||||||
it.artist = originalArtist
|
it.artist = originalArtist
|
||||||
it.author = originalAuthor
|
it.author = originalAuthor
|
||||||
|
it.thumbnail_url = originalThumbnailUrl
|
||||||
it.description = originalDescription
|
it.description = originalDescription
|
||||||
it.genre = originalGenre
|
it.genre = originalGenre
|
||||||
it.status = originalStatus
|
it.status = originalStatus
|
||||||
// SY <--
|
// SY <--
|
||||||
it.thumbnail_url = thumbnail_url
|
|
||||||
it.update_strategy = update_strategy
|
it.update_strategy = update_strategy
|
||||||
it.initialized = initialized
|
it.initialized = initialized
|
||||||
}
|
}
|
||||||
@ -103,7 +104,7 @@ fun SManga.copy(
|
|||||||
description: String? = this.originalDescription,
|
description: String? = this.originalDescription,
|
||||||
genre: String? = this.originalGenre,
|
genre: String? = this.originalGenre,
|
||||||
status: Int = this.status,
|
status: Int = this.status,
|
||||||
thumbnail_url: String? = this.thumbnail_url,
|
thumbnail_url: String? = this.originalThumbnailUrl,
|
||||||
initialized: Boolean = this.initialized,
|
initialized: Boolean = this.initialized,
|
||||||
) = SManga.create().also {
|
) = SManga.create().also {
|
||||||
it.url = url
|
it.url = url
|
||||||
|
@ -31,6 +31,8 @@ class SMangaImpl : SManga {
|
|||||||
get() = author
|
get() = author
|
||||||
override val originalArtist: String?
|
override val originalArtist: String?
|
||||||
get() = artist
|
get() = artist
|
||||||
|
override val originalThumbnailUrl: String?
|
||||||
|
get() = thumbnail_url
|
||||||
override val originalDescription: String?
|
override val originalDescription: String?
|
||||||
get() = description
|
get() = description
|
||||||
override val originalGenre: String?
|
override val originalGenre: String?
|
||||||
|
Loading…
x
Reference in New Issue
Block a user