From 0472b2f0ebdd3684627671e54e6bc91724656d74 Mon Sep 17 00:00:00 2001 From: kunfei Date: Fri, 25 Mar 2022 21:57:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/assets/updateLog.md | 5 + .../app/ui/widget/dialog/UrlOptionDialog.kt | 176 +----------------- 2 files changed, 9 insertions(+), 172 deletions(-) diff --git a/app/src/main/assets/updateLog.md b/app/src/main/assets/updateLog.md index c7cbb44a4..51851209d 100644 --- a/app/src/main/assets/updateLog.md +++ b/app/src/main/assets/updateLog.md @@ -11,6 +11,11 @@ * 正文出现缺字漏字、内容缺失、排版错乱等情况,有可能是净化规则或简繁转换出现问题。 * 漫画源看书显示乱码,**阅读与其他软件的源并不通用**,请导入阅读的支持的漫画源! +**2022/03/25** + +* 分组搜索结果为空是提示是否切换到全部分组搜索 +* 修复bug + **2022/03/21** * 一些优化和bug修复 diff --git a/app/src/main/java/io/legado/app/ui/widget/dialog/UrlOptionDialog.kt b/app/src/main/java/io/legado/app/ui/widget/dialog/UrlOptionDialog.kt index 5f058a58f..f15eef222 100644 --- a/app/src/main/java/io/legado/app/ui/widget/dialog/UrlOptionDialog.kt +++ b/app/src/main/java/io/legado/app/ui/widget/dialog/UrlOptionDialog.kt @@ -4,26 +4,11 @@ import android.app.Dialog import android.content.Context import android.os.Bundle import android.view.ViewGroup -import androidx.compose.foundation.layout.Column -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.constant.AppConst import io.legado.app.databinding.DialogUrlOptionEditBinding 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.setLayout -import splitties.init.appCtx 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?) { super.onCreate(savedInstanceState) setContentView(binding.root) + binding.editMethod.setFilterValues("POST", "GET") + binding.editCharset.setFilterValues(AppConst.charsets) binding.tvOk.setOnClickListener { success.invoke(GSON.toJson(getUrlOption())) dismiss() @@ -57,159 +44,4 @@ class UrlOptionDialog(context: Context, private val success: (String) -> Unit) : return urlOption } -} - - -@Composable -fun UrlOptionDialog(openState: MutableState, 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") - } - ) - } -} +} \ No newline at end of file