Minor cleanup
(cherry picked from commit 67b4e53a58209a42d03fcc00e3b7191f955bf257) # Conflicts: # app/src/main/java/eu/kanade/tachiyomi/data/backup/models/BackupManga.kt # app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryScreenModel.kt
This commit is contained in:
parent
793234760f
commit
351331a525
@ -124,7 +124,7 @@ data class BackupManga(
|
|||||||
artist = manga.ogArtist,
|
artist = manga.ogArtist,
|
||||||
author = manga.ogAuthor,
|
author = manga.ogAuthor,
|
||||||
description = manga.ogDescription,
|
description = manga.ogDescription,
|
||||||
genre = manga.ogGenre ?: emptyList(),
|
genre = manga.ogGenre.orEmpty(),
|
||||||
status = manga.ogStatus.toInt(),
|
status = manga.ogStatus.toInt(),
|
||||||
// SY <--
|
// SY <--
|
||||||
thumbnailUrl = manga.thumbnailUrl,
|
thumbnailUrl = manga.thumbnailUrl,
|
||||||
|
@ -158,7 +158,7 @@ internal class ExtensionGithubApi {
|
|||||||
isNsfw = it.nsfw == 1,
|
isNsfw = it.nsfw == 1,
|
||||||
hasReadme = it.hasReadme == 1,
|
hasReadme = it.hasReadme == 1,
|
||||||
hasChangelog = it.hasChangelog == 1,
|
hasChangelog = it.hasChangelog == 1,
|
||||||
sources = it.sources?.toExtensionSources() ?: emptyList(),
|
sources = it.sources?.toExtensionSources().orEmpty(),
|
||||||
apkName = it.apk,
|
apkName = it.apk,
|
||||||
iconUrl = "${/* SY --> */ repoUrl /* SY <-- */}icon/${it.apk.replace(".apk", ".png")}",
|
iconUrl = "${/* SY --> */ repoUrl /* SY <-- */}icon/${it.apk.replace(".apk", ".png")}",
|
||||||
// SY -->
|
// SY -->
|
||||||
|
@ -173,7 +173,7 @@ data class ExtensionDetailsState(
|
|||||||
) {
|
) {
|
||||||
|
|
||||||
val sources: List<ExtensionSourceItem>
|
val sources: List<ExtensionSourceItem>
|
||||||
get() = _sources ?: emptyList()
|
get() = _sources.orEmpty()
|
||||||
|
|
||||||
val isLoading: Boolean
|
val isLoading: Boolean
|
||||||
get() = extension == null || _sources == null
|
get() = extension == null || _sources == null
|
||||||
|
@ -64,7 +64,7 @@ data class MigrateMangaState(
|
|||||||
) {
|
) {
|
||||||
|
|
||||||
val titles: List<Manga>
|
val titles: List<Manga>
|
||||||
get() = titleList ?: emptyList()
|
get() = titleList.orEmpty()
|
||||||
|
|
||||||
val isLoading: Boolean
|
val isLoading: Boolean
|
||||||
get() = source == null || titleList == null
|
get() = source == null || titleList == null
|
||||||
|
@ -420,7 +420,7 @@ open class BrowseSourceScreenModel(
|
|||||||
return getCategories.subscribe()
|
return getCategories.subscribe()
|
||||||
.firstOrNull()
|
.firstOrNull()
|
||||||
?.filterNot { it.isSystemCategory }
|
?.filterNot { it.isSystemCategory }
|
||||||
?: emptyList()
|
.orEmpty()
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun getDuplicateLibraryManga(manga: Manga): Manga? {
|
suspend fun getDuplicateLibraryManga(manga: Manga): Manga? {
|
||||||
|
@ -518,7 +518,7 @@ class LibraryScreenModel(
|
|||||||
state.copy(ogCategories = displayCategories)
|
state.copy(ogCategories = displayCategories)
|
||||||
}
|
}
|
||||||
// SY <--
|
// SY <--
|
||||||
displayCategories.associateWith { libraryManga[it.id] ?: emptyList() }
|
displayCategories.associateWith { libraryManga[it.id].orEmpty() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1283,7 +1283,7 @@ class LibraryScreenModel(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun getLibraryItemsByPage(page: Int): List<LibraryItem> {
|
fun getLibraryItemsByPage(page: Int): List<LibraryItem> {
|
||||||
return library.values.toTypedArray().getOrNull(page) ?: emptyList()
|
return library.values.toTypedArray().getOrNull(page).orEmpty()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getMangaCountForCategory(category: Category): Int? {
|
fun getMangaCountForCategory(category: Category): Int? {
|
||||||
|
@ -25,7 +25,8 @@ class DirectoryPageLoader(val file: File) : PageLoader() {
|
|||||||
stream = streamFn
|
stream = streamFn
|
||||||
status = Page.State.READY
|
status = Page.State.READY
|
||||||
}
|
}
|
||||||
} ?: emptyList()
|
}
|
||||||
|
.orEmpty()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -57,10 +57,9 @@ class MaterialSpinnerView @JvmOverloads constructor(context: Context, attrs: Att
|
|||||||
val title = getString(R.styleable.MaterialSpinnerView_title).orEmpty()
|
val title = getString(R.styleable.MaterialSpinnerView_title).orEmpty()
|
||||||
binding.title.text = title
|
binding.title.text = title
|
||||||
|
|
||||||
val viewEntries = (
|
val viewEntries = getTextArray(R.styleable.MaterialSpinnerView_android_entries)
|
||||||
getTextArray(R.styleable.MaterialSpinnerView_android_entries)
|
.orEmpty()
|
||||||
?: emptyArray()
|
.map { it.toString() }
|
||||||
).map { it.toString() }
|
|
||||||
entries = viewEntries
|
entries = viewEntries
|
||||||
binding.details.text = viewEntries.firstOrNull().orEmpty()
|
binding.details.text = viewEntries.firstOrNull().orEmpty()
|
||||||
}
|
}
|
||||||
|
@ -366,8 +366,8 @@ actual class LocalSource(
|
|||||||
fun getFormat(chapter: SChapter): Format {
|
fun getFormat(chapter: SChapter): Format {
|
||||||
try {
|
try {
|
||||||
return fileSystem.getBaseDirectories()
|
return fileSystem.getBaseDirectories()
|
||||||
.map { directory -> File(directory, chapter.url) }
|
.map { dir -> File(dir, chapter.url) }
|
||||||
.find { chapterFile -> chapterFile.exists() }
|
.find { it.exists() }
|
||||||
?.let(Format.Companion::valueOf)
|
?.let(Format.Companion::valueOf)
|
||||||
?: throw Exception(context.getString(R.string.chapter_not_found))
|
?: throw Exception(context.getString(R.string.chapter_not_found))
|
||||||
} catch (e: Format.UnknownFormatException) {
|
} catch (e: Format.UnknownFormatException) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user