|
|
@ -6,11 +6,11 @@ import android.view.ViewGroup |
|
|
|
import io.legado.app.R |
|
|
|
import io.legado.app.R |
|
|
|
import io.legado.app.base.BaseDialogFragment |
|
|
|
import io.legado.app.base.BaseDialogFragment |
|
|
|
import io.legado.app.databinding.DialogCheckSourceConfigBinding |
|
|
|
import io.legado.app.databinding.DialogCheckSourceConfigBinding |
|
|
|
import io.legado.app.model.CheckSource |
|
|
|
|
|
|
|
import io.legado.app.lib.theme.primaryColor |
|
|
|
import io.legado.app.lib.theme.primaryColor |
|
|
|
|
|
|
|
import io.legado.app.model.CheckSource |
|
|
|
import io.legado.app.utils.setLayout |
|
|
|
import io.legado.app.utils.setLayout |
|
|
|
import io.legado.app.utils.viewbindingdelegate.viewBinding |
|
|
|
|
|
|
|
import io.legado.app.utils.toastOnUi |
|
|
|
import io.legado.app.utils.toastOnUi |
|
|
|
|
|
|
|
import io.legado.app.utils.viewbindingdelegate.viewBinding |
|
|
|
import splitties.views.onClick |
|
|
|
import splitties.views.onClick |
|
|
|
|
|
|
|
|
|
|
|
class CheckSourceConfig : BaseDialogFragment(R.layout.dialog_check_source_config) { |
|
|
|
class CheckSourceConfig : BaseDialogFragment(R.layout.dialog_check_source_config) { |
|
|
@ -31,11 +31,11 @@ class CheckSourceConfig : BaseDialogFragment(R.layout.dialog_check_source_config |
|
|
|
binding.toolBar.setBackgroundColor(primaryColor) |
|
|
|
binding.toolBar.setBackgroundColor(primaryColor) |
|
|
|
CheckSource.run { |
|
|
|
CheckSource.run { |
|
|
|
binding.checkSourceTimeout.setText((timeout / 1000).toString()) |
|
|
|
binding.checkSourceTimeout.setText((timeout / 1000).toString()) |
|
|
|
binding.checkSearch?.isChecked = checkSearch |
|
|
|
binding.checkSearch.isChecked = checkSearch |
|
|
|
binding.checkDiscovery?.isChecked = checkDiscovery |
|
|
|
binding.checkDiscovery.isChecked = checkDiscovery |
|
|
|
binding.checkInfo?.isChecked = checkInfo |
|
|
|
binding.checkInfo.isChecked = checkInfo |
|
|
|
binding.checkCategory?.isChecked = checkCategory |
|
|
|
binding.checkCategory.isChecked = checkCategory |
|
|
|
binding.checkContent?.isChecked = checkContent |
|
|
|
binding.checkContent.isChecked = checkContent |
|
|
|
binding.tvCancel.onClick { |
|
|
|
binding.tvCancel.onClick { |
|
|
|
dismiss() |
|
|
|
dismiss() |
|
|
|
} |
|
|
|
} |
|
|
@ -47,22 +47,28 @@ class CheckSourceConfig : BaseDialogFragment(R.layout.dialog_check_source_config |
|
|
|
return@onClick |
|
|
|
return@onClick |
|
|
|
} |
|
|
|
} |
|
|
|
text.toLong() < minTimeout -> { |
|
|
|
text.toLong() < minTimeout -> { |
|
|
|
toastOnUi("${getString(R.string.timeout)}${getString(R.string.less_than)}${minTimeout}${getString(R.string.seconds)}") |
|
|
|
toastOnUi( |
|
|
|
|
|
|
|
"${getString(R.string.timeout)}${getString(R.string.less_than)}${minTimeout}${ |
|
|
|
|
|
|
|
getString( |
|
|
|
|
|
|
|
R.string.seconds |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
}" |
|
|
|
|
|
|
|
) |
|
|
|
return@onClick |
|
|
|
return@onClick |
|
|
|
} |
|
|
|
} |
|
|
|
else -> timeout = text.toLong() * 1000 |
|
|
|
else -> timeout = text.toLong() * 1000 |
|
|
|
} |
|
|
|
} |
|
|
|
val _checkSearch = binding.checkSearch?.isChecked |
|
|
|
val mCheckSearch = binding.checkSearch.isChecked |
|
|
|
val _checkDiscovery = binding.checkDiscovery?.isChecked |
|
|
|
val mCheckDiscovery = binding.checkDiscovery.isChecked |
|
|
|
if (!_checkSearch && !_checkDiscovery) { |
|
|
|
if (!mCheckSearch && !mCheckDiscovery) { |
|
|
|
toastOnUi(getString(R.string.error_check_source_config)) |
|
|
|
toastOnUi(getString(R.string.error_check_source_config)) |
|
|
|
return@onClick |
|
|
|
return@onClick |
|
|
|
} |
|
|
|
} |
|
|
|
checkSearch = _checkSearch |
|
|
|
checkSearch = mCheckSearch |
|
|
|
checkDiscovery = _checkDiscovery |
|
|
|
checkDiscovery = mCheckDiscovery |
|
|
|
checkInfo = binding.checkInfo?.isChecked |
|
|
|
checkInfo = binding.checkInfo.isChecked |
|
|
|
checkCategory = binding.checkCategory?.isChecked |
|
|
|
checkCategory = binding.checkCategory.isChecked |
|
|
|
checkContent = binding.checkContent?.isChecked |
|
|
|
checkContent = binding.checkContent.isChecked |
|
|
|
putConfig() |
|
|
|
putConfig() |
|
|
|
dismiss() |
|
|
|
dismiss() |
|
|
|
} |
|
|
|
} |
|
|
|