From 8a894f9c55330d7fe2e8ab1871ccb4e1764c7f87 Mon Sep 17 00:00:00 2001 From: gedoor Date: Wed, 11 Nov 2020 11:17:10 +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 --- app/src/main/assets/help/readHelp.md | 1 - app/src/main/assets/help/readMenuHelp.md | 16 +++++++ .../java/io/legado/app/help/LocalConfig.kt | 42 +++++++++++++------ .../app/ui/book/read/ReadBookActivity.kt | 6 +++ .../app/ui/book/read/ReadBookBaseActivity.kt | 1 - .../io/legado/app/ui/book/read/ReadMenu.kt | 36 ++++++++-------- .../app/ui/config/BackupConfigFragment.kt | 1 - .../io/legado/app/ui/main/MainActivity.kt | 1 - app/src/main/res/menu/read_book.xml | 5 +++ 9 files changed, 76 insertions(+), 33 deletions(-) delete mode 100644 app/src/main/assets/help/readHelp.md create mode 100644 app/src/main/assets/help/readMenuHelp.md diff --git a/app/src/main/assets/help/readHelp.md b/app/src/main/assets/help/readHelp.md deleted file mode 100644 index 813afecb0..000000000 --- a/app/src/main/assets/help/readHelp.md +++ /dev/null @@ -1 +0,0 @@ -# 阅读界面帮助文档 \ No newline at end of file diff --git a/app/src/main/assets/help/readMenuHelp.md b/app/src/main/assets/help/readMenuHelp.md new file mode 100644 index 000000000..128a8504f --- /dev/null +++ b/app/src/main/assets/help/readMenuHelp.md @@ -0,0 +1,16 @@ +# 阅读界面帮助文档 + +1.阅读界面主菜单 +* 顶部操作 + * 章节名称:点击可编辑书源 + * 章节url:点击可打开浏览器浏览 + * 菜单:不同类型的书籍显示的菜单不同,详情查看菜单文字,长按菜单图标可显示文字 +* 中间左侧-亮度调节 + * 亮度调节的顶端有跟随系统亮度的开关,打开后亮度跟随系统,关闭后才可以调节亮度条 +* 底部操作 + * 4个圆形按钮依次为 全文搜索✧自动翻页✧替换净化✧切换夜间模式 + * 上一章✧下一章中间的进度条为页数进度,要快速跳转章节点击目录按钮进入目录快速跳转 + * 目录->目录和书签界面 + * 朗读->单击开始朗读,长按进入朗读设置界面 + * 界面->所有排版设置都在里面 + * 设置->其它一些设置,找不到的设置去这里看看,可滚动 diff --git a/app/src/main/java/io/legado/app/help/LocalConfig.kt b/app/src/main/java/io/legado/app/help/LocalConfig.kt index fcf42102b..e4e651c77 100644 --- a/app/src/main/java/io/legado/app/help/LocalConfig.kt +++ b/app/src/main/java/io/legado/app/help/LocalConfig.kt @@ -9,22 +9,40 @@ object LocalConfig { private val localConfig = App.INSTANCE.getSharedPreferences("local", Context.MODE_PRIVATE) - var isFirstOpenApp: Boolean - get() = localConfig.getBoolean("firstOpen", true) - set(value) { - localConfig.edit { putBoolean("firstOpen", value) } + val isFirstOpenApp: Boolean + get() { + val value = localConfig.getBoolean("firstOpen", true) + if (value) { + localConfig.edit { putBoolean("firstOpen", false) } + } + return value } - var isFirstRead: Boolean - get() = localConfig.getBoolean("firstRead", true) - set(value) { - localConfig.edit { putBoolean("firstRead", value) } + val isFirstRead: Boolean + get() { + val value = localConfig.getBoolean("firstRead", true) + if (value) { + localConfig.edit { putBoolean("firstRead", false) } + } + return value } - var isFirstOpenBackup: Boolean - get() = localConfig.getBoolean("firstBackup", true) - set(value) { - localConfig.edit { putBoolean("firstBackup", value) } + val isFirstOpenBackup: Boolean + get() { + val value = localConfig.getBoolean("firstBackup", true) + if (value) { + localConfig.edit { putBoolean("firstBackup", false) } + } + return value + } + + val isFirstReadMenuShow: Boolean + get() { + val value = localConfig.getBoolean("firstReadMenu", true) + if (value) { + localConfig.edit { putBoolean("firstReadMenu", false) } + } + return value } } \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt index 19166cd0e..ac3521038 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/ReadBookActivity.kt @@ -229,6 +229,7 @@ class ReadBookActivity : ReadBookBaseActivity(), ) } R.id.menu_set_charset -> showCharsetConfig() + R.id.menu_help -> showReadMenuHelp() } return super.onCompatOptionsItemSelected(item) } @@ -571,6 +572,11 @@ class ReadBookActivity : ReadBookBaseActivity(), } } + override fun showReadMenuHelp() { + val text = String(assets.open("help/readMenuHelp.md").readBytes()) + TextDialog.show(supportFragmentManager, text, TextDialog.MD) + } + /** * 显示朗读菜单 */ diff --git a/app/src/main/java/io/legado/app/ui/book/read/ReadBookBaseActivity.kt b/app/src/main/java/io/legado/app/ui/book/read/ReadBookBaseActivity.kt index 2b5f8c14a..702b8ce9e 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/ReadBookBaseActivity.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/ReadBookBaseActivity.kt @@ -63,7 +63,6 @@ abstract class ReadBookBaseActivity : initView() if (LocalConfig.isFirstRead) { showClickRegionalConfig() - LocalConfig.isFirstRead = false } } diff --git a/app/src/main/java/io/legado/app/ui/book/read/ReadMenu.kt b/app/src/main/java/io/legado/app/ui/book/read/ReadMenu.kt index d1480ac81..b349fe629 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/ReadMenu.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/ReadMenu.kt @@ -13,6 +13,7 @@ import io.legado.app.App import io.legado.app.R import io.legado.app.constant.PreferKey import io.legado.app.help.AppConfig +import io.legado.app.help.LocalConfig import io.legado.app.help.ReadBookConfig import io.legado.app.lib.theme.* import io.legado.app.service.help.ReadBook @@ -29,7 +30,7 @@ class ReadMenu @JvmOverloads constructor( attrs: AttributeSet? = null ) : FrameLayout(context, attrs) { var cnaShowMenu: Boolean = false - private val callBack: CallBack? get() = activity as? CallBack + private val callBack: CallBack get() = activity as CallBack private lateinit var menuTopIn: Animation private lateinit var menuTopOut: Animation private lateinit var menuBottomIn: Animation @@ -166,19 +167,19 @@ class ReadMenu @JvmOverloads constructor( //搜索 fabSearch.onClick { runMenuOut { - callBack?.openSearchActivity(null) + callBack.openSearchActivity(null) } } //自动翻页 fabAutoPage.onClick { runMenuOut { - callBack?.autoPage() + callBack.autoPage() } } //替换 - fabReplaceRule.onClick { callBack?.openReplaceRule() } + fabReplaceRule.onClick { callBack.openReplaceRule() } //夜间模式 fabNightTheme.onClick { @@ -195,31 +196,31 @@ class ReadMenu @JvmOverloads constructor( //目录 ll_catalog.onClick { runMenuOut { - callBack?.openChapterList() + callBack.openChapterList() } } //朗读 ll_read_aloud.onClick { runMenuOut { - callBack?.onClickReadAloud() + callBack.onClickReadAloud() } } ll_read_aloud.onLongClick { - runMenuOut { callBack?.showReadAloudDialog() } + runMenuOut { callBack.showReadAloudDialog() } true } //界面 ll_font.onClick { runMenuOut { - callBack?.showReadStyle() + callBack.showReadStyle() } } //设置 ll_setting.onClick { runMenuOut { - callBack?.showMoreSetting() + callBack.showMoreSetting() } } } @@ -230,19 +231,19 @@ class ReadMenu @JvmOverloads constructor( menuBottomIn = AnimationUtilsSupport.loadAnimation(context, R.anim.anim_readbook_bottom_in) menuTopIn.setAnimationListener(object : Animation.AnimationListener { override fun onAnimationStart(animation: Animation) { - callBack?.upSystemUiVisibility() + callBack.upSystemUiVisibility() ll_brightness.visible(showBrightnessView) } override fun onAnimationEnd(animation: Animation) { vw_menu_bg.onClick { runMenuOut() } + val hasNavigationBar = ReadBookConfig.hideNavigationBar + && SystemUtils.isNavigationBarExist(activity) vwNavigationBar.layoutParams = vwNavigationBar.layoutParams.apply { - height = - if (ReadBookConfig.hideNavigationBar - && SystemUtils.isNavigationBarExist(activity) - ) - context.navigationBarHeight - else 0 + height = if (hasNavigationBar) context.navigationBarHeight else 0 + } + if (LocalConfig.isFirstReadMenuShow) { + callBack.showReadMenuHelp() } } @@ -264,7 +265,7 @@ class ReadMenu @JvmOverloads constructor( bottom_menu.invisible() cnaShowMenu = false onMenuOutEnd?.invoke() - callBack?.upSystemUiVisibility() + callBack.upSystemUiVisibility() } override fun onAnimationRepeat(animation: Animation) = Unit @@ -292,6 +293,7 @@ class ReadMenu @JvmOverloads constructor( fun showReadAloudDialog() fun upSystemUiVisibility() fun onClickReadAloud() + fun showReadMenuHelp() } } 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 f3152049e..9f93c5347 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 @@ -63,7 +63,6 @@ class BackupConfigFragment : BasePreferenceFragment(), setHasOptionsMenu(true) if (LocalConfig.isFirstOpenBackup) { showHelp() - LocalConfig.isFirstOpenBackup = false } } diff --git a/app/src/main/java/io/legado/app/ui/main/MainActivity.kt b/app/src/main/java/io/legado/app/ui/main/MainActivity.kt index 2dea83f1c..66970d7cc 100644 --- a/app/src/main/java/io/legado/app/ui/main/MainActivity.kt +++ b/app/src/main/java/io/legado/app/ui/main/MainActivity.kt @@ -106,7 +106,6 @@ class MainActivity : VMBaseActivity(R.layout.activity_main), if (LocalConfig.isFirstOpenApp) { val text = String(assets.open("help/appHelp.md").readBytes()) TextDialog.show(supportFragmentManager, text, TextDialog.MD) - LocalConfig.isFirstOpenApp = false } else if (!BuildConfig.DEBUG) { val log = String(assets.open("updateLog.md").readBytes()) TextDialog.show(supportFragmentManager, log, TextDialog.MD, 5000, true) diff --git a/app/src/main/res/menu/read_book.xml b/app/src/main/res/menu/read_book.xml index 98cbc1b5e..eb9aedd34 100644 --- a/app/src/main/res/menu/read_book.xml +++ b/app/src/main/res/menu/read_book.xml @@ -96,4 +96,9 @@ android:title="@string/book_info" app:showAsAction="never" /> + +