diff --git a/app/src/main/assets/updateLog.md b/app/src/main/assets/updateLog.md index 94535e6d4..a669fb6a6 100644 --- a/app/src/main/assets/updateLog.md +++ b/app/src/main/assets/updateLog.md @@ -4,13 +4,17 @@ * 先在旧版阅读(2.x)中进行备份,然后在新版阅读(3.x)【我的】->【备份与恢复】,选择【导入旧版本数据】,提示存储权限,选择允许即可导入成功。 * 注意:由于安卓10更改了权限策略,还需要给「允许安装其他应用」的权限才能导入源。 +**2019/12/12** +* [fix]web服务停止问题 +* 默认显示沉浸式状态栏 + **2019/12/09** * [add]其他设置->清理缓存 * [mod]调整深色模式配色,预适配Android10 * [mod]启用web服务 **2019/12/03** -* from Celeter1、调试log修改 2、增加书源字符串分享(RSS未包含) 3、增加导出选中的源(包含书源、RSS、替换规则) +* [by Celeter]1、调试log修改 2、增加书源字符串分享(RSS未包含) 3、增加导出选中的源(包含书源、RSS、替换规则) * 一键缓存 * 修复bug @@ -20,4 +24,4 @@ * 音频添加速度调整 * 后台朗读,长按返回,或点击按钮 * 订阅可以隐藏 -* 优化老版本规则导入from Celeter \ No newline at end of file +* [by Celeter]优化老版本规则导入 \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/constant/Bus.kt b/app/src/main/java/io/legado/app/constant/Bus.kt index 517bafc93..395d51ec4 100644 --- a/app/src/main/java/io/legado/app/constant/Bus.kt +++ b/app/src/main/java/io/legado/app/constant/Bus.kt @@ -17,4 +17,5 @@ object Bus { const val AUDIO_PROGRESS = "audioProgress" const val AUDIO_SIZE = "audioSize" const val AUDIO_SPEED = "audioSpeed" + const val SHOW_RSS = "showRss" } \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/ui/book/read/config/ReadStyleDialog.kt b/app/src/main/java/io/legado/app/ui/book/read/config/ReadStyleDialog.kt index 822ca033c..a816677f0 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/config/ReadStyleDialog.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/config/ReadStyleDialog.kt @@ -182,7 +182,7 @@ class ReadStyleDialog : DialogFragment() { requireContext().putPrefInt("pageAnim", i) val activity = activity if (activity is ReadBookActivity) { - activity.page_view.upPageAnim() + activity.page_view.upPageAnim(i) } break } diff --git a/app/src/main/java/io/legado/app/ui/config/ConfigFragment.kt b/app/src/main/java/io/legado/app/ui/config/ConfigFragment.kt index 927804039..0410b34a6 100644 --- a/app/src/main/java/io/legado/app/ui/config/ConfigFragment.kt +++ b/app/src/main/java/io/legado/app/ui/config/ConfigFragment.kt @@ -10,6 +10,7 @@ import androidx.preference.Preference import androidx.preference.PreferenceFragmentCompat import io.legado.app.App import io.legado.app.R +import io.legado.app.constant.Bus import io.legado.app.constant.PreferKey import io.legado.app.help.BookHelp import io.legado.app.help.FileHelp @@ -65,7 +66,7 @@ class ConfigFragment : PreferenceFragmentCompat(), FileHelp.deleteFile(it) FileHelp.getFolder(it) } - toast("成功清理缓存") + toast(R.string.clear_cache_success) } } return super.onPreferenceTreeClick(preference) @@ -81,7 +82,7 @@ class ConfigFragment : PreferenceFragmentCompat(), PreferKey.processText -> sharedPreferences?.let { setProcessTextEnable(it.getBoolean("process_text", true)) } - PreferKey.showRss -> postEvent(PreferKey.showRss, PreferKey.showRss) + PreferKey.showRss -> postEvent(Bus.SHOW_RSS, "unused") } } 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 83f515a0c..1b5966efb 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 @@ -13,7 +13,6 @@ import io.legado.app.BuildConfig import io.legado.app.R import io.legado.app.base.VMBaseActivity import io.legado.app.constant.Bus -import io.legado.app.constant.PreferKey import io.legado.app.help.ActivityHelp import io.legado.app.help.storage.Backup import io.legado.app.lib.theme.ATH @@ -45,7 +44,7 @@ class MainActivity : VMBaseActivity(R.layout.activity_main), view_pager_main.adapter = TabFragmentPageAdapter(supportFragmentManager) view_pager_main.addOnPageChangeListener(this) bottom_navigation_view.setOnNavigationItemSelectedListener(this) - bottom_navigation_view.menu.findItem(R.id.menu_rss).isVisible = showRss() + bottom_navigation_view.menu.findItem(R.id.menu_rss).isVisible = isShowRSS upVersion() } @@ -66,10 +65,10 @@ class MainActivity : VMBaseActivity(R.layout.activity_main), fragmentList.add(RssFragment()) fragmentList.add(MyFragment()) } - if (showRss() && fragmentList.size < 4) { + if (isShowRSS && fragmentList.size < 4) { fragmentList.add(2, RssFragment()) } - if (!showRss() && fragmentList.size == 4) { + if (!isShowRSS && fragmentList.size == 4) { fragmentList.removeAt(2) } } @@ -87,7 +86,7 @@ class MainActivity : VMBaseActivity(R.layout.activity_main), pagePosition = position when (position) { 0, 1, 3 -> bottom_navigation_view.menu.getItem(position).isChecked = true - 2 -> if (showRss()) { + 2 -> if (isShowRSS) { bottom_navigation_view.menu.getItem(position).isChecked = true } else { bottom_navigation_view.menu.getItem(3).isChecked = true @@ -133,20 +132,16 @@ class MainActivity : VMBaseActivity(R.layout.activity_main), observeEvent(Bus.RECREATE) { recreate() } - observeEvent(PreferKey.showRss) { - bottom_navigation_view.menu.findItem(R.id.menu_rss).isVisible = showRss() + observeEvent(Bus.SHOW_RSS) { + bottom_navigation_view.menu.findItem(R.id.menu_rss).isVisible = isShowRSS upFragmentList() view_pager_main.adapter?.notifyDataSetChanged() - if (showRss()) { + if (isShowRSS) { view_pager_main.setCurrentItem(3, false) } } } - private fun showRss(): Boolean { - return getPrefBoolean("showRss", true) - } - private inner class TabFragmentPageAdapter internal constructor(fm: FragmentManager) : FragmentStatePagerAdapter(fm, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT) { @@ -159,7 +154,7 @@ class MainActivity : VMBaseActivity(R.layout.activity_main), } override fun getCount(): Int { - return if (showRss()) 4 else 3 + return if (isShowRSS) 4 else 3 } } diff --git a/app/src/main/java/io/legado/app/ui/widget/page/PageView.kt b/app/src/main/java/io/legado/app/ui/widget/page/PageView.kt index 2a05969f7..ec4693ffb 100644 --- a/app/src/main/java/io/legado/app/ui/widget/page/PageView.kt +++ b/app/src/main/java/io/legado/app/ui/widget/page/PageView.kt @@ -11,7 +11,6 @@ import io.legado.app.service.help.ReadBook import io.legado.app.ui.widget.page.curl.CurlView import io.legado.app.ui.widget.page.delegate.* import io.legado.app.utils.activity -import io.legado.app.utils.getPrefInt class PageView(context: Context, attrs: AttributeSet) : FrameLayout(context, attrs), @@ -89,13 +88,13 @@ class PageView(context: Context, attrs: AttributeSet) : } } - fun upPageAnim() { + fun upPageAnim(pageAnim: Int = 0) { if (curlView != null) { removeView(curlView) curlView = null } pageDelegate = null - pageDelegate = when (context.getPrefInt("pageAnim")) { + pageDelegate = when (pageAnim) { 0 -> CoverPageDelegate(this) 1 -> SlidePageDelegate(this) 2 -> SimulationPageDelegate(this) diff --git a/app/src/main/java/io/legado/app/utils/ContextExtensions.kt b/app/src/main/java/io/legado/app/utils/ContextExtensions.kt index 9642814de..f47a0a2a8 100644 --- a/app/src/main/java/io/legado/app/utils/ContextExtensions.kt +++ b/app/src/main/java/io/legado/app/utils/ContextExtensions.kt @@ -64,4 +64,7 @@ val Context.isNightTheme: Boolean get() = getPrefBoolean("isNightTheme") val Context.isTransparentStatusBar: Boolean - get() = getPrefBoolean("transparentStatusBar") \ No newline at end of file + get() = getPrefBoolean("transparentStatusBar", true) + +val Context.isShowRSS: Boolean + get() = getPrefBoolean("showRss", true) \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 123967b0a..602c75ca4 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -160,6 +160,7 @@ 作者:%s 朗读停止 清除缓存 + 成功清理缓存 保存 编辑源 编辑书源 diff --git a/app/src/main/res/xml/pref_config_theme.xml b/app/src/main/res/xml/pref_config_theme.xml index e96124472..f9f3df963 100644 --- a/app/src/main/res/xml/pref_config_theme.xml +++ b/app/src/main/res/xml/pref_config_theme.xml @@ -4,9 +4,10 @@