Merge pull request #57 from ca1e/master

commit 补充修改状态栏
pull/58/head
kunfei 5 years ago committed by GitHub
commit f34c6a1301
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      app/src/main/assets/updateLog.md
  2. 1
      app/src/main/java/io/legado/app/constant/Bus.kt
  3. 2
      app/src/main/java/io/legado/app/ui/book/read/config/ReadStyleDialog.kt
  4. 5
      app/src/main/java/io/legado/app/ui/config/ConfigFragment.kt
  5. 21
      app/src/main/java/io/legado/app/ui/main/MainActivity.kt
  6. 5
      app/src/main/java/io/legado/app/ui/widget/page/PageView.kt
  7. 5
      app/src/main/java/io/legado/app/utils/ContextExtensions.kt
  8. 1
      app/src/main/res/values/strings.xml
  9. 5
      app/src/main/res/xml/pref_config_theme.xml

@ -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
* [by Celeter]优化老版本规则导入

@ -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"
}

@ -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
}

@ -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")
}
}

@ -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<MainViewModel>(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<MainViewModel>(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<MainViewModel>(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<MainViewModel>(R.layout.activity_main),
observeEvent<String>(Bus.RECREATE) {
recreate()
}
observeEvent<String>(PreferKey.showRss) {
bottom_navigation_view.menu.findItem(R.id.menu_rss).isVisible = showRss()
observeEvent<String>(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<MainViewModel>(R.layout.activity_main),
}
override fun getCount(): Int {
return if (showRss()) 4 else 3
return if (isShowRSS) 4 else 3
}
}

@ -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)

@ -64,4 +64,7 @@ val Context.isNightTheme: Boolean
get() = getPrefBoolean("isNightTheme")
val Context.isTransparentStatusBar: Boolean
get() = getPrefBoolean("transparentStatusBar")
get() = getPrefBoolean("transparentStatusBar", true)
val Context.isShowRSS: Boolean
get() = getPrefBoolean("showRss", true)

@ -160,6 +160,7 @@
<string name="author_show">作者:%s</string>
<string name="aloud_stop">朗读停止</string>
<string name="clear_cache">清除缓存</string>
<string name="clear_cache_success">成功清理缓存</string>
<string name="action_save">保存</string>
<string name="edit_source">编辑源</string>
<string name="edit_book_source">编辑书源</string>

@ -4,9 +4,10 @@
<io.legado.app.lib.theme.prefs.ATESwitchPreference
android:defaultValue="false"
android:defaultValue="true"
android:key="transparentStatusBar"
android:title="@string/status_bar_immersion"
android:summary="@string/status_bar_immersion"
android:title="@string/immersion_status_bar"
app:iconSpaceReserved="false" />
<io.legado.app.lib.theme.prefs.ATESwitchPreference

Loading…
Cancel
Save