feat: 更详细的横竖屏单双页设置

pull/2021/head
谢意帆 2 years ago
parent d9e640b86b
commit 8ae46da969
  1. 4
      app/src/main/java/io/legado/app/help/config/AppConfig.kt
  2. 10
      app/src/main/java/io/legado/app/ui/book/read/page/provider/ChapterProvider.kt
  3. 6
      app/src/main/res/values-zh/arrays.xml
  4. 6
      app/src/main/res/values/array_values.xml
  5. 6
      app/src/main/res/values/arrays.xml
  6. 9
      app/src/main/res/xml/pref_config_read.xml

@ -312,8 +312,8 @@ object AppConfig : SharedPreferences.OnSharedPreferenceChangeListener {
val loadCoverOnlyWifi = appCtx.getPrefBoolean(PreferKey.loadCoverOnlyWifi, false)
val doublePageHorizontal: Boolean
get() = appCtx.getPrefBoolean(PreferKey.doublePageHorizontal, true)
val doublePageHorizontal: String?
get() = appCtx.getPrefString(PreferKey.doublePageHorizontal)
var searchGroup: String
get() = appCtx.getPrefString("searchGroup") ?: ""

@ -612,9 +612,15 @@ object ChapterProvider {
* 更新绘制尺寸
*/
fun upLayout() {
doublePage = (viewWidth > viewHeight || appCtx.isPad)
when(AppConfig.doublePageHorizontal){
"0" -> doublePage = false
"1" -> doublePage = true
"2" -> {
doublePage = (viewWidth > viewHeight)
&& ReadBook.pageAnim() != 3
&& AppConfig.doublePageHorizontal
}
}
if (viewWidth > 0 && viewHeight > 0) {
paddingLeft = ReadBookConfig.paddingLeft.dpToPx()
paddingTop = ReadBookConfig.paddingTop.dpToPx()

@ -25,6 +25,12 @@
<item>E-Ink(墨水屏)</item>
</string-array>
<string-array name="double_page_title">
<item>全局单页</item>
<item>全局双页</item>
<item>横屏双页/竖屏单页</item>
</string-array>
<string-array name="NavBarColors">
<item>自动</item>
<item>黑色</item>

@ -33,6 +33,12 @@
<item>3</item>
</string-array>
<string-array name="double_page_value">
<item>0</item>
<item>1</item>
<item>2</item>
</string-array>
<string-array name="language_value">
<item>auto</item>
<item>zh</item>

@ -61,6 +61,12 @@
<item>@string/screen_sensor</item>
</string-array>
<string-array name="double_page_title">
<item>全局单页</item>
<item>全局双页</item>
<item>横屏双页 竖屏单页</item>
</string-array>
<string-array name="icon_names" tools:ignore="Typos">
<item>iconMain</item>
<item>icon1</item>

@ -41,13 +41,16 @@
app:iconSpaceReserved="false"
app:isBottomBackground="true" />
<io.legado.app.lib.prefs.SwitchPreference
android:defaultValue="true"
android:title="@string/double_page_horizontal"
<io.legado.app.lib.prefs.NameListPreference
android:key="doublePageHorizontal"
android:defaultValue="0"
android:title="@string/double_page_horizontal"
android:entries="@array/double_page_title"
android:entryValues="@array/double_page_value"
app:iconSpaceReserved="false"
app:isBottomBackground="true" />
<io.legado.app.lib.prefs.SwitchPreference
android:defaultValue="false"
android:title="@string/use_zh_layout"

Loading…
Cancel
Save