pull/366/head
gedoor 4 years ago
parent 49b6d1db20
commit e8bc9374ce
  1. 4
      app/src/main/java/io/legado/app/help/storage/Backup.kt
  2. 12
      app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditActivity.kt
  3. 14
      app/src/main/java/io/legado/app/ui/rss/source/edit/RssSourceEditActivity.kt

@ -63,11 +63,11 @@ object Backup {
writeListToJson(App.db.txtTocRule().all, "txtTocRule.json", backupPath) writeListToJson(App.db.txtTocRule().all, "txtTocRule.json", backupPath)
writeListToJson(App.db.readRecordDao().all, "readRecord.json", backupPath) writeListToJson(App.db.readRecordDao().all, "readRecord.json", backupPath)
writeListToJson(App.db.httpTTSDao().all, "httpTTS.json", backupPath) writeListToJson(App.db.httpTTSDao().all, "httpTTS.json", backupPath)
GSON.toJson(ReadBookConfig.configList)?.let { GSON.toJson(ReadBookConfig.configList).let {
FileUtils.createFileIfNotExist(backupPath + File.separator + ReadBookConfig.configFileName) FileUtils.createFileIfNotExist(backupPath + File.separator + ReadBookConfig.configFileName)
.writeText(it) .writeText(it)
} }
GSON.toJson(ThemeConfig.configList)?.let { GSON.toJson(ThemeConfig.configList).let {
FileUtils.createFileIfNotExist(backupPath + File.separator + ThemeConfig.configFileName) FileUtils.createFileIfNotExist(backupPath + File.separator + ThemeConfig.configFileName)
.writeText(it) .writeText(it)
} }

@ -74,17 +74,11 @@ class BookSourceEditActivity :
} }
} }
} }
R.id.menu_copy_source -> getSource().let { source -> R.id.menu_copy_source -> sendToClip(GSON.toJson(getSource()))
GSON.toJson(source)?.let { sourceStr ->
sendToClip(sourceStr)
}
}
R.id.menu_paste_source -> viewModel.pasteSource { upRecyclerView(it) } R.id.menu_paste_source -> viewModel.pasteSource { upRecyclerView(it) }
R.id.menu_qr_code_camera -> startActivityForResult<QrCodeActivity>(qrRequestCode) R.id.menu_qr_code_camera -> startActivityForResult<QrCodeActivity>(qrRequestCode)
R.id.menu_share_str -> GSON.toJson(getSource())?.let { share(it) } R.id.menu_share_str -> share(GSON.toJson(getSource()))
R.id.menu_share_qr -> GSON.toJson(getSource())?.let { sourceStr -> R.id.menu_share_qr -> shareWithQr(getString(R.string.share_book_source), GSON.toJson(getSource()))
shareWithQr(getString(R.string.share_book_source), sourceStr)
}
R.id.menu_rule_summary -> { R.id.menu_rule_summary -> {
try { try {
val intent = Intent(Intent.ACTION_VIEW) val intent = Intent(Intent.ACTION_VIEW)

@ -91,19 +91,11 @@ class RssSourceEditActivity :
} }
} }
} }
R.id.menu_copy_source -> { R.id.menu_copy_source -> sendToClip(GSON.toJson(getRssSource()))
GSON.toJson(getRssSource())?.let { sourceStr ->
sendToClip(sourceStr)
}
}
R.id.menu_qr_code_camera -> startActivityForResult<QrCodeActivity>(qrRequestCode) R.id.menu_qr_code_camera -> startActivityForResult<QrCodeActivity>(qrRequestCode)
R.id.menu_paste_source -> viewModel.pasteSource { upRecyclerView(it) } R.id.menu_paste_source -> viewModel.pasteSource { upRecyclerView(it) }
R.id.menu_share_str -> GSON.toJson(getRssSource())?.let { sourceStr -> R.id.menu_share_str -> share(GSON.toJson(getRssSource()))
share(sourceStr) R.id.menu_share_qr -> shareWithQr(getString(R.string.share_rss_source), GSON.toJson(getRssSource()))
}
R.id.menu_share_qr -> GSON.toJson(getRssSource())?.let { sourceStr ->
shareWithQr(getString(R.string.share_rss_source), sourceStr)
}
} }
return super.onCompatOptionsItemSelected(item) return super.onCompatOptionsItemSelected(item)
} }

Loading…
Cancel
Save