pull/1710/head
kunfei 3 years ago
parent 7ebd2a7d63
commit 78c96b3362
  1. 4
      app/src/main/java/io/legado/app/ui/rss/source/edit/RssSourceEditActivity.kt
  2. 17
      app/src/main/java/io/legado/app/ui/widget/dialog/UrlOptionDialog.kt
  3. 14
      app/src/main/res/layout/dialog_url_option_edit.xml

@ -254,7 +254,9 @@ class RssSourceEditActivity :
override fun onHelpActionSelect(action: String) {
when (action) {
"urlOption" -> UrlOptionDialog(this).show()
"urlOption" -> UrlOptionDialog(this) {
sendText(it)
}.show()
"ruleHelp" -> showHelp("ruleHelp")
"jsHelp" -> showHelp("jsHelp")
"regexHelp" -> showHelp("regexHelp")

@ -26,7 +26,7 @@ import io.legado.app.utils.GSON
import io.legado.app.utils.setLayout
import splitties.init.appCtx
class UrlOptionDialog(context: Context) : Dialog(context) {
class UrlOptionDialog(context: Context, private val success: (String) -> Unit) : Dialog(context) {
val binding = DialogUrlOptionEditBinding.inflate(layoutInflater)
@ -39,10 +39,25 @@ class UrlOptionDialog(context: Context) : Dialog(context) {
super.onCreate(savedInstanceState)
setContentView(binding.root)
binding.tvOk.setOnClickListener {
success.invoke(GSON.toJson(getUrlOption()))
dismiss()
}
}
private fun getUrlOption(): AnalyzeUrl.UrlOption {
val urlOption = AnalyzeUrl.UrlOption()
urlOption.useWebView(binding.cbUseWebView.isChecked)
urlOption.setMethod(binding.editMethod.text.toString())
urlOption.setCharset(binding.editMethod.text.toString())
urlOption.setHeaders(binding.editHeaders.text.toString())
urlOption.setBody(binding.editBody.text.toString())
urlOption.setRetry(binding.editRetry.text.toString())
urlOption.setType(binding.editType.text.toString())
urlOption.setWebJs(binding.editWebJs.text.toString())
urlOption.setJs(binding.editJs.text.toString())
return urlOption
}
}

@ -108,6 +108,20 @@
</io.legado.app.ui.widget.text.TextInputLayout>
<io.legado.app.ui.widget.text.TextInputLayout
android:id="@+id/layout_type"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<io.legado.app.ui.widget.text.AutoCompleteTextView
android:id="@+id/edit_type"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="type"
tools:ignore="HardcodedText,SpeakableTextPresentCheck,TouchTargetSizeCheck" />
</io.legado.app.ui.widget.text.TextInputLayout>
<io.legado.app.ui.widget.text.TextInputLayout
android:id="@+id/layout_retry"
android:layout_width="match_parent"

Loading…
Cancel
Save