mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-22 18:51:49 +01:00
Minor cleanup
This commit is contained in:
parent
45fad147bf
commit
d7d46f4447
@ -271,18 +271,13 @@ class LocalSource(private val context: Context) : CatalogueSource {
|
|||||||
throw Exception(context.getString(R.string.chapter_not_found))
|
throw Exception(context.getString(R.string.chapter_not_found))
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getFormat(file: File): Format {
|
private fun getFormat(file: File) = with(file) {
|
||||||
return file.run {
|
when {
|
||||||
when {
|
isDirectory -> Format.Directory(this)
|
||||||
isDirectory -> Format.Directory(file)
|
extension.equals("zip", true) || extension.equals("cbz", true) -> Format.Zip(this)
|
||||||
extension.equals("zip", true) -> Format.Zip(file)
|
extension.equals("rar", true) || extension.equals("cbr", true) -> Format.Rar(this)
|
||||||
extension.equals("cbz", true) -> Format.Zip(file)
|
extension.equals("epub", true) -> Format.Epub(this)
|
||||||
extension.equals("rar", true) -> Format.Rar(file)
|
else -> throw Exception(context.getString(R.string.local_invalid_format))
|
||||||
extension.equals("cbr", true) -> Format.Rar(file)
|
|
||||||
extension.equals("epub", true) -> Format.Epub(file)
|
|
||||||
|
|
||||||
else -> throw Exception("Invalid chapter format")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -368,7 +368,8 @@ class MangaInfoHeaderAdapter(
|
|||||||
private fun updateDescription(description: String?, isCurrentlyExpanded: Boolean): CharSequence {
|
private fun updateDescription(description: String?, isCurrentlyExpanded: Boolean): CharSequence {
|
||||||
return when {
|
return when {
|
||||||
description.isNullOrBlank() -> view.context.getString(R.string.unknown)
|
description.isNullOrBlank() -> view.context.getString(R.string.unknown)
|
||||||
isCurrentlyExpanded -> description
|
isCurrentlyExpanded ->
|
||||||
|
description
|
||||||
.replace(Regex(" +\$", setOf(RegexOption.MULTILINE)), "")
|
.replace(Regex(" +\$", setOf(RegexOption.MULTILINE)), "")
|
||||||
.replace(Regex("[\\r\\n]{2,}", setOf(RegexOption.MULTILINE)), "\n")
|
.replace(Regex("[\\r\\n]{2,}", setOf(RegexOption.MULTILINE)), "\n")
|
||||||
else -> description
|
else -> description
|
||||||
|
Loading…
Reference in New Issue
Block a user