优化校验设置复选框选择

pull/1565/head
Xwite 3 years ago
parent b02ee96298
commit 1703c5ed1c
  1. 2
      app/src/main/java/io/legado/app/model/CheckSource.kt
  2. 42
      app/src/main/java/io/legado/app/ui/config/CheckSourceConfig.kt
  3. 10
      app/src/main/res/layout/dialog_check_source_config.xml
  4. 1
      app/src/main/res/values/strings.xml

@ -47,7 +47,7 @@ object CheckSource {
}
fun putConfig() {
CacheManager.put("checkSourceTimeout", timeout * 1000)
CacheManager.put("checkSourceTimeout", timeout)
CacheManager.put("checkSearch", checkSearch)
CacheManager.put("checkDiscovery", checkDiscovery)
CacheManager.put("checkInfo", checkInfo)

@ -31,6 +31,36 @@ class CheckSourceConfig : BaseDialogFragment(R.layout.dialog_check_source_config
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) {
binding.toolBar.setBackgroundColor(primaryColor)
binding.run {
checkSearch.onClick {
if (!checkSearch.isChecked && !checkDiscovery.isChecked) {
checkDiscovery.isChecked = true
}
}
checkDiscovery.onClick {
if (!checkSearch.isChecked && !checkDiscovery.isChecked) {
checkSearch.isChecked = true
}
}
checkInfo.onClick {
if (!checkInfo.isChecked) {
checkCategory.isChecked = false
checkContent.isChecked = false
checkCategory.isEnabled = false
checkContent.isEnabled = false
} else {
checkCategory.isEnabled = true
}
}
checkCategory.onClick {
if (!checkCategory.isChecked) {
checkContent.isChecked = false
checkContent.isEnabled = false
} else {
checkContent.isEnabled = true
}
}
}
CheckSource.run {
binding.checkSourceTimeout.setText((timeout / 1000).toString())
binding.checkSearch.isChecked = checkSearch
@ -38,6 +68,8 @@ class CheckSourceConfig : BaseDialogFragment(R.layout.dialog_check_source_config
binding.checkInfo.isChecked = checkInfo
binding.checkCategory.isChecked = checkCategory
binding.checkContent.isChecked = checkContent
binding.checkCategory.isEnabled = checkInfo
binding.checkContent.isEnabled = checkCategory
binding.tvCancel.onClick {
dismiss()
}
@ -60,14 +92,8 @@ class CheckSourceConfig : BaseDialogFragment(R.layout.dialog_check_source_config
}
else -> timeout = text.toLong() * 1000
}
val mCheckSearch = binding.checkSearch.isChecked
val mCheckDiscovery = binding.checkDiscovery.isChecked
if (!mCheckSearch && !mCheckDiscovery) {
toastOnUi(getString(R.string.error_check_source_config))
return@onClick
}
checkSearch = mCheckSearch
checkDiscovery = mCheckDiscovery
checkSearch = binding.checkSearch.isChecked
checkDiscovery = binding.checkDiscovery.isChecked
checkInfo = binding.checkInfo.isChecked
checkCategory = binding.checkCategory.isChecked
checkContent = binding.checkContent.isChecked

@ -18,6 +18,8 @@
<io.legado.app.ui.widget.text.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="12dp"
android:paddingRight="12dp"
android:paddingTop="3dp">
<io.legado.app.lib.theme.view.ThemeEditText
@ -30,15 +32,15 @@
</io.legado.app.ui.widget.text.TextInputLayout>
<io.legado.app.ui.widget.text.AccentTextView
android:paddingLeft="5dp"
android:paddingLeft="12dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/check_source_item" />
<com.google.android.flexbox.FlexboxLayout
android:layout_width="match_parent"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:paddingLeft="12dp"
android:paddingRight="12dp"
android:layout_height="wrap_content"
app:flexWrap="wrap"
app:justifyContent="space_between">
@ -74,8 +76,8 @@
<com.google.android.flexbox.FlexboxLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingLeft="12dp"
android:paddingRight="12dp"
app:flexWrap="wrap"
app:justifyContent="flex_end">
<io.legado.app.ui.widget.text.AccentTextView

@ -928,7 +928,6 @@
<string name="timeout">超时</string>
<string name="seconds"></string>
<string name="less_than">小于</string>
<string name="error_check_source_config">搜索发现至少校验一个</string>
<string name="check_source_config_summary">校验超时: %1$s秒\n校验项目:%2$s</string>
<!-- string end -->
</resources>

Loading…
Cancel
Save