|
|
@ -11,6 +11,7 @@ import io.legado.app.R |
|
|
|
import io.legado.app.base.VMBaseActivity |
|
|
|
import io.legado.app.base.VMBaseActivity |
|
|
|
import io.legado.app.databinding.ActivitySourceDebugBinding |
|
|
|
import io.legado.app.databinding.ActivitySourceDebugBinding |
|
|
|
import io.legado.app.help.source.exploreKinds |
|
|
|
import io.legado.app.help.source.exploreKinds |
|
|
|
|
|
|
|
import io.legado.app.lib.dialogs.selector |
|
|
|
import io.legado.app.lib.theme.accentColor |
|
|
|
import io.legado.app.lib.theme.accentColor |
|
|
|
import io.legado.app.lib.theme.primaryColor |
|
|
|
import io.legado.app.lib.theme.primaryColor |
|
|
|
import io.legado.app.ui.qrcode.QrCodeResult |
|
|
|
import io.legado.app.ui.qrcode.QrCodeResult |
|
|
@ -22,6 +23,7 @@ import io.legado.app.utils.toastOnUi |
|
|
|
import io.legado.app.utils.viewbindingdelegate.viewBinding |
|
|
|
import io.legado.app.utils.viewbindingdelegate.viewBinding |
|
|
|
import kotlinx.coroutines.launch |
|
|
|
import kotlinx.coroutines.launch |
|
|
|
import splitties.views.onClick |
|
|
|
import splitties.views.onClick |
|
|
|
|
|
|
|
import splitties.views.onLongClick |
|
|
|
|
|
|
|
|
|
|
|
class BookSourceDebugActivity : VMBaseActivity<ActivitySourceDebugBinding, BookSourceDebugModel>() { |
|
|
|
class BookSourceDebugActivity : VMBaseActivity<ActivitySourceDebugBinding, BookSourceDebugModel>() { |
|
|
|
|
|
|
|
|
|
|
@ -130,14 +132,25 @@ class BookSourceDebugActivity : VMBaseActivity<ActivitySourceDebugBinding, BookS |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
launch { |
|
|
|
launch { |
|
|
|
viewModel.bookSource?.exploreKinds()?.firstOrNull { |
|
|
|
val exploreKinds = viewModel.bookSource?.exploreKinds()?.filter { |
|
|
|
!it.url.isNullOrBlank() |
|
|
|
!it.url.isNullOrBlank() |
|
|
|
}?.let { |
|
|
|
} |
|
|
|
|
|
|
|
exploreKinds?.firstOrNull()?.let { |
|
|
|
binding.textFx.text = "${it.title}::${it.url}" |
|
|
|
binding.textFx.text = "${it.title}::${it.url}" |
|
|
|
if (it.title.startsWith("ERROR:")) { |
|
|
|
if (it.title.startsWith("ERROR:")) { |
|
|
|
adapter.addItem("获取发现出错\n${it.url}") |
|
|
|
adapter.addItem("获取发现出错\n${it.url}") |
|
|
|
openOrCloseHelp(false) |
|
|
|
openOrCloseHelp(false) |
|
|
|
searchView.clearFocus() |
|
|
|
searchView.clearFocus() |
|
|
|
|
|
|
|
return@launch |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
exploreKinds?.map { it.title }?.let { exploreKindTitles -> |
|
|
|
|
|
|
|
binding.textFx.onLongClick { |
|
|
|
|
|
|
|
selector("选择发现", exploreKindTitles) { _, index -> |
|
|
|
|
|
|
|
val explore = exploreKinds[index] |
|
|
|
|
|
|
|
binding.textFx.text = "${explore.title}::${explore.url}" |
|
|
|
|
|
|
|
searchView.setQuery(binding.textFx.text, true) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|