From 5c42cc0c7760e7b95041d3f815832f2d928e935b Mon Sep 17 00:00:00 2001 From: gedoor Date: Sat, 27 Nov 2021 19:49:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/legado/app/ui/book/group/GroupEditDialog.kt | 2 +- .../app/ui/book/info/edit/BookInfoEditActivity.kt | 2 +- .../app/ui/book/read/config/BgTextConfigDialog.kt | 2 +- .../book/source/debug/BookSourceDebugActivity.kt | 3 ++- .../ui/book/source/edit/BookSourceEditActivity.kt | 2 +- .../ui/book/source/manage/BookSourceActivity.kt | 2 +- .../legado/app/ui/config/BackupConfigFragment.kt | 14 +++++++------- .../legado/app/ui/document/HandleFileActivity.kt | 3 ++- .../java/io/legado/app/ui/qrcode/QrCodeActivity.kt | 3 ++- .../legado/app/ui/replace/ReplaceRuleActivity.kt | 2 +- .../ui/rss/source/edit/RssSourceEditActivity.kt | 2 +- .../app/ui/rss/source/manage/RssSourceActivity.kt | 2 +- 12 files changed, 21 insertions(+), 18 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/book/group/GroupEditDialog.kt b/app/src/main/java/io/legado/app/ui/book/group/GroupEditDialog.kt index fad9e35f7..50df3f2a1 100644 --- a/app/src/main/java/io/legado/app/ui/book/group/GroupEditDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/group/GroupEditDialog.kt @@ -55,7 +55,7 @@ class GroupEditDialog() : BaseDialogFragment(R.layout.dialog_book_group_edit) { } binding.run { ivCover.onClick { - selectImage.launch(null) + selectImage.launch() } btnCancel.onClick { dismiss() diff --git a/app/src/main/java/io/legado/app/ui/book/info/edit/BookInfoEditActivity.kt b/app/src/main/java/io/legado/app/ui/book/info/edit/BookInfoEditActivity.kt index d813cae00..8f3725634 100644 --- a/app/src/main/java/io/legado/app/ui/book/info/edit/BookInfoEditActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/info/edit/BookInfoEditActivity.kt @@ -58,7 +58,7 @@ class BookInfoEditActivity : } } tvSelectCover.setOnClickListener { - selectCover.launch(null) + selectCover.launch() } tvRefreshCover.setOnClickListener { viewModel.book?.customCoverUrl = tieCoverUrl.text?.toString() diff --git a/app/src/main/java/io/legado/app/ui/book/read/config/BgTextConfigDialog.kt b/app/src/main/java/io/legado/app/ui/book/read/config/BgTextConfigDialog.kt index ba8d839d4..438839367 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/config/BgTextConfigDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/config/BgTextConfigDialog.kt @@ -117,7 +117,7 @@ class BgTextConfigDialog : BaseDialogFragment(R.layout.dialog_read_bg_text) { ivBg.setImageResource(R.drawable.ic_image) ivBg.setColorFilter(primaryTextColor) root.setOnClickListener { - selectBgImage.launch(null) + selectBgImage.launch() } } } diff --git a/app/src/main/java/io/legado/app/ui/book/source/debug/BookSourceDebugActivity.kt b/app/src/main/java/io/legado/app/ui/book/source/debug/BookSourceDebugActivity.kt index 83fc02049..dac04ed2d 100644 --- a/app/src/main/java/io/legado/app/ui/book/source/debug/BookSourceDebugActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/source/debug/BookSourceDebugActivity.kt @@ -14,6 +14,7 @@ import io.legado.app.lib.theme.accentColor import io.legado.app.lib.theme.primaryColor import io.legado.app.ui.qrcode.QrCodeResult 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.showDialogFragment import io.legado.app.utils.toastOnUi @@ -137,7 +138,7 @@ class BookSourceDebugActivity : VMBaseActivity qrCodeResult.launch(null) + R.id.menu_scan -> qrCodeResult.launch() R.id.menu_search_src -> showDialogFragment(TextDialog(viewModel.searchSrc)) R.id.menu_book_src -> showDialogFragment(TextDialog(viewModel.bookSrc)) R.id.menu_toc_src -> showDialogFragment(TextDialog(viewModel.tocSrc)) diff --git a/app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditActivity.kt b/app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditActivity.kt index e752d41ee..34f4cf915 100644 --- a/app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/source/edit/BookSourceEditActivity.kt @@ -112,7 +112,7 @@ class BookSourceEditActivity : } R.id.menu_copy_source -> sendToClip(GSON.toJson(getSource())) 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_qr -> shareWithQr( GSON.toJson(getSource()), diff --git a/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt b/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt index 4e0302ede..670b9d0f9 100644 --- a/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/source/manage/BookSourceActivity.kt @@ -120,7 +120,7 @@ class BookSourceActivity : VMBaseActivity startActivity() - R.id.menu_import_qr -> qrResult.launch(null) + R.id.menu_import_qr -> qrResult.launch() R.id.menu_group_manage -> showDialogFragment() R.id.menu_import_local -> importDoc.launch { mode = HandleFileContract.FILE diff --git a/app/src/main/java/io/legado/app/ui/config/BackupConfigFragment.kt b/app/src/main/java/io/legado/app/ui/config/BackupConfigFragment.kt index 7180fb0df..e1369a147 100644 --- a/app/src/main/java/io/legado/app/ui/config/BackupConfigFragment.kt +++ b/app/src/main/java/io/legado/app/ui/config/BackupConfigFragment.kt @@ -123,7 +123,7 @@ class BackupConfigFragment : BasePreferenceFragment(), upPreferenceSummary(PreferKey.webDavPassword, getPrefString(PreferKey.webDavPassword)) upPreferenceSummary(PreferKey.backupPath, getPrefString(PreferKey.backupPath)) findPreference("web_dav_restore") - ?.onLongClick = { restoreDir.launch(null) } + ?.onLongClick = { restoreDir.launch() } } override fun onViewCreated(view: View, savedInstanceState: Bundle?) { @@ -206,11 +206,11 @@ class BackupConfigFragment : BasePreferenceFragment(), override fun onPreferenceTreeClick(preference: Preference?): Boolean { when (preference?.key) { - PreferKey.backupPath -> selectBackupPath.launch(null) + PreferKey.backupPath -> selectBackupPath.launch() PreferKey.restoreIgnore -> restoreIgnore() "web_dav_backup" -> backup() "web_dav_restore" -> restore() - "import_old" -> restoreOld.launch(null) + "import_old" -> restoreOld.launch() } return super.onPreferenceTreeClick(preference) } @@ -234,7 +234,7 @@ class BackupConfigFragment : BasePreferenceFragment(), fun backup() { val backupPath = AppConfig.backupPath if (backupPath.isNullOrEmpty()) { - backupDir.launch(null) + backupDir.launch() } else { if (backupPath.isContentScheme()) { val uri = Uri.parse(backupPath) @@ -249,7 +249,7 @@ class BackupConfigFragment : BasePreferenceFragment(), appCtx.toastOnUi(getString(R.string.backup_fail, it.localizedMessage)) } } else { - backupDir.launch(null) + backupDir.launch() } } else { backupUsePermission(backupPath) @@ -301,13 +301,13 @@ class BackupConfigFragment : BasePreferenceFragment(), Restore.restore(requireContext(), backupPath) } } else { - restoreDir.launch(null) + restoreDir.launch() } } else { restoreUsePermission(backupPath) } } else { - restoreDir.launch(null) + restoreDir.launch() } } diff --git a/app/src/main/java/io/legado/app/ui/document/HandleFileActivity.kt b/app/src/main/java/io/legado/app/ui/document/HandleFileActivity.kt index dad9157b2..bbe22ccf4 100644 --- a/app/src/main/java/io/legado/app/ui/document/HandleFileActivity.kt +++ b/app/src/main/java/io/legado/app/ui/document/HandleFileActivity.kt @@ -18,6 +18,7 @@ import io.legado.app.lib.permission.Permissions import io.legado.app.lib.permission.PermissionsCompat import io.legado.app.utils.getJsonArray import io.legado.app.utils.isContentScheme +import io.legado.app.utils.launch import io.legado.app.utils.toastOnUi import io.legado.app.utils.viewbindingdelegate.viewBinding import java.io.File @@ -80,7 +81,7 @@ class HandleFileActivity : items(selectList) { _, item, _ -> when (item.value) { HandleFileContract.DIR -> kotlin.runCatching { - selectDocTree.launch(null) + selectDocTree.launch() }.onFailure { toastOnUi(R.string.open_sys_dir_picker_error) checkPermissions { diff --git a/app/src/main/java/io/legado/app/ui/qrcode/QrCodeActivity.kt b/app/src/main/java/io/legado/app/ui/qrcode/QrCodeActivity.kt index 920d318b9..7ca13dd4a 100644 --- a/app/src/main/java/io/legado/app/ui/qrcode/QrCodeActivity.kt +++ b/app/src/main/java/io/legado/app/ui/qrcode/QrCodeActivity.kt @@ -12,6 +12,7 @@ import io.legado.app.base.BaseActivity import io.legado.app.databinding.ActivityQrcodeCaptureBinding import io.legado.app.utils.QRCodeUtils import io.legado.app.utils.SelectImageContract +import io.legado.app.utils.launch import io.legado.app.utils.readBytes import io.legado.app.utils.viewbindingdelegate.viewBinding @@ -41,7 +42,7 @@ class QrCodeActivity : BaseActivity(), OnScanResul override fun onCompatOptionsItemSelected(item: MenuItem): Boolean { when (item.itemId) { - R.id.action_choose_from_gallery -> selectQrImage.launch(null) + R.id.action_choose_from_gallery -> selectQrImage.launch() } return super.onCompatOptionsItemSelected(item) } diff --git a/app/src/main/java/io/legado/app/ui/replace/ReplaceRuleActivity.kt b/app/src/main/java/io/legado/app/ui/replace/ReplaceRuleActivity.kt index a20dd184f..1b6e15354 100644 --- a/app/src/main/java/io/legado/app/ui/replace/ReplaceRuleActivity.kt +++ b/app/src/main/java/io/legado/app/ui/replace/ReplaceRuleActivity.kt @@ -224,7 +224,7 @@ class ReplaceRuleActivity : VMBaseActivity qrCodeResult.launch(null) + R.id.menu_import_qr -> qrCodeResult.launch() R.id.menu_help -> showHelp() else -> if (item.groupId == R.id.replace_group) { searchView.setQuery("group:${item.title}", true) diff --git a/app/src/main/java/io/legado/app/ui/rss/source/edit/RssSourceEditActivity.kt b/app/src/main/java/io/legado/app/ui/rss/source/edit/RssSourceEditActivity.kt index 5765b94d2..f6229d0c1 100644 --- a/app/src/main/java/io/legado/app/ui/rss/source/edit/RssSourceEditActivity.kt +++ b/app/src/main/java/io/legado/app/ui/rss/source/edit/RssSourceEditActivity.kt @@ -125,7 +125,7 @@ class RssSourceEditActivity : } } 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_share_str -> share(GSON.toJson(getRssSource())) R.id.menu_share_qr -> shareWithQr( diff --git a/app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceActivity.kt b/app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceActivity.kt index 59bc10134..fbd344838 100644 --- a/app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceActivity.kt +++ b/app/src/main/java/io/legado/app/ui/rss/source/manage/RssSourceActivity.kt @@ -114,7 +114,7 @@ class RssSourceActivity : VMBaseActivity showImportDialog() - R.id.menu_import_qr -> qrCodeResult.launch(null) + R.id.menu_import_qr -> qrCodeResult.launch() R.id.menu_group_manage -> showDialogFragment() R.id.menu_import_default -> viewModel.importDefault() R.id.menu_help -> showHelp()