pull/2514/head
Horis 2 years ago
parent a168b526b2
commit d7a5979b4a
  1. 2
      app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt
  2. 12
      app/src/main/java/io/legado/app/ui/association/ImportHttpTtsDialog.kt
  3. 2
      app/src/main/java/io/legado/app/ui/book/read/config/HttpTtsEditDialog.kt
  4. 14
      app/src/main/java/io/legado/app/ui/book/toc/TocActivity.kt
  5. 14
      app/src/main/res/layout/dialog_http_tts_edit.xml

@ -289,7 +289,7 @@ class AnalyzeUrl(
private fun fetchStart(): ConcurrentRecord? {
source ?: return null
val concurrentRate = source.concurrentRate
if (concurrentRate.isNullOrEmpty()) {
if (concurrentRate.isNullOrEmpty() || concurrentRate == "0") {
return null
}
val rateIndex = concurrentRate.indexOf("/")

@ -25,7 +25,8 @@ import io.legado.app.utils.viewbindingdelegate.viewBinding
import io.legado.app.utils.visible
import splitties.views.onClick
class ImportHttpTtsDialog() : BaseDialogFragment(R.layout.dialog_recycler_view) {
class ImportHttpTtsDialog() : BaseDialogFragment(R.layout.dialog_recycler_view),
CodeDialog.Callback {
constructor(source: String, finishOnDismiss: Boolean = false) : this() {
arguments = Bundle().apply {
@ -176,4 +177,13 @@ class ImportHttpTtsDialog() : BaseDialogFragment(R.layout.dialog_recycler_view)
}
}
override fun onCodeSave(code: String, requestId: String?) {
requestId?.toInt()?.let {
HttpTTS.fromJson(code).getOrNull()?.let { source ->
viewModel.allSources[it] = source
adapter.setItem(it, source)
}
}
}
}

@ -73,6 +73,7 @@ class HttpTtsEditDialog() : BaseDialogFragment(R.layout.dialog_http_tts_edit, tr
binding.tvName.setText(httpTTS.name)
binding.tvUrl.setText(httpTTS.url)
binding.tvContentType.setText(httpTTS.contentType)
binding.tvConcurrentRate.setText(httpTTS.concurrentRate)
binding.tvLoginUrl.setText(httpTTS.loginUrl)
binding.tvLoginUi.setText(httpTTS.loginUi)
binding.tvLoginCheckJs.setText(httpTTS.loginCheckJs)
@ -121,6 +122,7 @@ class HttpTtsEditDialog() : BaseDialogFragment(R.layout.dialog_http_tts_edit, tr
name = binding.tvName.text.toString(),
url = binding.tvUrl.text.toString(),
contentType = binding.tvContentType.text?.toString(),
concurrentRate = binding.tvConcurrentRate.text?.toString(),
loginUrl = binding.tvLoginUrl.text?.toString(),
loginUi = binding.tvLoginUi.text?.toString(),
loginCheckJs = binding.tvLoginCheckJs.text?.toString(),

@ -85,6 +85,11 @@ class TocActivity : VMBaseActivity<ActivityChapterListBinding, TocViewModel>() {
return false
}
})
setOnQueryTextFocusChangeListener { v, hasFocus ->
if (!hasFocus) {
searchView?.isIconified = true
}
}
}
return super.onCompatCreateOptionsMenu(menu)
}
@ -116,15 +121,6 @@ class TocActivity : VMBaseActivity<ActivityChapterListBinding, TocViewModel>() {
return super.onCompatOptionsItemSelected(item)
}
override fun finish() {
if (tabLayout.isGone) {
searchView?.onActionViewCollapsed()
tabLayout.visible()
} else {
super.finish()
}
}
@Suppress("DEPRECATION")
private inner class TabFragmentPageAdapter :
FragmentPagerAdapter(supportFragmentManager, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT) {

@ -75,6 +75,20 @@
</io.legado.app.ui.widget.text.TextInputLayout>
<io.legado.app.ui.widget.text.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/concurrent_rate"
tools:ignore="HardcodedText">
<io.legado.app.ui.widget.code.CodeView
android:id="@+id/tv_concurrent_rate"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:ignore="TouchTargetSizeCheck,SpeakableTextPresentCheck" />
</io.legado.app.ui.widget.text.TextInputLayout>
<io.legado.app.ui.widget.text.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"

Loading…
Cancel
Save