pull/1732/head 3.22.032521
kunfei 3 years ago
parent cd289e6c2a
commit 0472b2f0eb
  1. 5
      app/src/main/assets/updateLog.md
  2. 174
      app/src/main/java/io/legado/app/ui/widget/dialog/UrlOptionDialog.kt

@ -11,6 +11,11 @@
* 正文出现缺字漏字、内容缺失、排版错乱等情况,有可能是净化规则或简繁转换出现问题。 * 正文出现缺字漏字、内容缺失、排版错乱等情况,有可能是净化规则或简繁转换出现问题。
* 漫画源看书显示乱码,**阅读与其他软件的源并不通用**,请导入阅读的支持的漫画源! * 漫画源看书显示乱码,**阅读与其他软件的源并不通用**,请导入阅读的支持的漫画源!
**2022/03/25**
* 分组搜索结果为空是提示是否切换到全部分组搜索
* 修复bug
**2022/03/21** **2022/03/21**
* 一些优化和bug修复 * 一些优化和bug修复

@ -4,26 +4,11 @@ import android.app.Dialog
import android.content.Context import android.content.Context
import android.os.Bundle import android.os.Bundle
import android.view.ViewGroup import android.view.ViewGroup
import androidx.compose.foundation.layout.Column import io.legado.app.constant.AppConst
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.*
import androidx.compose.runtime.Composable
import androidx.compose.runtime.MutableState
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.input.KeyboardType
import io.legado.app.R
import io.legado.app.databinding.DialogUrlOptionEditBinding import io.legado.app.databinding.DialogUrlOptionEditBinding
import io.legado.app.model.analyzeRule.AnalyzeUrl import io.legado.app.model.analyzeRule.AnalyzeUrl
import io.legado.app.ui.theme.AppTheme
import io.legado.app.ui.widget.checkbox.LabelledCheckBox
import io.legado.app.utils.GSON import io.legado.app.utils.GSON
import io.legado.app.utils.setLayout import io.legado.app.utils.setLayout
import splitties.init.appCtx
class UrlOptionDialog(context: Context, private val success: (String) -> Unit) : Dialog(context) { class UrlOptionDialog(context: Context, private val success: (String) -> Unit) : Dialog(context) {
@ -37,6 +22,8 @@ class UrlOptionDialog(context: Context, private val success: (String) -> Unit) :
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setContentView(binding.root) setContentView(binding.root)
binding.editMethod.setFilterValues("POST", "GET")
binding.editCharset.setFilterValues(AppConst.charsets)
binding.tvOk.setOnClickListener { binding.tvOk.setOnClickListener {
success.invoke(GSON.toJson(getUrlOption())) success.invoke(GSON.toJson(getUrlOption()))
dismiss() dismiss()
@ -58,158 +45,3 @@ class UrlOptionDialog(context: Context, private val success: (String) -> Unit) :
} }
} }
@Composable
fun UrlOptionDialog(openState: MutableState<Boolean>, confirm: (String) -> Unit) {
AppTheme {
if (openState.value) {
val urlOption = AnalyzeUrl.UrlOption()
AlertDialog(
onDismissRequest = {
openState.value = false
},
confirmButton = {
TextButton(onClick = {
openState.value = false
confirm.invoke(GSON.toJson(urlOption))
}) {
Text(text = appCtx.getString(R.string.ok))
}
},
dismissButton = {
TextButton(onClick = {
openState.value = false
}) { Text(text = appCtx.getString(R.string.cancel)) }
},
title = {
Text(text = "url参数")
},
text = {
Surface {
UrlOptionView(urlOption = urlOption)
}
}
)
}
}
}
@Composable
fun UrlOptionView(urlOption: AnalyzeUrl.UrlOption) {
val useWebView = remember {
mutableStateOf(urlOption.useWebView())
}
urlOption.useWebView(useWebView.value)
val method = remember {
mutableStateOf("")
}
urlOption.setMethod(method.value)
val charset = remember {
mutableStateOf("")
}
urlOption.setCharset(charset.value)
val headers = remember {
mutableStateOf("")
}
urlOption.setHeaders(headers.value)
val body = remember {
mutableStateOf("")
}
urlOption.setBody(body.value)
val retry = remember {
mutableStateOf("")
}
urlOption.setRetry(retry.value)
val type = remember {
mutableStateOf("")
}
urlOption.setType(type.value)
val webJs = remember {
mutableStateOf("")
}
urlOption.setWebJs(webJs.value)
val js = remember {
mutableStateOf("")
}
urlOption.setJs(js.value)
Column(
Modifier
.verticalScroll(rememberScrollState())
) {
Row {
LabelledCheckBox(
checked = useWebView.value,
onCheckedChange = {
useWebView.value = it
},
label = "useWebView"
)
}
TextField(
value = method.value,
onValueChange = {
method.value = it
},
label = {
Text(text = "method")
}
)
TextField(
value = charset.value,
onValueChange = {
charset.value = it
},
label = {
Text(text = "charset")
}
)
TextField(
value = headers.value,
onValueChange = {
headers.value = it
},
label = {
Text(text = "headers")
}
)
TextField(
value = retry.value,
onValueChange = {
retry.value = it
},
label = {
Text(text = "retry")
},
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number)
)
TextField(
value = type.value,
onValueChange = {
type.value = it
},
label = {
Text(text = "type")
}
)
TextField(
value = webJs.value,
onValueChange = {
webJs.value = it
},
label = {
Text(text = "webJs")
}
)
TextField(
value = js.value,
onValueChange = {
js.value = it
},
label = {
Text(text = "js")
}
)
}
}

Loading…
Cancel
Save