输入url参数对话框

pull/1705/head
kunfei 3 years ago
parent 72a34942d2
commit 347d6a1ecc
  1. 31
      app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt
  2. 13
      app/src/main/java/io/legado/app/ui/widget/UrlOptionDialog.kt

@ -188,7 +188,7 @@ class AnalyzeUrl(
type = option.type
charset = option.charset
retry = option.retry
useWebView = option.webView?.toString()?.isNotBlank() == true
useWebView = option.useWebView()
webJs = option.webJs
option.js?.let { jsStr ->
evalJS(jsStr, url)?.toString()?.let {
@ -561,16 +561,25 @@ class AnalyzeUrl(
}
data class UrlOption(
val method: String?,
val charset: String?,
val headers: Any?,
val body: Any?,
val type: String?,
val js: String?,
val retry: Int = 0,
val webView: Any?,
val webJs: String?,
)
var method: String? = null,
var charset: String? = null,
var headers: Any? = null,
var body: Any? = null,
var type: String? = null,
var js: String? = null,
var retry: Int = 0,
var webView: Any? = null,
var webJs: String? = null,
) {
fun useWebView(): Boolean {
return when (webView) {
null, "", false, "false" -> false
else -> true
}
}
}
data class ConcurrentRecord(
val concurrent: Boolean,

@ -1,14 +1,17 @@
package io.legado.app.ui.widget
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.padding
import androidx.compose.material.AlertDialog
import androidx.compose.material.Checkbox
import androidx.compose.material.Text
import androidx.compose.material.TextButton
import androidx.compose.runtime.Composable
import androidx.compose.runtime.MutableState
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import io.legado.app.model.analyzeRule.AnalyzeUrl
import io.legado.app.ui.theme.AppTheme
@ -16,6 +19,7 @@ import io.legado.app.ui.theme.AppTheme
fun UrlOptionDialog(openState: MutableState<Boolean>, confirm: (String) -> Unit) {
AppTheme {
if (openState.value) {
val urlOption = AnalyzeUrl.UrlOption()
AlertDialog(
onDismissRequest = {
openState.value = false
@ -37,7 +41,14 @@ fun UrlOptionDialog(openState: MutableState<Boolean>, confirm: (String) -> Unit)
},
text = {
Column(Modifier.padding(12.dp)) {
Row(Modifier.padding(3.dp)) {
Checkbox(
checked = urlOption.useWebView(),
onCheckedChange = {
urlOption.webView = it
}
)
}
}
}
)

Loading…
Cancel
Save