|
|
@ -19,7 +19,10 @@ import io.legado.app.data.entities.Book |
|
|
|
import io.legado.app.data.entities.BookChapter |
|
|
|
import io.legado.app.data.entities.BookChapter |
|
|
|
import io.legado.app.data.entities.BookGroup |
|
|
|
import io.legado.app.data.entities.BookGroup |
|
|
|
import io.legado.app.databinding.ActivityCacheBookBinding |
|
|
|
import io.legado.app.databinding.ActivityCacheBookBinding |
|
|
|
|
|
|
|
import io.legado.app.databinding.DialogEditTextBinding |
|
|
|
|
|
|
|
import io.legado.app.help.AppConfig |
|
|
|
import io.legado.app.help.BookHelp |
|
|
|
import io.legado.app.help.BookHelp |
|
|
|
|
|
|
|
import io.legado.app.lib.dialogs.alert |
|
|
|
import io.legado.app.service.help.CacheBook |
|
|
|
import io.legado.app.service.help.CacheBook |
|
|
|
import io.legado.app.ui.filepicker.FilePicker |
|
|
|
import io.legado.app.ui.filepicker.FilePicker |
|
|
|
import io.legado.app.ui.filepicker.FilePickerDialog |
|
|
|
import io.legado.app.ui.filepicker.FilePickerDialog |
|
|
@ -96,6 +99,12 @@ class CacheActivity : VMBaseActivity<ActivityCacheBookBinding, CacheViewModel>() |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
CacheBook.stop(this@CacheActivity) |
|
|
|
CacheBook.stop(this@CacheActivity) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
R.id.menu_export_folder -> { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
R.id.menu_export_charset -> { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
R.id.menu_log -> { |
|
|
|
R.id.menu_log -> { |
|
|
|
TextListDialog.show(supportFragmentManager, getString(R.string.log), CacheBook.logs) |
|
|
|
TextListDialog.show(supportFragmentManager, getString(R.string.log), CacheBook.logs) |
|
|
@ -209,6 +218,22 @@ class CacheActivity : VMBaseActivity<ActivityCacheBookBinding, CacheViewModel>() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private fun showCharsetConfig() { |
|
|
|
|
|
|
|
val charsets = |
|
|
|
|
|
|
|
arrayListOf("UTF-8", "GB2312", "GBK", "Unicode", "UTF-16", "UTF-16LE", "ASCII") |
|
|
|
|
|
|
|
alert(R.string.set_charset) { |
|
|
|
|
|
|
|
val alertBinding = DialogEditTextBinding.inflate(layoutInflater).apply { |
|
|
|
|
|
|
|
editView.setFilterValues(charsets) |
|
|
|
|
|
|
|
editView.setText(AppConfig.exportCharset) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
customView { alertBinding.root } |
|
|
|
|
|
|
|
okButton { |
|
|
|
|
|
|
|
AppConfig.exportCharset = alertBinding.editView.text?.toString() ?: "UTF-8" |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
cancelButton() |
|
|
|
|
|
|
|
}.show() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { |
|
|
|
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) { |
|
|
|
super.onActivityResult(requestCode, resultCode, data) |
|
|
|
super.onActivityResult(requestCode, resultCode, data) |
|
|
|
when (requestCode) { |
|
|
|
when (requestCode) { |
|
|
|