Misc cleanup
This commit is contained in:
1 parent
ca324995b3
commit
714d334067
5 files changed
+3
-15
No files matched your search
@@ -278,7 +278,7 @@ object EhEngine {
|
||||
ehRequest(location, url).fetchUsingAsText {
|
||||
val document = Jsoup.parse(this)
|
||||
val elements = document.select("#chd + p")
|
||||
if (elements.size > 0) {
|
||||
if (elements.isNotEmpty()) {
|
||||
throw EhException(elements[0].text())
|
||||
}
|
||||
GalleryDetailParser.parseComments(document)
|
||||
|
||||
@@ -32,7 +32,6 @@ import io.ktor.client.HttpClient
|
||||
import io.ktor.client.request.prepareGet
|
||||
import io.ktor.client.statement.bodyAsChannel
|
||||
import java.io.File
|
||||
import java.nio.charset.StandardCharsets
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.Job
|
||||
@@ -133,7 +132,7 @@ object EhTagDatabase : CoroutineScope {
|
||||
fun isTranslatable(context: Context): Boolean = context.resources.getBoolean(R.bool.tag_translatable)
|
||||
|
||||
private fun getFileContent(file: File): String? = runCatching {
|
||||
file.source().buffer().use { it.readString(StandardCharsets.UTF_8) }
|
||||
file.source().buffer().use { it.readUtf8() }
|
||||
}.getOrNull()
|
||||
|
||||
private fun checkData(sha1: String?, data: File): Boolean = sha1 != null && sha1 == data.toOkioPath().sha1()
|
||||
|
||||
@@ -36,11 +36,7 @@ fun Context.openBrowser(url: String) {
|
||||
}
|
||||
}
|
||||
|
||||
context(Context, DestinationsNavigator)
|
||||
fun Context.jumpToReaderByPage(
|
||||
url: String,
|
||||
detail: GalleryDetail,
|
||||
): Boolean {
|
||||
fun DestinationsNavigator.jumpToReaderByPage(url: String, detail: GalleryDetail): Boolean {
|
||||
GalleryPageUrlParser.parse(url)?.let {
|
||||
if (it.gid == detail.gid) {
|
||||
navToReader(detail.galleryInfo, it.page)
|
||||
|
||||
@@ -8,7 +8,6 @@ import androidx.compose.foundation.pager.PagerState
|
||||
import androidx.compose.foundation.pager.VerticalPager
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.collectAsState
|
||||
import androidx.compose.runtime.derivedStateOf
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.remember
|
||||
|
||||
@@ -1,13 +1,7 @@
|
||||
package com.jamal.composeprefs3.ui
|
||||
|
||||
import androidx.compose.runtime.Composable
|
||||
import java.math.BigDecimal
|
||||
import java.math.RoundingMode
|
||||
|
||||
fun Any?.ifNotNullThen(content: @Composable () -> Unit): (@Composable () -> Unit)? = if (this != null) content else null
|
||||
|
||||
fun Boolean.ifTrueThen(content: @Composable () -> Unit): (@Composable () -> Unit)? = if (this) content else null
|
||||
|
||||
fun roundToDP(value: Double, places: Int): Double = BigDecimal(value).setScale(places, RoundingMode.HALF_EVEN).toDouble()
|
||||
|
||||
fun roundToDP(value: Float, places: Int): Float = BigDecimal(value.toDouble()).setScale(places, RoundingMode.HALF_EVEN).toFloat()
|
||||
Reference in new issue
Block a user