pull/1463/head^2 3.21.112719
gedoor 3 years ago
parent 98bb0b8f14
commit 5c42cc0c77
  1. 2
      app/src/main/java/io/legado/app/ui/book/group/GroupEditDialog.kt
  2. 2
      app/src/main/java/io/legado/app/ui/book/info/edit/BookInfoEditActivity.kt
  3. 2
      app/src/main/java/io/legado/app/ui/book/read/config/BgTextConfigDialog.kt
  4. 3
      app/src/main/java/io/legado/app/ui/book/source/debug/BookSourceDebugActivity.kt
  5. 2
      app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditActivity.kt
  6. 2
      app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt
  7. 14
      app/src/main/java/io/legado/app/ui/config/BackupConfigFragment.kt
  8. 3
      app/src/main/java/io/legado/app/ui/document/HandleFileActivity.kt
  9. 3
      app/src/main/java/io/legado/app/ui/qrcode/QrCodeActivity.kt
  10. 2
      app/src/main/java/io/legado/app/ui/replace/ReplaceRuleActivity.kt
  11. 2
      app/src/main/java/io/legado/app/ui/rss/source/edit/RssSourceEditActivity.kt
  12. 2
      app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceActivity.kt

@ -55,7 +55,7 @@ class GroupEditDialog() : BaseDialogFragment(R.layout.dialog_book_group_edit) {
} }
binding.run { binding.run {
ivCover.onClick { ivCover.onClick {
selectImage.launch(null) selectImage.launch()
} }
btnCancel.onClick { btnCancel.onClick {
dismiss() dismiss()

@ -58,7 +58,7 @@ class BookInfoEditActivity :
} }
} }
tvSelectCover.setOnClickListener { tvSelectCover.setOnClickListener {
selectCover.launch(null) selectCover.launch()
} }
tvRefreshCover.setOnClickListener { tvRefreshCover.setOnClickListener {
viewModel.book?.customCoverUrl = tieCoverUrl.text?.toString() viewModel.book?.customCoverUrl = tieCoverUrl.text?.toString()

@ -117,7 +117,7 @@ class BgTextConfigDialog : BaseDialogFragment(R.layout.dialog_read_bg_text) {
ivBg.setImageResource(R.drawable.ic_image) ivBg.setImageResource(R.drawable.ic_image)
ivBg.setColorFilter(primaryTextColor) ivBg.setColorFilter(primaryTextColor)
root.setOnClickListener { root.setOnClickListener {
selectBgImage.launch(null) selectBgImage.launch()
} }
} }
} }

@ -14,6 +14,7 @@ import io.legado.app.lib.theme.accentColor
import io.legado.app.lib.theme.primaryColor import io.legado.app.lib.theme.primaryColor
import io.legado.app.ui.qrcode.QrCodeResult import io.legado.app.ui.qrcode.QrCodeResult
import io.legado.app.ui.widget.dialog.TextDialog import io.legado.app.ui.widget.dialog.TextDialog
import io.legado.app.utils.launch
import io.legado.app.utils.setEdgeEffectColor import io.legado.app.utils.setEdgeEffectColor
import io.legado.app.utils.showDialogFragment import io.legado.app.utils.showDialogFragment
import io.legado.app.utils.toastOnUi import io.legado.app.utils.toastOnUi
@ -137,7 +138,7 @@ class BookSourceDebugActivity : VMBaseActivity<ActivitySourceDebugBinding, BookS
override fun onCompatOptionsItemSelected(item: MenuItem): Boolean { override fun onCompatOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) { when (item.itemId) {
R.id.menu_scan -> qrCodeResult.launch(null) R.id.menu_scan -> qrCodeResult.launch()
R.id.menu_search_src -> showDialogFragment(TextDialog(viewModel.searchSrc)) R.id.menu_search_src -> showDialogFragment(TextDialog(viewModel.searchSrc))
R.id.menu_book_src -> showDialogFragment(TextDialog(viewModel.bookSrc)) R.id.menu_book_src -> showDialogFragment(TextDialog(viewModel.bookSrc))
R.id.menu_toc_src -> showDialogFragment(TextDialog(viewModel.tocSrc)) R.id.menu_toc_src -> showDialogFragment(TextDialog(viewModel.tocSrc))

@ -112,7 +112,7 @@ class BookSourceEditActivity :
} }
R.id.menu_copy_source -> sendToClip(GSON.toJson(getSource())) R.id.menu_copy_source -> sendToClip(GSON.toJson(getSource()))
R.id.menu_paste_source -> viewModel.pasteSource { upRecyclerView(it) } R.id.menu_paste_source -> viewModel.pasteSource { upRecyclerView(it) }
R.id.menu_qr_code_camera -> qrCodeResult.launch(null) R.id.menu_qr_code_camera -> qrCodeResult.launch()
R.id.menu_share_str -> share(GSON.toJson(getSource())) R.id.menu_share_str -> share(GSON.toJson(getSource()))
R.id.menu_share_qr -> shareWithQr( R.id.menu_share_qr -> shareWithQr(
GSON.toJson(getSource()), GSON.toJson(getSource()),

@ -120,7 +120,7 @@ class BookSourceActivity : VMBaseActivity<ActivityBookSourceBinding, BookSourceV
override fun onCompatOptionsItemSelected(item: MenuItem): Boolean { override fun onCompatOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) { when (item.itemId) {
R.id.menu_add_book_source -> startActivity<BookSourceEditActivity>() R.id.menu_add_book_source -> startActivity<BookSourceEditActivity>()
R.id.menu_import_qr -> qrResult.launch(null) R.id.menu_import_qr -> qrResult.launch()
R.id.menu_group_manage -> showDialogFragment<GroupManageDialog>() R.id.menu_group_manage -> showDialogFragment<GroupManageDialog>()
R.id.menu_import_local -> importDoc.launch { R.id.menu_import_local -> importDoc.launch {
mode = HandleFileContract.FILE mode = HandleFileContract.FILE

@ -123,7 +123,7 @@ class BackupConfigFragment : BasePreferenceFragment(),
upPreferenceSummary(PreferKey.webDavPassword, getPrefString(PreferKey.webDavPassword)) upPreferenceSummary(PreferKey.webDavPassword, getPrefString(PreferKey.webDavPassword))
upPreferenceSummary(PreferKey.backupPath, getPrefString(PreferKey.backupPath)) upPreferenceSummary(PreferKey.backupPath, getPrefString(PreferKey.backupPath))
findPreference<io.legado.app.ui.widget.prefs.Preference>("web_dav_restore") findPreference<io.legado.app.ui.widget.prefs.Preference>("web_dav_restore")
?.onLongClick = { restoreDir.launch(null) } ?.onLongClick = { restoreDir.launch() }
} }
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
@ -206,11 +206,11 @@ class BackupConfigFragment : BasePreferenceFragment(),
override fun onPreferenceTreeClick(preference: Preference?): Boolean { override fun onPreferenceTreeClick(preference: Preference?): Boolean {
when (preference?.key) { when (preference?.key) {
PreferKey.backupPath -> selectBackupPath.launch(null) PreferKey.backupPath -> selectBackupPath.launch()
PreferKey.restoreIgnore -> restoreIgnore() PreferKey.restoreIgnore -> restoreIgnore()
"web_dav_backup" -> backup() "web_dav_backup" -> backup()
"web_dav_restore" -> restore() "web_dav_restore" -> restore()
"import_old" -> restoreOld.launch(null) "import_old" -> restoreOld.launch()
} }
return super.onPreferenceTreeClick(preference) return super.onPreferenceTreeClick(preference)
} }
@ -234,7 +234,7 @@ class BackupConfigFragment : BasePreferenceFragment(),
fun backup() { fun backup() {
val backupPath = AppConfig.backupPath val backupPath = AppConfig.backupPath
if (backupPath.isNullOrEmpty()) { if (backupPath.isNullOrEmpty()) {
backupDir.launch(null) backupDir.launch()
} else { } else {
if (backupPath.isContentScheme()) { if (backupPath.isContentScheme()) {
val uri = Uri.parse(backupPath) val uri = Uri.parse(backupPath)
@ -249,7 +249,7 @@ class BackupConfigFragment : BasePreferenceFragment(),
appCtx.toastOnUi(getString(R.string.backup_fail, it.localizedMessage)) appCtx.toastOnUi(getString(R.string.backup_fail, it.localizedMessage))
} }
} else { } else {
backupDir.launch(null) backupDir.launch()
} }
} else { } else {
backupUsePermission(backupPath) backupUsePermission(backupPath)
@ -301,13 +301,13 @@ class BackupConfigFragment : BasePreferenceFragment(),
Restore.restore(requireContext(), backupPath) Restore.restore(requireContext(), backupPath)
} }
} else { } else {
restoreDir.launch(null) restoreDir.launch()
} }
} else { } else {
restoreUsePermission(backupPath) restoreUsePermission(backupPath)
} }
} else { } else {
restoreDir.launch(null) restoreDir.launch()
} }
} }

@ -18,6 +18,7 @@ import io.legado.app.lib.permission.Permissions
import io.legado.app.lib.permission.PermissionsCompat import io.legado.app.lib.permission.PermissionsCompat
import io.legado.app.utils.getJsonArray import io.legado.app.utils.getJsonArray
import io.legado.app.utils.isContentScheme import io.legado.app.utils.isContentScheme
import io.legado.app.utils.launch
import io.legado.app.utils.toastOnUi import io.legado.app.utils.toastOnUi
import io.legado.app.utils.viewbindingdelegate.viewBinding import io.legado.app.utils.viewbindingdelegate.viewBinding
import java.io.File import java.io.File
@ -80,7 +81,7 @@ class HandleFileActivity :
items(selectList) { _, item, _ -> items(selectList) { _, item, _ ->
when (item.value) { when (item.value) {
HandleFileContract.DIR -> kotlin.runCatching { HandleFileContract.DIR -> kotlin.runCatching {
selectDocTree.launch(null) selectDocTree.launch()
}.onFailure { }.onFailure {
toastOnUi(R.string.open_sys_dir_picker_error) toastOnUi(R.string.open_sys_dir_picker_error)
checkPermissions { checkPermissions {

@ -12,6 +12,7 @@ import io.legado.app.base.BaseActivity
import io.legado.app.databinding.ActivityQrcodeCaptureBinding import io.legado.app.databinding.ActivityQrcodeCaptureBinding
import io.legado.app.utils.QRCodeUtils import io.legado.app.utils.QRCodeUtils
import io.legado.app.utils.SelectImageContract import io.legado.app.utils.SelectImageContract
import io.legado.app.utils.launch
import io.legado.app.utils.readBytes import io.legado.app.utils.readBytes
import io.legado.app.utils.viewbindingdelegate.viewBinding import io.legado.app.utils.viewbindingdelegate.viewBinding
@ -41,7 +42,7 @@ class QrCodeActivity : BaseActivity<ActivityQrcodeCaptureBinding>(), OnScanResul
override fun onCompatOptionsItemSelected(item: MenuItem): Boolean { override fun onCompatOptionsItemSelected(item: MenuItem): Boolean {
when (item.itemId) { when (item.itemId) {
R.id.action_choose_from_gallery -> selectQrImage.launch(null) R.id.action_choose_from_gallery -> selectQrImage.launch()
} }
return super.onCompatOptionsItemSelected(item) return super.onCompatOptionsItemSelected(item)
} }

@ -224,7 +224,7 @@ class ReplaceRuleActivity : VMBaseActivity<ActivityReplaceRuleBinding, ReplaceRu
mode = HandleFileContract.FILE mode = HandleFileContract.FILE
allowExtensions = arrayOf("txt", "json") allowExtensions = arrayOf("txt", "json")
} }
R.id.menu_import_qr -> qrCodeResult.launch(null) R.id.menu_import_qr -> qrCodeResult.launch()
R.id.menu_help -> showHelp() R.id.menu_help -> showHelp()
else -> if (item.groupId == R.id.replace_group) { else -> if (item.groupId == R.id.replace_group) {
searchView.setQuery("group:${item.title}", true) searchView.setQuery("group:${item.title}", true)

@ -125,7 +125,7 @@ class RssSourceEditActivity :
} }
} }
R.id.menu_copy_source -> sendToClip(GSON.toJson(getRssSource())) R.id.menu_copy_source -> sendToClip(GSON.toJson(getRssSource()))
R.id.menu_qr_code_camera -> qrCodeResult.launch(null) R.id.menu_qr_code_camera -> qrCodeResult.launch()
R.id.menu_paste_source -> viewModel.pasteSource { upRecyclerView(it) } R.id.menu_paste_source -> viewModel.pasteSource { upRecyclerView(it) }
R.id.menu_share_str -> share(GSON.toJson(getRssSource())) R.id.menu_share_str -> share(GSON.toJson(getRssSource()))
R.id.menu_share_qr -> shareWithQr( R.id.menu_share_qr -> shareWithQr(

@ -114,7 +114,7 @@ class RssSourceActivity : VMBaseActivity<ActivityRssSourceBinding, RssSourceView
allowExtensions = arrayOf("txt", "json") allowExtensions = arrayOf("txt", "json")
} }
R.id.menu_import_onLine -> showImportDialog() R.id.menu_import_onLine -> showImportDialog()
R.id.menu_import_qr -> qrCodeResult.launch(null) R.id.menu_import_qr -> qrCodeResult.launch()
R.id.menu_group_manage -> showDialogFragment<GroupManageDialog>() R.id.menu_group_manage -> showDialogFragment<GroupManageDialog>()
R.id.menu_import_default -> viewModel.importDefault() R.id.menu_import_default -> viewModel.importDefault()
R.id.menu_help -> showHelp() R.id.menu_help -> showHelp()

Loading…
Cancel
Save