阅读进度条开关 #125
This commit is contained in:
@@ -11,6 +11,7 @@ import android.view.WindowManager.LayoutParams.BRIGHTNESS_OVERRIDE_NONE
|
|||||||
import android.view.animation.AlphaAnimation
|
import android.view.animation.AlphaAnimation
|
||||||
import android.view.animation.Animation
|
import android.view.animation.Animation
|
||||||
import android.widget.FrameLayout
|
import android.widget.FrameLayout
|
||||||
|
import android.widget.LinearLayout
|
||||||
import android.widget.SeekBar
|
import android.widget.SeekBar
|
||||||
import androidx.appcompat.widget.PopupMenu
|
import androidx.appcompat.widget.PopupMenu
|
||||||
import androidx.core.graphics.ColorUtils
|
import androidx.core.graphics.ColorUtils
|
||||||
@@ -18,6 +19,7 @@ import androidx.core.view.isGone
|
|||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
import com.google.android.material.button.MaterialButton
|
import com.google.android.material.button.MaterialButton
|
||||||
import com.google.android.material.button.MaterialButtonGroup
|
import com.google.android.material.button.MaterialButtonGroup
|
||||||
|
import com.google.android.material.overflow.OverflowLinearLayout
|
||||||
import com.google.android.material.slider.Slider
|
import com.google.android.material.slider.Slider
|
||||||
import io.legato.kazusa.R
|
import io.legato.kazusa.R
|
||||||
import io.legato.kazusa.constant.PreferKey
|
import io.legato.kazusa.constant.PreferKey
|
||||||
@@ -37,7 +39,6 @@ import io.legato.kazusa.utils.activity
|
|||||||
import io.legato.kazusa.utils.applyNavigationBarPadding
|
import io.legato.kazusa.utils.applyNavigationBarPadding
|
||||||
import io.legato.kazusa.utils.dpToPx
|
import io.legato.kazusa.utils.dpToPx
|
||||||
import io.legato.kazusa.utils.getPrefBoolean
|
import io.legato.kazusa.utils.getPrefBoolean
|
||||||
import io.legato.kazusa.utils.getPrefString
|
|
||||||
import io.legato.kazusa.utils.gone
|
import io.legato.kazusa.utils.gone
|
||||||
import io.legato.kazusa.utils.invisible
|
import io.legato.kazusa.utils.invisible
|
||||||
import io.legato.kazusa.utils.loadAnimation
|
import io.legato.kazusa.utils.loadAnimation
|
||||||
@@ -515,6 +516,7 @@ class ReadMenu @JvmOverloads constructor(
|
|||||||
tooltipText = btn.description
|
tooltipText = btn.description
|
||||||
strokeWidth = 0
|
strokeWidth = 0
|
||||||
iconGravity = MaterialButton.ICON_GRAVITY_TEXT_START
|
iconGravity = MaterialButton.ICON_GRAVITY_TEXT_START
|
||||||
|
maxLines = 1
|
||||||
setOnClickListener { btn.onClick() }
|
setOnClickListener { btn.onClick() }
|
||||||
btn.onLongClick?.let { longAction ->
|
btn.onLongClick?.let { longAction ->
|
||||||
setOnLongClickListener {
|
setOnLongClickListener {
|
||||||
@@ -523,15 +525,12 @@ class ReadMenu @JvmOverloads constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
group.addView(button,
|
group.addView(
|
||||||
MaterialButtonGroup.LayoutParams(
|
button,
|
||||||
LayoutParams.WRAP_CONTENT,
|
OverflowLinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT, 1f)
|
||||||
LayoutParams.WRAP_CONTENT
|
|
||||||
).apply {
|
|
||||||
weight = 1f
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
val lp = button.layoutParams as MaterialButtonGroup.LayoutParams
|
val lp =
|
||||||
|
button.layoutParams as MaterialButtonGroup.LayoutParams
|
||||||
lp.overflowText = btn.description
|
lp.overflowText = btn.description
|
||||||
buttonMap[btn.id] = button
|
buttonMap[btn.id] = button
|
||||||
}
|
}
|
||||||
@@ -587,6 +586,18 @@ class ReadMenu @JvmOverloads constructor(
|
|||||||
if (AppConfig.isNightTheme) R.drawable.ic_daytime else R.drawable.ic_brightness
|
if (AppConfig.isNightTheme) R.drawable.ic_daytime else R.drawable.ic_brightness
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
),
|
||||||
|
ToolButton(
|
||||||
|
id = "prev_chapter",
|
||||||
|
iconRes = R.drawable.ic_previous,
|
||||||
|
description = context.getString(R.string.previous_chapter),
|
||||||
|
onClick = { ReadBook.moveToPrevChapter(upContent = true, toLast = false) }
|
||||||
|
),
|
||||||
|
ToolButton(
|
||||||
|
id = "next_chapter",
|
||||||
|
iconRes = R.drawable.ic_next,
|
||||||
|
description = context.getString(R.string.next_chapter),
|
||||||
|
onClick = { ReadBook.moveToNextChapter(true) }
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ class ToolButtonConfigDialog : BaseBottomSheetDialogFragment(R.layout.dialog_too
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun getAllButtonIds(): List<String> {
|
private fun getAllButtonIds(): List<String> {
|
||||||
return listOf("search", "auto_page", "catalog", "read_aloud", "setting", "addBookmark", "theme")
|
return listOf("search", "auto_page", "catalog", "read_aloud", "setting", "addBookmark", "theme", "prev_chapter", "next_chapter")
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getButtonInfo(id: String): Pair<Int, String> {
|
private fun getButtonInfo(id: String): Pair<Int, String> {
|
||||||
@@ -126,6 +126,8 @@ class ToolButtonConfigDialog : BaseBottomSheetDialogFragment(R.layout.dialog_too
|
|||||||
"setting" -> R.drawable.ic_settings to getString(R.string.setting)
|
"setting" -> R.drawable.ic_settings to getString(R.string.setting)
|
||||||
"addBookmark" -> R.drawable.ic_bookmark to getString(R.string.bookmark)
|
"addBookmark" -> R.drawable.ic_bookmark to getString(R.string.bookmark)
|
||||||
"theme" -> R.drawable.ic_daytime to getString(R.string.day_night_switch)
|
"theme" -> R.drawable.ic_daytime to getString(R.string.day_night_switch)
|
||||||
|
"prev_chapter" -> R.drawable.ic_previous to getString(R.string.previous_chapter)
|
||||||
|
"next_chapter" -> R.drawable.ic_next to getString(R.string.next_chapter)
|
||||||
else -> R.drawable.ic_help to id
|
else -> R.drawable.ic_help to id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,8 @@
|
|||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/recyclerView"
|
android:id="@+id/recyclerView"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="1" />
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
<com.google.android.material.button.MaterialButton
|
||||||
android:id="@+id/btnSave"
|
android:id="@+id/btnSave"
|
||||||
|
|||||||
@@ -174,11 +174,11 @@
|
|||||||
android:id="@+id/bottom_view"
|
android:id="@+id/bottom_view"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
app:overflowMode="menu"
|
app:overflowMode="menu"
|
||||||
android:paddingVertical="8dp"
|
android:paddingVertical="8dp"
|
||||||
android:paddingHorizontal="16dp"
|
android:paddingHorizontal="16dp"
|
||||||
android:background="?attr/colorSurfaceContainer"
|
android:background="?attr/colorSurfaceContainer" />
|
||||||
android:orientation="horizontal"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|||||||
@@ -1300,7 +1300,7 @@
|
|||||||
<string name="restart_required_message">此更改需要重启应用才能生效,是否立即重启?</string>
|
<string name="restart_required_message">此更改需要重启应用才能生效,是否立即重启?</string>
|
||||||
<string name="restart_later_message">更改将在下次启动应用时生效</string>
|
<string name="restart_later_message">更改将在下次启动应用时生效</string>
|
||||||
<string name="search_select_group">选择书源分组</string>
|
<string name="search_select_group">选择书源分组</string>
|
||||||
<string name="day_night_switch">深浅色模式开关</string>
|
<string name="day_night_switch">深浅色模式切换</string>
|
||||||
<string name="manga_long_click">长按保存图片</string>
|
<string name="manga_long_click">长按保存图片</string>
|
||||||
<string name="read_type_long">长按设置为全局默认模式</string>
|
<string name="read_type_long">长按设置为全局默认模式</string>
|
||||||
<string name="read_slider_mode">滑动条显示样式</string>
|
<string name="read_slider_mode">滑动条显示样式</string>
|
||||||
|
|||||||
Reference in New Issue
Block a user