This commit is contained in:
Horis
2025-03-21 22:13:59 +08:00
parent b9742e7c2a
commit 8b9e863466
@@ -61,6 +61,7 @@ import kotlinx.coroutines.flow.flowOn
import kotlinx.coroutines.flow.map import kotlinx.coroutines.flow.map
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext import kotlinx.coroutines.withContext
import splitties.init.appCtx
import kotlin.math.max import kotlin.math.max
/** /**
@@ -440,22 +441,21 @@ class CacheActivity : VMBaseActivity<ActivityCacheBookBinding, CacheViewModel>()
alertDialog.hide() alertDialog.hide()
return@apply return@apply
} }
val text = etInputScope.text val epubScope = etInputScope.text.toString()
if (!verificationField(text.toString())) { if (!verificationField(epubScope)) {
etInputScope.error = etInputScope.error = appCtx.getString(R.string.error_scope_input)//"请输入正确的范围"
applicationContext.getString(R.string.error_scope_input)//"请输入正确的范围"
return@apply return@apply
} }
etInputScope.error = null etInputScope.error = null
val toInt = etEpubSize.text.toString().toInt() val epubSize = etEpubSize.text.toString().toIntOrNull() ?: 1
adapter.getItem(position)?.let { book -> adapter.getItem(position)?.let { book ->
startService<ExportBookService> { startService<ExportBookService> {
action = IntentAction.start action = IntentAction.start
putExtra("bookUrl", book.bookUrl) putExtra("bookUrl", book.bookUrl)
putExtra("exportType", "epub") putExtra("exportType", "epub")
putExtra("exportPath", path) putExtra("exportPath", path)
putExtra("epubSize", toInt) putExtra("epubSize", epubSize)
putExtra("epubScope", text.toString()) putExtra("epubScope", epubScope)
} }
} }
alertDialog.hide() alertDialog.hide()