HapeLee 1 год назад
Родитель
Сommit
ad1e83b959

+ 4 - 4
app/src/main/java/io/legato/kazusa/ui/book/read/MangaMenu.kt

@@ -210,9 +210,10 @@ class MangaMenu @JvmOverloads constructor(
 
         seekReadPage.addOnChangeListener { slider, value, fromUser ->
             if (fromUser) {
-                callBack.skipToPage(value.toInt())
+                callBack.skipToPage(value.toInt() - 1)
             }
         }
+
         seekReadPage.addOnSliderTouchListener(object : Slider.OnSliderTouchListener {
             override fun onStartTrackingTouch(slider: Slider) {
                 vwMenuBg.setOnClickListener(null)
@@ -223,13 +224,12 @@ class MangaMenu @JvmOverloads constructor(
             }
         })
 
-
     }
 
     fun upSeekBar(value: Int, count: Int) {
         binding.seekReadPage.apply {
-            valueFrom = 0f
-            valueTo = (count - 1).toFloat()
+            valueFrom = 1f
+            valueTo = (count).toFloat()
             this.value = value.toFloat()
             stepSize = 1f
         }

+ 25 - 19
app/src/main/java/io/legato/kazusa/ui/book/read/ReadMenu.kt

@@ -211,7 +211,7 @@ class ReadMenu @JvmOverloads constructor(
 //        vwBrightnessPosAdjust.setColorFilter(textColor, PorterDuff.Mode.SRC_IN)
         llBrightness.setOnClickListener(null)
         seekBrightness.post {
-            seekBrightness.progress = AppConfig.readBrightness
+            seekBrightness.value = AppConfig.readBrightness.toFloat()
         }
         if (AppConfig.showReadTitleBarAddition) {
             titleBarAddition.visible()
@@ -378,19 +378,22 @@ class ReadMenu @JvmOverloads constructor(
             upBrightnessState()
         }
         //亮度调节
-        seekBrightness.setOnSeekBarChangeListener(object : SeekBarChangeListener {
-
-            override fun onProgressChanged(seekBar: SeekBar, progress: Int, fromUser: Boolean) {
-                if (fromUser) {
-                    setScreenBrightness(progress.toFloat())
-                }
+        seekBrightness.addOnChangeListener { slider, value, fromUser ->
+            if (fromUser) {
+                setScreenBrightness(value)
             }
+        }
+
+        seekBrightness.addOnSliderTouchListener(object : Slider.OnSliderTouchListener {
+            override fun onStartTrackingTouch(slider: Slider) {
 
-            override fun onStopTrackingTouch(seekBar: SeekBar) {
-                AppConfig.readBrightness = seekBar.progress
             }
 
+            override fun onStopTrackingTouch(slider: Slider) {
+                AppConfig.readBrightness = slider.value.toInt()
+            }
         })
+
         vwBrightnessPosAdjust.setOnClickListener {
             AppConfig.brightnessVwPos = !AppConfig.brightnessVwPos
             upBrightnessVwPos()
@@ -524,26 +527,29 @@ class ReadMenu @JvmOverloads constructor(
                     ReadBook.curTextChapter?.let { chapter ->
                         if (chapter.pageSize > 0) {
                             valueFrom = 1f
-                            valueTo = chapter.pageSize.toFloat()
+                            valueTo = chapter.pageSize.toFloat().coerceAtLeast(2f)
                             value = (ReadBook.durPageIndex).coerceIn(1, chapter.pageSize).toFloat()
                             stepSize = 1f
                         } else {
                             valueFrom = 1f
-                            valueTo = 1f
+                            valueTo = 2f
                             value = 1f
                         }
-                    } ?: run {
-                        valueFrom = 1f
-                        valueTo = 1f
-                        value = 1f
                     }
                 }
 
                 "chapter" -> {
-                    valueFrom = 1f
-                    valueTo = ReadBook.simulatedChapterSize.toFloat()
-                    value = (ReadBook.durChapterIndex).coerceIn(1, ReadBook.simulatedChapterSize).toFloat()
-                    stepSize = 1f
+                    if (ReadBook.simulatedChapterSize > 0)
+                    {
+                        valueFrom = 1f
+                        valueTo = ReadBook.simulatedChapterSize.toFloat().coerceAtLeast(2f)
+                        value = (ReadBook.durChapterIndex).coerceIn(1, ReadBook.simulatedChapterSize).toFloat()
+                        stepSize = 1f
+                    } else {
+                        valueFrom = 1f
+                        valueTo = 2f
+                        value = 1f
+                    }
                 }
             }
         }

+ 5 - 5
app/src/main/java/io/legato/kazusa/ui/book/read/config/AutoReadDialog.kt

@@ -93,20 +93,20 @@ class AutoReadDialog : BaseBottomSheetDialogFragment(R.layout.dialog_auto_read)
     }
 
     private fun initEvent() {
-        binding.llMainMenu.setOnClickListener {
+        binding.btnMainMenu.setOnClickListener {
             callBack?.showMenuBar()
             dismissAllowingStateLoss()
         }
-        binding.llSetting.setOnClickListener {
+        binding.btnSetting.setOnClickListener {
             (activity as BaseReadBookActivity).showPageAnimConfig {
                 (activity as ReadBookActivity).upPageAnim()
                 ReadBook.loadContent(false)
             }
         }
-        binding.llCatalog.setOnClickListener { callBack?.openChapterList() }
-        binding.llAutoPageStop.setOnClickListener {
+        binding.btnCatalog.setOnClickListener { callBack?.openChapterList() }
+        binding.btnAutoPageStop.setOnClickListener {
             callBack?.autoPageStop()
-            binding.llAutoPageStop.post {
+            binding.btnAutoPageStop.post {
                 dismissAllowingStateLoss()
             }
         }

+ 64 - 162
app/src/main/res/layout/dialog_auto_read.xml

@@ -4,10 +4,7 @@
     xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
-    android:paddingLeft="16dp"
-    android:paddingRight="16dp"
-    android:paddingTop="6dp"
-    android:paddingBottom="6dp"
+    android:padding="16dp"
     android:orientation="vertical">
 
     <LinearLayout
@@ -19,33 +16,31 @@
             android:id="@+id/ll_tts_SpeechRate"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:layout_gravity="center_vertical"
-            android:orientation="horizontal"
-            android:padding="8dp">
+            android:gravity="center_horizontal"
+            android:orientation="horizontal">
 
             <TextView
                 android:id="@+id/tv_read_speed_title"
-                android:layout_width="0dp"
+                android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
-                android:layout_gravity="center"
-                android:layout_weight="1"
-                android:text="@string/auto_page_speed"
-                android:textColor="@color/primaryText"
-                android:textSize="14sp" />
+                style="@style/ChapterNameText"
+                android:text="@string/auto_page_speed" />
 
             <TextView
                 android:id="@+id/tv_read_speed"
                 android:layout_width="wrap_content"
-                android:layout_height="wrap_content" />
+                android:layout_height="wrap_content"
+                android:layout_marginStart="8dp"
+                android:textSize="16sp"/>
 
         </LinearLayout>
 
-        <io.legato.kazusa.lib.theme.view.ThemeSlider
+        <com.google.android.material.slider.Slider
             android:id="@+id/seek_auto_read"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:valueFrom="1.0"
-            android:valueTo="10.0"
+            android:valueTo="60.0"
             android:stepSize="1.0"
             tools:ignore="UnusedAttribute" />
 
@@ -53,158 +48,65 @@
 
     <LinearLayout
         android:layout_width="match_parent"
-        android:layout_height="50dp"
+        android:layout_height="wrap_content"
         android:layout_marginTop="8dp"
-        android:baselineAligned="false"
         android:orientation="horizontal">
 
-        <!--目录按钮-->
-        <LinearLayout
-            android:id="@+id/ll_catalog"
-            android:layout_width="50dp"
-            android:layout_height="50dp"
-            android:background="?android:attr/selectableItemBackgroundBorderless"
-            android:clickable="true"
-            android:contentDescription="@string/chapter_list"
-            android:focusable="true"
-            android:orientation="vertical"
-            android:paddingBottom="7dp">
-
-            <androidx.appcompat.widget.AppCompatImageView
-                android:id="@+id/iv_catalog"
-                android:layout_width="match_parent"
-                android:layout_height="0dp"
-                android:layout_weight="1"
-                android:contentDescription="@string/chapter_list"
-                android:src="@drawable/ic_toc"
-                app:tint="@color/primaryText"
-                tools:ignore="NestedWeights" />
-
-            <TextView
-                android:id="@+id/tv_catalog"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_gravity="center_horizontal"
-                android:layout_marginTop="3dp"
-                android:text="@string/chapter_list"
-                android:maxLines="1"
-                android:textColor="@color/primaryText"
-                android:textSize="12sp" />
-        </LinearLayout>
-
-        <View
+        <com.google.android.material.button.MaterialButton
+            android:id="@+id/btn_catalog"
+            style="@style/Widget.Material3.Button.IconButton.Filled.Tonal"
             android:layout_width="0dp"
-            android:layout_height="match_parent"
-            android:layout_weight="2" />
-        <!--调节按钮-->
-        <LinearLayout
-            android:id="@+id/ll_main_menu"
-            android:layout_width="50dp"
-            android:layout_height="50dp"
-            android:background="?android:attr/selectableItemBackgroundBorderless"
-            android:clickable="true"
-            android:contentDescription="@string/read_aloud"
-            android:focusable="true"
-            android:orientation="vertical"
-            android:paddingBottom="7dp">
-
-            <androidx.appcompat.widget.AppCompatImageView
-                android:id="@+id/iv_main_menu"
-                android:layout_width="match_parent"
-                android:layout_height="0dp"
-                android:layout_weight="1"
-                android:contentDescription="@string/main_menu"
-                android:src="@drawable/ic_menu"
-                app:tint="@color/primaryText"
-                tools:ignore="NestedWeights" />
-
-            <TextView
-                android:id="@+id/tv_main_menu"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_gravity="center_horizontal"
-                android:layout_marginTop="3dp"
-                android:text="@string/main_menu"
-                android:maxLines="1"
-                android:textColor="@color/primaryText"
-                android:textSize="12sp" />
-        </LinearLayout>
-
-        <View
+            android:layout_height="wrap_content"
+            android:layout_weight="1"
+            android:icon="@drawable/ic_toc"
+            android:text="@string/chapter_list"
+            android:textSize="12sp"
+            android:padding="0dp"
+            app:iconGravity="textTop"
+            app:iconPadding="4dp"
+            />
+
+        <com.google.android.material.button.MaterialButton
+            android:id="@+id/btn_main_menu"
+            style="@style/Widget.Material3.Button.IconButton.Filled.Tonal"
             android:layout_width="0dp"
-            android:layout_height="match_parent"
-            android:layout_weight="2" />
-        <!--界面按钮-->
-        <LinearLayout
-            android:id="@+id/ll_auto_page_stop"
-            android:layout_width="50dp"
-            android:layout_height="50dp"
-            android:background="?android:attr/selectableItemBackgroundBorderless"
-            android:clickable="true"
-            android:contentDescription="@string/stop"
-            android:focusable="true"
-            android:orientation="vertical"
-            android:paddingBottom="7dp">
-
-            <androidx.appcompat.widget.AppCompatImageView
-                android:id="@+id/iv_auto_page_stop"
-                android:layout_width="match_parent"
-                android:layout_height="0dp"
-                android:layout_weight="1"
-                android:contentDescription="@string/stop"
-                android:src="@drawable/ic_auto_page_stop"
-                app:tint="@color/primaryText"
-                tools:ignore="NestedWeights" />
-
-            <TextView
-                android:id="@+id/tv_auto_page_stop"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_gravity="center_horizontal"
-                android:layout_marginTop="3dp"
-                android:text="@string/stop"
-                android:maxLines="1"
-                android:textColor="@color/primaryText"
-                android:textSize="12sp" />
-        </LinearLayout>
-
-        <View
+            android:layout_height="wrap_content"
+            android:layout_weight="1"
+            android:icon="@drawable/ic_menu"
+            android:text="@string/main_menu"
+            android:textSize="12sp"
+            android:padding="0dp"
+            app:iconGravity="textTop"
+            app:iconPadding="4dp"
+            />
+
+        <com.google.android.material.button.MaterialButton
+            android:id="@+id/btn_auto_page_stop"
+            style="@style/Widget.Material3.Button.IconButton.Filled.Tonal"
             android:layout_width="0dp"
-            android:layout_height="match_parent"
-            android:layout_weight="2" />
-        <!--设置按钮-->
-        <LinearLayout
-            android:id="@+id/ll_setting"
-            android:layout_width="50dp"
-            android:layout_height="50dp"
-            android:background="?android:attr/selectableItemBackgroundBorderless"
-            android:clickable="true"
-            android:contentDescription="@string/setting"
-            android:focusable="true"
-            android:orientation="vertical"
-            android:paddingBottom="7dp">
-
-            <androidx.appcompat.widget.AppCompatImageView
-                android:id="@+id/iv_setting"
-                android:layout_width="match_parent"
-                android:layout_height="0dp"
-                android:layout_weight="1"
-                android:contentDescription="@string/aloud_config"
-                android:src="@drawable/ic_settings"
-                app:tint="@color/primaryText"
-                tools:ignore="NestedWeights" />
-
-            <TextView
-                android:id="@+id/tv_setting"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_gravity="center_horizontal"
-                android:layout_marginTop="3dp"
-                android:text="@string/setting"
-                android:maxLines="1"
-                android:textColor="@color/primaryText"
-                android:textSize="12sp" />
-        </LinearLayout>
+            android:layout_height="wrap_content"
+            android:layout_weight="1"
+            android:icon="@drawable/ic_auto_page_stop"
+            android:text="@string/stop"
+            android:textSize="12sp"
+            android:padding="0dp"
+            app:iconGravity="textTop"
+            app:iconPadding="4dp"
+            />
+
+        <com.google.android.material.button.MaterialButton
+            android:id="@+id/btn_setting"
+            style="@style/Widget.Material3.Button.IconButton.Filled.Tonal"
+            android:layout_width="0dp"
+            android:layout_height="wrap_content"
+            android:layout_weight="1"
+            android:icon="@drawable/ic_settings"
+            android:text="@string/setting"
+            android:textSize="12sp"
+            android:padding="0dp"
+            app:iconGravity="textTop"
+            app:iconPadding="4dp"
+            />
 
     </LinearLayout>
 

+ 7 - 19
app/src/main/res/layout/view_manga_menu.xml

@@ -91,39 +91,27 @@
             android:importantForAccessibility="no"
             android:orientation="horizontal">
 
-            <TextView
+            <com.google.android.material.button.MaterialButton
                 android:id="@+id/tv_pre"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
-                android:layout_marginStart="10dp"
-                android:layout_marginEnd="10dp"
-                android:background="?android:attr/selectableItemBackgroundBorderless"
-                android:paddingTop="10dp"
-                android:paddingBottom="10dp"
-                android:text="@string/previous_chapter"
-                android:textColor="@color/primaryText"
-                android:textSize="14sp"
+                style="@style/Widget.Material3.Button.IconButton.Filled.Tonal"
+                app:icon="@drawable/ic_previous"
                 tools:ignore="TouchTargetSizeCheck" />
 
-            <io.legato.kazusa.lib.theme.view.ThemeSlider
+            <com.google.android.material.slider.Slider
                 android:id="@+id/seek_read_page"
                 android:layout_width="0dp"
                 android:layout_height="25dp"
                 android:layout_gravity="center_vertical"
                 android:layout_weight="1" />
 
-            <TextView
+            <com.google.android.material.button.MaterialButton
                 android:id="@+id/tv_next"
                 android:layout_width="wrap_content"
                 android:layout_height="wrap_content"
-                android:layout_marginStart="10dp"
-                android:layout_marginEnd="10dp"
-                android:background="?android:attr/selectableItemBackgroundBorderless"
-                android:paddingTop="10dp"
-                android:paddingBottom="10dp"
-                android:text="@string/next_chapter"
-                android:textColor="@color/primaryText"
-                android:textSize="14sp"
+                style="@style/Widget.Material3.Button.IconButton.Filled.Tonal"
+                app:icon="@drawable/ic_next"
                 tools:ignore="TouchTargetSizeCheck" />
         </LinearLayout>
     </LinearLayout>

+ 12 - 32
app/src/main/res/layout/view_read_menu.xml

@@ -76,8 +76,7 @@
         android:layout_height="0dp"
         android:layout_marginHorizontal="16dp"
         android:layout_marginTop="16dp"
-        android:background="@color/transparent30"
-        android:gravity="center_horizontal"
+        android:gravity="left"
         android:orientation="vertical"
         app:layout_constraintBottom_toTopOf="@+id/bottom_menu"
         app:layout_constraintLeft_toLeftOf="parent"
@@ -93,28 +92,22 @@
             android:src="@drawable/ic_brightness_auto"
             tools:ignore="ImageContrastCheck" />
 
-        <io.legato.kazusa.ui.widget.seekbar.VerticalSeekBarWrapper
+        <com.google.android.material.slider.Slider
+            android:id="@+id/seek_brightness"
             android:layout_width="wrap_content"
-            android:layout_height="0dp"
-            android:layout_weight="1">
-
-            <io.legato.kazusa.ui.widget.seekbar.VerticalSeekBar
-                android:id="@+id/seek_brightness"
-                android:layout_width="wrap_content"
-                android:layout_height="match_parent"
-                android:max="255"
-                app:seekBarRotation="CW270" />
-
-        </io.legato.kazusa.ui.widget.seekbar.VerticalSeekBarWrapper>
+            android:layout_height="80dp"
+            android:rotation="270"
+            android:valueFrom="0.0"
+            android:valueTo="255.0" />
 
         <androidx.appcompat.widget.AppCompatImageView
             android:id="@+id/vw_brightness_pos_adjust"
             android:layout_width="24dp"
             android:layout_height="24dp"
             android:layout_margin="8dp"
+            android:layout_gravity="bottom"
             android:contentDescription="@string/adjust_pos"
             android:src="@drawable/ic_swap_horiz" />
-
     </LinearLayout>
 
     <LinearLayout
@@ -140,7 +133,6 @@
                 android:layout_margin="12dp"
                 android:contentDescription="@string/search_content"
                 android:src="@drawable/ic_search"
-                android:tint="@color/primaryText"
                 android:tooltipText="@string/search_content"
                 app:elevation="2dp"
                 app:fabSize="mini"
@@ -158,7 +150,6 @@
                 android:layout_margin="12dp"
                 android:contentDescription="@string/auto_next_page"
                 android:src="@drawable/ic_auto_page"
-                android:tint="@color/primaryText"
                 android:tooltipText="@string/auto_next_page"
                 app:elevation="2dp"
                 app:fabSize="mini"
@@ -176,7 +167,6 @@
                 android:layout_margin="12dp"
                 android:contentDescription="@string/replace_rule_title"
                 android:src="@drawable/ic_find_replace"
-                android:tint="@color/primaryText"
                 android:tooltipText="@string/replace_rule_title"
                 app:elevation="2dp"
                 app:fabSize="mini"
@@ -194,7 +184,6 @@
                 android:layout_margin="12dp"
                 android:contentDescription="@string/dark_theme"
                 android:src="@drawable/ic_brightness"
-                android:tint="@color/primaryText"
                 android:tooltipText="@string/dark_theme"
                 app:elevation="2dp"
                 app:fabSize="mini"
@@ -232,8 +221,6 @@
                     android:enabled="false"
                     android:focusable="true"
                     app:icon="@drawable/ic_previous"
-                    app:iconTint="@color/primaryText"
-                    app:strokeColor="@color/primaryText"
                     android:contentDescription="@string/previous_chapter"
                     tools:ignore="TouchTargetSizeCheck" />
 
@@ -242,7 +229,10 @@
                     android:layout_width="0dp"
                     android:layout_height="wrap_content"
                     android:layout_gravity="center_vertical"
-                    android:layout_weight="1" />
+                    android:layout_weight="1"
+                    android:valueTo="2.0"
+                    android:valueFrom="1.0"
+                    android:value="1.0"/>
 
                 <com.google.android.material.button.MaterialButton
                     android:id="@+id/tv_next"
@@ -254,8 +244,6 @@
                     android:enabled="false"
                     android:focusable="true"
                     app:icon="@drawable/ic_next"
-                    app:iconTint="@color/primaryText"
-                    app:strokeColor="@color/primaryText"
                     android:contentDescription="@string/next_chapter"
                     tools:ignore="TouchTargetSizeCheck"/>
             </LinearLayout>
@@ -296,7 +284,6 @@
                         android:contentDescription="@string/chapter_list"
                         android:maxHeight="24dp"
                         android:src="@drawable/ic_toc"
-                        app:tint="@color/primaryText"
                         tools:ignore="NestedWeights" />
 
                     <TextView
@@ -307,7 +294,6 @@
                         android:ellipsize="middle"
                         android:singleLine="true"
                         android:text="@string/chapter_list"
-                        android:textColor="@color/primaryText"
                         android:textSize="12sp" />
                 </LinearLayout>
 
@@ -340,7 +326,6 @@
                         android:contentDescription="@string/read_aloud"
                         android:maxHeight="24dp"
                         android:src="@drawable/ic_read_aloud"
-                        app:tint="@color/primaryText"
                         tools:ignore="NestedWeights" />
 
                     <TextView
@@ -351,7 +336,6 @@
                         android:ellipsize="middle"
                         android:singleLine="true"
                         android:text="@string/read_aloud"
-                        android:textColor="@color/primaryText"
                         android:textSize="12sp" />
                 </LinearLayout>
 
@@ -384,7 +368,6 @@
                         android:contentDescription="@string/interface_setting"
                         android:maxHeight="24dp"
                         android:src="@drawable/ic_interface_setting"
-                        app:tint="@color/primaryText"
                         tools:ignore="NestedWeights" />
 
                     <TextView
@@ -395,7 +378,6 @@
                         android:ellipsize="middle"
                         android:singleLine="true"
                         android:text="@string/interface_setting"
-                        android:textColor="@color/primaryText"
                         android:textSize="12sp" />
                 </LinearLayout>
 
@@ -428,7 +410,6 @@
                         android:contentDescription="@string/setting"
                         android:maxHeight="24dp"
                         android:src="@drawable/ic_settings"
-                        app:tint="@color/primaryText"
                         tools:ignore="NestedWeights" />
 
                     <TextView
@@ -439,7 +420,6 @@
                         android:ellipsize="middle"
                         android:singleLine="true"
                         android:text="@string/setting"
-                        android:textColor="@color/primaryText"
                         android:textSize="12sp" />
                 </LinearLayout>