From 5d8df47bb46c5212275d166d650556dd37ba8046 Mon Sep 17 00:00:00 2001 From: kunfei Date: Sat, 14 Mar 2020 12:27:24 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/io/legado/app/ui/main/my/MyFragment.kt | 8 +++++--- .../io/legado/app/ui/widget/dialog/TextDialog.kt | 8 +++++++- app/src/main/res/menu/main_my.xml | 12 ------------ 3 files changed, 12 insertions(+), 16 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/main/my/MyFragment.kt b/app/src/main/java/io/legado/app/ui/main/my/MyFragment.kt index 7dcecaf11..f3087f5e7 100644 --- a/app/src/main/java/io/legado/app/ui/main/my/MyFragment.kt +++ b/app/src/main/java/io/legado/app/ui/main/my/MyFragment.kt @@ -24,6 +24,7 @@ import io.legado.app.ui.config.ConfigActivity import io.legado.app.ui.config.ConfigViewModel import io.legado.app.ui.filechooser.FileChooserDialog import io.legado.app.ui.replacerule.ReplaceRuleActivity +import io.legado.app.ui.widget.dialog.TextDialog import io.legado.app.ui.widget.prefs.NameListPreference import io.legado.app.ui.widget.prefs.PreferenceCategory import io.legado.app.ui.widget.prefs.SwitchPreference @@ -48,9 +49,10 @@ class MyFragment : BaseFragment(R.layout.fragment_my_config), FileChooserDialog. override fun onCompatOptionsItemSelected(item: MenuItem) { when (item.itemId) { - R.id.menu_help -> startActivity() - R.id.menu_backup -> BackupRestoreUi.backup(this) - R.id.menu_restore -> BackupRestoreUi.restore(this) + R.id.menu_help -> { + val text = String(requireContext().assets.open("help.md").readBytes()) + TextDialog.show(childFragmentManager, text, TextDialog.MD) + } } } diff --git a/app/src/main/java/io/legado/app/ui/widget/dialog/TextDialog.kt b/app/src/main/java/io/legado/app/ui/widget/dialog/TextDialog.kt index 648949abd..9c1c75d5e 100644 --- a/app/src/main/java/io/legado/app/ui/widget/dialog/TextDialog.kt +++ b/app/src/main/java/io/legado/app/ui/widget/dialog/TextDialog.kt @@ -77,10 +77,16 @@ class TextDialog : BaseDialogFragment() { time -= 1000 badge_view.setBadgeCount((time / 1000).toInt()) if (time <= 0) { - dialog?.setCancelable(true) + view.post { + dialog?.setCancelable(true) + } } } } + } else { + view.post { + dialog?.setCancelable(true) + } } } diff --git a/app/src/main/res/menu/main_my.xml b/app/src/main/res/menu/main_my.xml index db1161c28..74e555dff 100644 --- a/app/src/main/res/menu/main_my.xml +++ b/app/src/main/res/menu/main_my.xml @@ -10,16 +10,4 @@ app:showAsAction="always" tools:ignore="AlwaysShowAction" /> - - - -