pull/306/head
gedoor 4 years ago
parent 4c0fff8b1f
commit cc98eb587c
  1. 7
      app/src/main/java/io/legado/app/ui/association/ImportBookSourceActivity.kt
  2. 7
      app/src/main/java/io/legado/app/ui/association/ImportReplaceRuleActivity.kt
  3. 7
      app/src/main/java/io/legado/app/ui/association/ImportRssSourceActivity.kt
  4. 11
      app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt
  5. 11
      app/src/main/java/io/legado/app/ui/replacerule/ReplaceRuleActivity.kt
  6. 11
      app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceActivity.kt

@ -6,6 +6,7 @@ import io.legado.app.R
import io.legado.app.base.VMBaseActivity
import io.legado.app.constant.Theme
import io.legado.app.data.entities.BookSource
import io.legado.app.help.IntentDataHelp
import io.legado.app.help.SourceHelp
import io.legado.app.lib.dialogs.alert
import io.legado.app.lib.dialogs.noButton
@ -33,6 +34,12 @@ class ImportBookSourceActivity : VMBaseActivity<ImportBookSourceViewModel>(
}
private fun initData() {
intent.getStringExtra("dataKey")?.let {
IntentDataHelp.getData<String>(it)?.let { source ->
viewModel.importSource(source)
return
}
}
intent.getStringExtra("source")?.let {
viewModel.importSource(it)
return

@ -7,6 +7,7 @@ import io.legado.app.R
import io.legado.app.base.VMBaseActivity
import io.legado.app.constant.Theme
import io.legado.app.data.entities.ReplaceRule
import io.legado.app.help.IntentDataHelp
import io.legado.app.lib.dialogs.alert
import io.legado.app.lib.dialogs.noButton
import io.legado.app.lib.dialogs.okButton
@ -33,6 +34,12 @@ class ImportReplaceRuleActivity : VMBaseActivity<ImportReplaceRuleViewModel>(
}
private fun initData() {
intent.getStringExtra("dataKey")?.let {
IntentDataHelp.getData<String>(it)?.let { source ->
viewModel.import(source)
return
}
}
intent.getStringExtra("source")?.let {
viewModel.import(it)
return

@ -6,6 +6,7 @@ import io.legado.app.R
import io.legado.app.base.VMBaseActivity
import io.legado.app.constant.Theme
import io.legado.app.data.entities.RssSource
import io.legado.app.help.IntentDataHelp
import io.legado.app.help.SourceHelp
import io.legado.app.lib.dialogs.alert
import io.legado.app.lib.dialogs.noButton
@ -33,6 +34,12 @@ class ImportRssSourceActivity : VMBaseActivity<ImportRssSourceViewModel>(
}
private fun initData() {
intent.getStringExtra("dataKey")?.let {
IntentDataHelp.getData<String>(it)?.let { source ->
viewModel.importSource(source)
return
}
}
intent.getStringExtra("source")?.let {
viewModel.importSource(it)
return

@ -19,6 +19,7 @@ import io.legado.app.App
import io.legado.app.R
import io.legado.app.base.VMBaseActivity
import io.legado.app.data.entities.BookSource
import io.legado.app.help.IntentDataHelp
import io.legado.app.help.ItemTouchCallback
import io.legado.app.lib.dialogs.*
import io.legado.app.lib.theme.ATH
@ -38,6 +39,7 @@ import kotlinx.android.synthetic.main.dialog_edit_text.view.*
import kotlinx.android.synthetic.main.view_search.*
import org.jetbrains.anko.startActivity
import org.jetbrains.anko.startActivityForResult
import org.jetbrains.anko.toast
import java.io.File
import java.text.Collator
@ -353,7 +355,14 @@ class BookSourceActivity : VMBaseActivity<BookSourceViewModel>(R.layout.activity
}
importRequestCode -> if (resultCode == Activity.RESULT_OK) {
data?.data?.let { uri ->
startActivity<ImportBookSourceActivity>("filePath" to uri.toString())
try {
uri.readText(this)?.let {
val dataKey = IntentDataHelp.putData(it)
startActivity<ImportBookSourceActivity>("dataKey" to dataKey)
}
} catch (e: Exception) {
toast("readTextError:${e.localizedMessage}")
}
}
}
exportRequestCode -> {

@ -20,6 +20,7 @@ import io.legado.app.R
import io.legado.app.base.VMBaseActivity
import io.legado.app.data.entities.ReplaceRule
import io.legado.app.help.BookHelp
import io.legado.app.help.IntentDataHelp
import io.legado.app.help.ItemTouchCallback
import io.legado.app.help.coroutine.Coroutine
import io.legado.app.lib.dialogs.*
@ -37,6 +38,7 @@ import kotlinx.android.synthetic.main.activity_replace_rule.*
import kotlinx.android.synthetic.main.dialog_edit_text.view.*
import kotlinx.android.synthetic.main.view_search.*
import org.jetbrains.anko.startActivity
import org.jetbrains.anko.toast
import java.io.File
@ -251,7 +253,14 @@ class ReplaceRuleActivity : VMBaseActivity<ReplaceRuleViewModel>(R.layout.activi
when (requestCode) {
importRequestCode -> if (resultCode == Activity.RESULT_OK) {
data?.data?.let { uri ->
startActivity<ImportReplaceRuleActivity>("filePath" to uri.toString())
try {
uri.readText(this)?.let {
val dataKey = IntentDataHelp.putData(it)
startActivity<ImportReplaceRuleActivity>("dataKey" to dataKey)
}
} catch (e: Exception) {
toast("readTextError:${e.localizedMessage}")
}
}
}
exportRequestCode -> if (resultCode == RESULT_OK) {

@ -19,6 +19,7 @@ import io.legado.app.App
import io.legado.app.R
import io.legado.app.base.VMBaseActivity
import io.legado.app.data.entities.RssSource
import io.legado.app.help.IntentDataHelp
import io.legado.app.help.ItemTouchCallback
import io.legado.app.lib.dialogs.*
import io.legado.app.lib.theme.ATH
@ -37,6 +38,7 @@ import kotlinx.android.synthetic.main.dialog_edit_text.view.*
import kotlinx.android.synthetic.main.view_search.*
import org.jetbrains.anko.startActivity
import org.jetbrains.anko.startActivityForResult
import org.jetbrains.anko.toast
import java.io.File
import java.text.Collator
import java.util.*
@ -255,7 +257,14 @@ class RssSourceActivity : VMBaseActivity<RssSourceViewModel>(R.layout.activity_r
when (requestCode) {
importRequestCode -> if (resultCode == Activity.RESULT_OK) {
data?.data?.let { uri ->
startActivity<ImportRssSourceActivity>("filePath" to uri.toString())
try {
uri.readText(this)?.let {
val dataKey = IntentDataHelp.putData(it)
startActivity<ImportRssSourceActivity>("dataKey" to dataKey)
}
} catch (e: Exception) {
toast("readTextError:${e.localizedMessage}")
}
}
}
qrRequestCode -> if (resultCode == RESULT_OK) {

Loading…
Cancel
Save