|
|
|
@ -23,6 +23,7 @@ import io.legado.app.databinding.DialogEditTextBinding |
|
|
|
|
import io.legado.app.help.AppConfig |
|
|
|
|
import io.legado.app.help.BookHelp |
|
|
|
|
import io.legado.app.lib.dialogs.alert |
|
|
|
|
import io.legado.app.lib.dialogs.selector |
|
|
|
|
import io.legado.app.service.help.CacheBook |
|
|
|
|
import io.legado.app.ui.document.FilePicker |
|
|
|
|
import io.legado.app.ui.document.FilePickerParam |
|
|
|
@ -122,6 +123,7 @@ class CacheActivity : VMBaseActivity<ActivityCacheBookBinding, CacheViewModel>() |
|
|
|
|
R.id.menu_enable_replace -> AppConfig.exportUseReplace = !item.isChecked |
|
|
|
|
R.id.menu_export_web_dav -> AppConfig.exportToWebDav = !item.isChecked |
|
|
|
|
R.id.menu_export_folder -> export(-1) |
|
|
|
|
R.id.menu_export_type -> showExportTypeConfig() |
|
|
|
|
R.id.menu_export_charset -> showCharsetConfig() |
|
|
|
|
R.id.menu_log -> |
|
|
|
|
TextListDialog.show(supportFragmentManager, getString(R.string.log), CacheBook.logs) |
|
|
|
@ -239,9 +241,20 @@ class CacheActivity : VMBaseActivity<ActivityCacheBookBinding, CacheViewModel>() |
|
|
|
|
adapter.getItem(exportPosition)?.let { book -> |
|
|
|
|
Snackbar.make(binding.titleBar, R.string.exporting, Snackbar.LENGTH_INDEFINITE) |
|
|
|
|
.show() |
|
|
|
|
viewModel.exportEPUB(path, book) { |
|
|
|
|
when (AppConfig.exportType) { |
|
|
|
|
1 -> viewModel.exportEPUB(path, book) { |
|
|
|
|
binding.titleBar.snackbar(it) |
|
|
|
|
} |
|
|
|
|
else -> viewModel.export(path, book) { |
|
|
|
|
binding.titleBar.snackbar(it) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private fun showExportTypeConfig() { |
|
|
|
|
selector(R.string.export_type, arrayListOf("txt", "epub")) { _, i -> |
|
|
|
|
AppConfig.exportType = i |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|