pull/1319/head
gedoor 3 years ago
parent 38d278f46c
commit 6eba220292
  1. 4
      app/src/main/java/io/legado/app/ui/association/FileAssociationActivity.kt
  2. 24
      app/src/main/java/io/legado/app/ui/association/ImportRssSourceDialog.kt
  3. 13
      app/src/main/java/io/legado/app/ui/association/OnLineImportActivity.kt
  4. 12
      app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceActivity.kt
  5. 10
      app/src/main/java/io/legado/app/ui/rss/subscription/RuleSubActivity.kt

@ -31,7 +31,9 @@ class FileAssociationActivity :
}
viewModel.importRssSourceLive.observe(this) {
binding.rotateLoading.hide()
ImportRssSourceDialog.start(supportFragmentManager, it, true)
supportFragmentManager.showDialog(
ImportRssSourceDialog(it, true)
)
}
viewModel.importReplaceRuleLive.observe(this) {
binding.rotateLoading.hide()

@ -9,7 +9,6 @@ import android.view.MenuItem
import android.view.View
import android.view.ViewGroup
import androidx.appcompat.widget.Toolbar
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.viewModels
import androidx.recyclerview.widget.LinearLayoutManager
import io.legado.app.R
@ -27,27 +26,22 @@ import io.legado.app.help.AppConfig
import io.legado.app.lib.dialogs.alert
import io.legado.app.lib.theme.primaryColor
import io.legado.app.ui.widget.dialog.WaitDialog
import io.legado.app.utils.*
import io.legado.app.utils.dp
import io.legado.app.utils.putPrefBoolean
import io.legado.app.utils.splitNotBlank
import io.legado.app.utils.viewbindingdelegate.viewBinding
import io.legado.app.utils.visible
/**
* 导入rss源弹出窗口
*/
class ImportRssSourceDialog : BaseDialogFragment(), Toolbar.OnMenuItemClickListener {
class ImportRssSourceDialog() : BaseDialogFragment(), Toolbar.OnMenuItemClickListener {
companion object {
fun start(
fragmentManager: FragmentManager,
source: String,
finishOnDismiss: Boolean = false
) {
fragmentManager.showDialog<ImportRssSourceDialog> {
putString("source", source)
putBoolean("finishOnDismiss", finishOnDismiss)
}
constructor(source: String, finishOnDismiss: Boolean = false) : this() {
arguments = Bundle().apply {
putString("source", source)
putBoolean("finishOnDismiss", finishOnDismiss)
}
}
private val binding by viewBinding(DialogRecyclerViewBinding::bind)

@ -26,8 +26,9 @@ class OnLineImportActivity :
"bookSource" -> supportFragmentManager.showDialog(
ImportBookSourceDialog(it.second, true)
)
"rssSource" -> ImportRssSourceDialog
.start(supportFragmentManager, it.second, true)
"rssSource" -> supportFragmentManager.showDialog(
ImportRssSourceDialog(it.second, true)
)
"replaceRule" -> supportFragmentManager.showDialog(
ImportReplaceRuleDialog(it.second, true)
)
@ -46,7 +47,9 @@ class OnLineImportActivity :
"/bookSource" -> supportFragmentManager.showDialog(
ImportBookSourceDialog(url, true)
)
"/rssSource" -> ImportRssSourceDialog.start(supportFragmentManager, url, true)
"/rssSource" -> supportFragmentManager.showDialog(
ImportRssSourceDialog(url, true)
)
"/replaceRule" -> supportFragmentManager.showDialog(
ImportReplaceRuleDialog(url, true)
)
@ -66,7 +69,9 @@ class OnLineImportActivity :
"booksource" -> supportFragmentManager.showDialog(
ImportBookSourceDialog(url, true)
)
"rsssource" -> ImportRssSourceDialog.start(supportFragmentManager, url, true)
"rsssource" -> supportFragmentManager.showDialog(
ImportRssSourceDialog(url, true)
)
"replace" -> supportFragmentManager.showDialog(
ImportReplaceRuleDialog(url, true)
)

@ -53,12 +53,16 @@ class RssSourceActivity : VMBaseActivity<ActivityRssSourceBinding, RssSourceView
private var groupMenu: SubMenu? = null
private val qrCodeResult = registerForActivityResult(QrCodeResult()) {
it ?: return@registerForActivityResult
ImportRssSourceDialog.start(supportFragmentManager, it)
supportFragmentManager.showDialog(
ImportRssSourceDialog(it)
)
}
private val importDoc = registerForActivityResult(HandleFileContract()) { uri ->
kotlin.runCatching {
uri?.readText(this)?.let {
ImportRssSourceDialog.start(supportFragmentManager, it)
supportFragmentManager.showDialog(
ImportRssSourceDialog(it)
)
}
}.onFailure {
toastOnUi("readTextError:${it.localizedMessage}")
@ -286,7 +290,9 @@ class RssSourceActivity : VMBaseActivity<ActivityRssSourceBinding, RssSourceView
cacheUrls.add(0, it)
aCache.put(importRecordKey, cacheUrls.joinToString(","))
}
ImportRssSourceDialog.start(supportFragmentManager, it)
supportFragmentManager.showDialog(
ImportRssSourceDialog(it)
)
}
}
cancelButton()

@ -71,10 +71,12 @@ class RuleSubActivity : BaseActivity<ActivityRuleSubBinding>(),
override fun openSubscription(ruleSub: RuleSub) {
when (ruleSub.type) {
0 -> supportFragmentManager.showDialog(ImportBookSourceDialog(ruleSub.url))
1 -> {
ImportRssSourceDialog.start(supportFragmentManager, ruleSub.url)
}
0 -> supportFragmentManager.showDialog(
ImportBookSourceDialog(ruleSub.url)
)
1 -> supportFragmentManager.showDialog(
ImportRssSourceDialog(ruleSub.url)
)
2 -> supportFragmentManager.showDialog(
ImportReplaceRuleDialog(ruleSub.url)
)

Loading…
Cancel
Save