Răsfoiți Sursa

fix: 标题次行缩放负值不生效

次行缩放是"副标题字号 = 主标题字号 × 系数"的比例值,负值无意义,
Paint.setTextSize 会直接忽略负值,表现为设置保存了但排版无变化。

- 滑块范围 -2..2 收窄为 0..2
- 读取时兜底,修正已存入设备/备份的负值(回落到默认 1)
- 删除无引用的 dialog_tip_config.xml(负值范围的来源)
5151561 3 luni în urmă
părinte
comite
9781509a1a

+ 2 - 1
app/src/main/java/io/legado/app/help/config/ReadBookConfig.kt

@@ -454,7 +454,8 @@ object ReadBookConfig {
         }
 
     var titleSegScaling: Float
-        get() = config.titleSegScaling
+        //旧版本可能存入负值,负值非法,回落到默认比例
+        get() = config.titleSegScaling.let { if (it < 0f) 1f else it.coerceAtMost(2f) }
         set(value) {
             config.titleSegScaling = value
         }

+ 2 - 2
app/src/main/java/io/legado/app/ui/book/read/sheet/TextTitleSheet.kt

@@ -554,8 +554,8 @@ internal fun TitleSettingsPage(
         TinySliderSettingItem(
             title = stringResource(R.string.subtitle_scale),
             value = titleSegScaling,
-            valueRange = -2f..2f,
-            steps = 39,
+            valueRange = 0f..2f,
+            steps = 19,
             stepSize = 0.1f,
             valueFormat = { "%.1f".format(it) },
             onValueChange = { value ->

+ 0 - 287
app/src/main/res/layout/dialog_tip_config.xml

@@ -1,287 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:app="http://schemas.android.com/apk/res-auto"
-    android:layout_width="match_parent"
-    android:layout_height="wrap_content">
-
-    <LinearLayout
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:orientation="vertical"
-        android:paddingHorizontal="16dp">
-
-        <LinearLayout
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:orientation="vertical"
-            android:gravity="center"
-            android:paddingBottom="8dp"
-            android:paddingHorizontal="16dp">
-
-            <com.google.android.material.bottomsheet.BottomSheetDragHandleView
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:paddingVertical="8dp"
-                android:minHeight="0dp"
-                android:layout_gravity="center_horizontal" />
-
-            <TextView
-                android:id="@+id/bottom_sheet_title"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_marginVertical="8dp"
-                android:text="@string/read_config"
-                android:textSize="18sp"
-                android:textStyle="bold" />
-
-        </LinearLayout>
-
-        <LinearLayout
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:gravity="center_vertical"
-            android:orientation="horizontal">
-
-            <TextView
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:text="@string/body_title"
-                android:textSize="16sp"
-                android:textStyle="bold" />
-
-            <View
-                android:layout_width="0dp"
-                android:layout_height="match_parent"
-                android:layout_weight="1" />
-
-            <com.google.android.material.chip.ChipGroup
-                android:id="@+id/rg_title_mode"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_marginVertical="8dp"
-                app:selectionRequired="true"
-                app:singleLine="true"
-                app:singleSelection="true">
-
-                <com.google.android.material.chip.Chip
-                    android:id="@+id/rb_title_mode1"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:checkable="true"
-                    android:text="@string/title_left" />
-
-                <com.google.android.material.chip.Chip
-                    android:id="@+id/rb_title_mode2"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:checkable="true"
-                    android:text="@string/title_center" />
-
-                <com.google.android.material.chip.Chip
-                    android:id="@+id/rb_title_mode3"
-                    android:layout_width="wrap_content"
-                    android:layout_height="wrap_content"
-                    android:checkable="true"
-                    android:text="@string/title_hide" />
-
-            </com.google.android.material.chip.ChipGroup>
-
-        </LinearLayout>
-
-
-        <com.google.android.material.button.MaterialButtonGroup
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:gravity="end">
-
-            <com.google.android.material.button.MaterialButton
-                android:id="@+id/btnSelectTitleFont"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                app:icon="@drawable/ic_title_font"
-                android:text="@string/text_font"
-                android:minWidth="0dp"
-                style="@style/Widget.Material3Expressive.Button.TonalButton"/>
-
-            <com.google.android.material.button.MaterialButton
-                android:id="@+id/textFontWeightConverter"
-                style="@style/Widget.Material3Expressive.Button.TonalButton"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:text="@string/title_font_size"
-                android:minWidth="0dp" />
-
-            <io.legado.app.ui.widget.AccentColorButton
-                android:id="@+id/abtnTitleColor"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                style="@style/Widget.Material3Expressive.Button.TonalButton"
-                android:text="@string/title_color" />
-
-        </com.google.android.material.button.MaterialButtonGroup>
-
-        <com.google.android.material.button.MaterialButtonGroup
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:gravity="end">
-
-            <com.google.android.material.button.MaterialButton
-                android:id="@+id/btn_title_segType"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:text="@string/split_title"
-                style="@style/Widget.Material3Expressive.Button.TonalButton"/>
-
-            <com.google.android.material.button.MaterialButton
-                android:id="@+id/btn_title_seg_config"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:text="@string/split_title_mode"
-                style="@style/Widget.Material3Expressive.Button.TonalButton"/>
-
-        </com.google.android.material.button.MaterialButtonGroup>
-
-        <LinearLayout
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content">
-
-            <io.legado.app.ui.widget.SimpleCounterView
-                android:id="@+id/dsb_title_seg_scaling"
-                android:layout_width="108dp"
-                android:layout_height="wrap_content"
-                app:max="20"
-                app:min="-20"
-                app:title="@string/subtitle_scale" />
-
-            <View
-                android:layout_width="0dp"
-                android:layout_height="match_parent"
-                android:layout_weight="1"/>
-
-            <io.legado.app.ui.widget.SimpleCounterView
-                android:id="@+id/dsb_title_size"
-                android:layout_width="108dp"
-                android:layout_height="wrap_content"
-                app:max="20"
-                app:title="@string/title_font_size" />
-
-        </LinearLayout>
-
-
-        <LinearLayout
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content">
-
-            <io.legado.app.ui.widget.SimpleCounterView
-                android:id="@+id/dsb_title_line_spacing_sub"
-                android:layout_width="108dp"
-                android:layout_height="wrap_content"
-                app:max="30"
-                app:min="-30"
-                app:title="@string/subtitle_margin" />
-
-            <View
-                android:layout_width="0dp"
-                android:layout_height="match_parent"
-                android:layout_weight="1" />
-
-            <io.legado.app.ui.widget.SimpleCounterView
-                android:id="@+id/dsb_title_line_spacing_extra"
-                android:layout_width="108dp"
-                android:layout_height="wrap_content"
-                app:max="20"
-                app:title="@string/heading_spacing" />
-
-        </LinearLayout>
-
-        <LinearLayout
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:orientation="horizontal">
-
-            <io.legado.app.ui.widget.SimpleCounterView
-                android:id="@+id/dsb_title_top"
-                android:layout_width="120dp"
-                android:layout_height="wrap_content"
-                app:max="200"
-                app:title="@string/title_margin_top" />
-
-            <View
-                android:layout_width="0dp"
-                android:layout_height="match_parent"
-                android:layout_weight="1"/>
-
-            <io.legado.app.ui.widget.SimpleCounterView
-                android:id="@+id/dsb_title_bottom"
-                android:layout_width="120dp"
-                android:layout_height="wrap_content"
-                app:max="200"
-                app:title="@string/title_margin_bottom" />
-
-        </LinearLayout>
-
-        <TextView
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:layout_marginTop="8dp"
-            android:text="@string/tool_bar_style"
-            android:textSize="16sp"
-            android:textStyle="bold"/>
-
-        <com.google.android.material.chip.ChipGroup
-            android:id="@+id/bottom_mode"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_gravity="end"
-            android:layout_marginVertical="8dp"
-            app:singleLine="true"
-            app:singleSelection="true"
-            app:selectionRequired="true">
-
-            <com.google.android.material.chip.Chip
-                android:id="@+id/bottom_mode1"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:checkable="true"
-                android:text="@string/flow_sys" />
-
-            <com.google.android.material.chip.Chip
-                android:id="@+id/bottom_mode2"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:checkable="true"
-                android:text="@string/follow_read_background" />
-
-            <com.google.android.material.chip.Chip
-                android:id="@+id/bottom_mode3"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:checkable="true"
-                android:text="@string/custom" />
-
-        </com.google.android.material.chip.ChipGroup>
-
-        <com.google.android.material.button.MaterialButtonGroup
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:gravity="end">
-
-            <io.legado.app.ui.widget.AccentColorButton
-                android:id="@+id/abtnBackgroundColor"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                style="@style/Widget.Material3Expressive.Button.OutlinedButton"
-                android:text="@string/background_color" />
-
-            <io.legado.app.ui.widget.AccentColorButton
-                android:id="@+id/abtnAccentColor"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                style="@style/Widget.Material3Expressive.Button.OutlinedButton"
-                android:text="@string/accent" />
-
-        </com.google.android.material.button.MaterialButtonGroup>
-
-    </LinearLayout>
-
-</androidx.core.widget.NestedScrollView>