字体阴影与斜体 #141

This commit is contained in:
HapeLee
2025-10-26 02:08:38 +08:00
parent 1a37c2a01f
commit b53b2cdf04
10 changed files with 361 additions and 149 deletions
@@ -32,6 +32,8 @@ import io.legato.kazusa.utils.putPrefInt
import io.legato.kazusa.utils.resizeAndRecycle import io.legato.kazusa.utils.resizeAndRecycle
import splitties.init.appCtx import splitties.init.appCtx
import java.io.File import java.io.File
import kotlin.String
import androidx.core.graphics.drawable.toDrawable
/** /**
* 阅读界面配置 * 阅读界面配置
@@ -58,6 +60,7 @@ object ReadBookConfig {
var bg: Drawable? = null var bg: Drawable? = null
var bgMeanColor: Int = 0 var bgMeanColor: Int = 0
val textColor: Int get() = durConfig.curTextColor() val textColor: Int get() = durConfig.curTextColor()
val textShadowColor: Int get() = durConfig.curTextShadowColor()
init { init {
initConfigs() initConfigs()
@@ -246,6 +249,36 @@ object ReadBookConfig {
config.textBold = value config.textBold = value
} }
var textItalic: Boolean
get() = config.textItalic
set(value) {
config.textItalic = value
}
var textShadow: Boolean
get() = config.textShadow
set(value) {
config.textShadow = value
}
var shadowRadius: Float
get() = config.shadowRadius
set(value) {
config.shadowRadius = value
}
var shadowDx: Float
get() = config.shadowDx
set(value) {
config.shadowDx = value
}
var shadowDy: Float
get() = config.shadowDy
set(value) {
config.shadowDy = value
}
var textSize: Int var textSize: Int
get() = config.textSize get() = config.textSize
set(value) { set(value) {
@@ -509,6 +542,13 @@ object ReadBookConfig {
var textFont: String = "",//字体 var textFont: String = "",//字体
var textBold: Int = 500,//是否粗体字 0:正常, 1:粗体, 2:细体 var textBold: Int = 500,//是否粗体字 0:正常, 1:粗体, 2:细体
var textSize: Int = 20,//文字大小 var textSize: Int = 20,//文字大小
var textItalic: Boolean = false,// 是否启用斜体
var textShadow: Boolean = false,// 是否启用阴影
var shadowRadius: Float = 16f,// 阴影模糊半径
var shadowDx: Float = 1f,// 阴影x偏移
var shadowDy: Float = 1f,// 阴影y偏移
private var shadowColor: String = "#3E3D3B",
private var shadowColorN: String = "#3E3D3B",
var letterSpacing: Float = 0.1f,//字间距 var letterSpacing: Float = 0.1f,//字间距
var lineSpacingExtra: Int = 12,//行间距 var lineSpacingExtra: Int = 12,//行间距
var paragraphSpacing: Int = 2,//段距 var paragraphSpacing: Int = 2,//段距
@@ -553,16 +593,37 @@ object ReadBookConfig {
@Transient @Transient
private var textColorInt = -1 private var textColorInt = -1
@Transient
private var textColorSIntNight = -1
@Transient
private var textColorSInt = -1
@Transient @Transient
private var initColorInt = false private var initColorInt = false
private fun initColorInt() { private fun initColorInt() {
textColorIntEInk = Color.parseColor(textColorEInk) textColorIntEInk = textColorEInk.toColorInt()
textColorIntNight = Color.parseColor(textColorNight) textColorIntNight = textColorNight.toColorInt()
textColorInt = Color.parseColor(textColor) textColorInt = textColor.toColorInt()
textColorSIntNight = shadowColorN.toColorInt()
textColorSInt = shadowColor.toColorInt()
initColorInt = true initColorInt = true
} }
fun setCurShadColor(color: Int){
when {
AppConfig.isNightTheme -> {
shadowColorN = "#${color.hexString}"
textColorSIntNight = color
}
else -> {
shadowColor = "#${color.hexString}"
textColorSInt = color
}
}
}
fun setCurTextColor(color: Int) { fun setCurTextColor(color: Int) {
when { when {
AppConfig.isEInkMode -> { AppConfig.isEInkMode -> {
@@ -593,6 +654,16 @@ object ReadBookConfig {
} }
} }
fun curTextShadowColor(): Int {
if (!initColorInt) {
initColorInt()
}
return when {
AppConfig.isNightTheme -> textColorSIntNight
else -> textColorSInt
}
}
fun setCurStatusIconDark(isDark: Boolean) { fun setCurStatusIconDark(isDark: Boolean) {
when { when {
AppConfig.isEInkMode -> darkStatusIconEInk = isDark AppConfig.isEInkMode -> darkStatusIconEInk = isDark
@@ -661,18 +732,18 @@ object ReadBookConfig {
fun curBgDrawable(width: Int, height: Int): Drawable { fun curBgDrawable(width: Int, height: Int): Drawable {
if (width == 0 || height == 0) { if (width == 0 || height == 0) {
val backgroundColor = MaterialColors.getColor(appCtx, com.google.android.material.R.attr.colorSurface, Color.WHITE) val backgroundColor = MaterialColors.getColor(appCtx, com.google.android.material.R.attr.colorSurface, Color.WHITE)
return ColorDrawable(backgroundColor) return backgroundColor.toDrawable()
} }
var bgDrawable: Drawable? = null var bgDrawable: Drawable? = null
val resources = appCtx.resources val resources = appCtx.resources
try { try {
bgDrawable = when (curBgType()) { bgDrawable = when (curBgType()) {
0 -> ColorDrawable(Color.parseColor(curBgStr())) 0 -> curBgStr().toColorInt().toDrawable()
1 -> { 1 -> {
val path = "bg" + File.separator + curBgStr() val path = "bg" + File.separator + curBgStr()
val bitmap = BitmapUtils.decodeAssetsBitmap(appCtx, path, width, height) val bitmap = BitmapUtils.decodeAssetsBitmap(appCtx, path, width, height)
BitmapDrawable(resources, bitmap?.resizeAndRecycle(width, height)) bitmap?.resizeAndRecycle(width, height)?.toDrawable(resources)
} }
else -> { else -> {
val path = curBgStr().let { val path = curBgStr().let {
@@ -680,7 +751,7 @@ object ReadBookConfig {
else FileUtils.getPath(appCtx.externalFiles, "bg", curBgStr()) else FileUtils.getPath(appCtx.externalFiles, "bg", curBgStr())
} }
val bitmap = BitmapUtils.decodeBitmap(path, width, height) val bitmap = BitmapUtils.decodeBitmap(path, width, height)
BitmapDrawable(resources, bitmap?.resizeAndRecycle(width, height)) bitmap?.resizeAndRecycle(width, height)?.toDrawable(resources)
} }
} }
} catch (e: OutOfMemoryError) { } catch (e: OutOfMemoryError) {
@@ -691,7 +762,7 @@ object ReadBookConfig {
// fallback 使用 MD3 的 colorSurface 作为背景色 // fallback 使用 MD3 的 colorSurface 作为背景色
val fallbackColor = MaterialColors.getColor(appCtx, com.google.android.material.R.attr.colorSurface, Color.WHITE) val fallbackColor = MaterialColors.getColor(appCtx, com.google.android.material.R.attr.colorSurface, Color.WHITE)
return bgDrawable ?: ColorDrawable(fallbackColor) return bgDrawable ?: fallbackColor.toDrawable()
} }
} }
} }
@@ -76,6 +76,7 @@ import io.legato.kazusa.ui.book.info.BookInfoActivity
import io.legato.kazusa.ui.book.read.config.AutoReadDialog import io.legato.kazusa.ui.book.read.config.AutoReadDialog
import io.legato.kazusa.ui.book.read.config.BgTextConfigDialog.Companion.BG_COLOR import io.legato.kazusa.ui.book.read.config.BgTextConfigDialog.Companion.BG_COLOR
import io.legato.kazusa.ui.book.read.config.BgTextConfigDialog.Companion.TEXT_COLOR import io.legato.kazusa.ui.book.read.config.BgTextConfigDialog.Companion.TEXT_COLOR
import io.legato.kazusa.ui.book.read.config.FontSelectDialog.Companion.S_COLOR
import io.legato.kazusa.ui.book.read.config.ReadAloudDialog import io.legato.kazusa.ui.book.read.config.ReadAloudDialog
import io.legato.kazusa.ui.book.read.config.ReadStyleDialog import io.legato.kazusa.ui.book.read.config.ReadStyleDialog
import io.legato.kazusa.ui.book.read.config.TipConfigDialog.Companion.TIP_COLOR import io.legato.kazusa.ui.book.read.config.TipConfigDialog.Companion.TIP_COLOR
@@ -1504,6 +1505,10 @@ class ReadBookActivity : BaseReadBookActivity(),
*/ */
override fun onColorSelected(dialogId: Int, color: Int) = ReadBookConfig.durConfig.run { override fun onColorSelected(dialogId: Int, color: Int) = ReadBookConfig.durConfig.run {
when (dialogId) { when (dialogId) {
S_COLOR -> {
setCurShadColor(color)
postEvent(EventBus.UP_CONFIG, arrayListOf(2, 6, 9, 11))
}
TEXT_COLOR -> { TEXT_COLOR -> {
setCurTextColor(color) setCurTextColor(color)
postEvent(EventBus.UP_CONFIG, arrayListOf(2, 6, 9, 11)) postEvent(EventBus.UP_CONFIG, arrayListOf(2, 6, 9, 11))
@@ -1,17 +1,19 @@
package io.legato.kazusa.ui.book.read.config package io.legato.kazusa.ui.book.read.config
//import io.legado.app.lib.theme.primaryColor
import android.content.Context import android.content.Context
import android.graphics.Typeface import android.graphics.Typeface
import android.os.Bundle import android.os.Bundle
import android.view.MenuItem import android.view.MenuItem
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.ArrayAdapter
import androidx.appcompat.widget.Toolbar import androidx.appcompat.widget.Toolbar
import io.legato.kazusa.help.config.ReadBookConfig
import androidx.core.net.toUri import androidx.core.net.toUri
import androidx.documentfile.provider.DocumentFile import androidx.documentfile.provider.DocumentFile
import androidx.lifecycle.lifecycleScope import androidx.lifecycle.lifecycleScope
import androidx.recyclerview.widget.GridLayoutManager import androidx.recyclerview.widget.GridLayoutManager
import com.jaredrummler.android.colorpicker.ColorPickerDialog
import io.legato.kazusa.R import io.legato.kazusa.R
import io.legato.kazusa.base.BaseBottomSheetDialogFragment import io.legato.kazusa.base.BaseBottomSheetDialogFragment
import io.legato.kazusa.base.adapter.ItemViewHolder import io.legato.kazusa.base.adapter.ItemViewHolder
@@ -22,7 +24,6 @@ import io.legato.kazusa.constant.PreferKey
import io.legato.kazusa.databinding.DialogFontSelectBinding import io.legato.kazusa.databinding.DialogFontSelectBinding
import io.legato.kazusa.databinding.ItemFontBinding import io.legato.kazusa.databinding.ItemFontBinding
import io.legato.kazusa.help.config.AppConfig import io.legato.kazusa.help.config.AppConfig
import io.legato.kazusa.help.config.ReadBookConfig
import io.legato.kazusa.lib.dialogs.SelectItem import io.legato.kazusa.lib.dialogs.SelectItem
import io.legato.kazusa.lib.dialogs.alert import io.legato.kazusa.lib.dialogs.alert
import io.legato.kazusa.lib.permission.Permissions import io.legato.kazusa.lib.permission.Permissions
@@ -54,6 +55,10 @@ import java.net.URLDecoder
*/ */
class FontSelectDialog : BaseBottomSheetDialogFragment(R.layout.dialog_font_select), class FontSelectDialog : BaseBottomSheetDialogFragment(R.layout.dialog_font_select),
Toolbar.OnMenuItemClickListener { Toolbar.OnMenuItemClickListener {
companion object {
const val S_COLOR = 123
}
private val fontRegex = Regex("(?i).*\\.[ot]tf") private val fontRegex = Regex("(?i).*\\.[ot]tf")
private val binding by viewBinding(DialogFontSelectBinding::bind) private val binding by viewBinding(DialogFontSelectBinding::bind)
private val adapter by lazy { private val adapter by lazy {
@@ -118,23 +123,21 @@ class FontSelectDialog : BaseBottomSheetDialogFragment(R.layout.dialog_font_sele
((it - 50) / 100f).toString() ((it - 50) / 100f).toString()
} }
dsbLineSize.valueFormat = { ((it - 10) / 10f).toString() } dsbLineSize.valueFormat = { ((it - 10) / 10f).toString() }
binding.dsbShadowRadius.valueFormat = { "${it.toInt()} px" }
binding.dsbShadowDx.valueFormat = { "${it.toInt()} px" }
binding.dsbShadowDy.valueFormat = { "${it.toInt()} px" }
binding.bgTextIndent.apply { binding.textIndentDropdown.apply {
val currentIndex = ReadBookConfig.paragraphIndent.length.coerceAtMost(childCount - 1) val items = listOf("0", "1", "2", "3", "4")
val defaultButtonId = getChildAt(currentIndex).id val adapter = ArrayAdapter(context, android.R.layout.simple_list_item_1, items)
check(defaultButtonId) setAdapter(adapter)
val currentIndex = ReadBookConfig.paragraphIndent.length.coerceIn(0, items.lastIndex)
addOnButtonCheckedListener { group, checkedId, isChecked -> setText(items[currentIndex], false)
if (isChecked) { setOnItemClickListener { _, _, position, _ ->
val checkedIndex = (0 until group.childCount) ReadBookConfig.paragraphIndent = " ".repeat(position)
.firstOrNull { group.getChildAt(it).id == checkedId }
?: return@addOnButtonCheckedListener
ReadBookConfig.paragraphIndent = " ".repeat(checkedIndex)
postEvent(EventBus.UP_CONFIG, arrayListOf(8, 5)) postEvent(EventBus.UP_CONFIG, arrayListOf(8, 5))
} }
} }
}
val weightOptions = context?.resources?.getStringArray(R.array.text_font_weight) val weightOptions = context?.resources?.getStringArray(R.array.text_font_weight)
val weightValues = listOf(2, 1, 0) val weightValues = listOf(2, 1, 0)
@@ -166,6 +169,9 @@ class FontSelectDialog : BaseBottomSheetDialogFragment(R.layout.dialog_font_sele
postEvent(EventBus.UP_CONFIG, arrayListOf(8, 9, 6)) postEvent(EventBus.UP_CONFIG, arrayListOf(8, 9, 6))
} }
} }
binding.btnTextItalic.isChecked = ReadBookConfig.textItalic
binding.btnTextShadow.isChecked = ReadBookConfig.textShadow
} }
private fun initViewEvent() = binding.run { private fun initViewEvent() = binding.run {
@@ -192,6 +198,35 @@ class FontSelectDialog : BaseBottomSheetDialogFragment(R.layout.dialog_font_sele
} }
} }
} }
binding.btnTextItalic.addOnCheckedChangeListener { _, isChecked ->
ReadBookConfig.textItalic = isChecked
postEvent(EventBus.UP_CONFIG, arrayListOf(8, 5))
}
binding.btnTextShadow.addOnCheckedChangeListener { _, isChecked ->
ReadBookConfig.textShadow = isChecked
postEvent(EventBus.UP_CONFIG, arrayListOf(8, 5))
}
binding.dsbShadowRadius.onChanged = {
ReadBookConfig.shadowRadius = it.toFloat()
postEvent(EventBus.UP_CONFIG, arrayListOf(8, 5))
}
binding.dsbShadowDx.onChanged = {
ReadBookConfig.shadowDx = it.toFloat()
postEvent(EventBus.UP_CONFIG, arrayListOf(8, 5))
}
binding.dsbShadowDy.onChanged = {
ReadBookConfig.shadowDy = it.toFloat()
postEvent(EventBus.UP_CONFIG, arrayListOf(8, 5))
}
binding.btnShadowColor.setOnClickListener {
ColorPickerDialog.newBuilder()
.setColor(ReadBookConfig.config.curTextShadowColor())
.setShowAlphaSlider(false)
.setDialogType(ColorPickerDialog.TYPE_CUSTOM)
.setDialogId(S_COLOR)
.show(requireActivity())
//postEvent(EventBus.UP_CONFIG, arrayListOf(8, 5))
}
} }
private fun upView() = binding.run { private fun upView() = binding.run {
@@ -199,6 +234,9 @@ class FontSelectDialog : BaseBottomSheetDialogFragment(R.layout.dialog_font_sele
dsbTextLetterSpacing.progress = (it.letterSpacing * 100).toInt() + 50 dsbTextLetterSpacing.progress = (it.letterSpacing * 100).toInt() + 50
dsbLineSize.progress = it.lineSpacingExtra dsbLineSize.progress = it.lineSpacingExtra
dsbParagraphSpacing.value = it.paragraphSpacing.toFloat() dsbParagraphSpacing.value = it.paragraphSpacing.toFloat()
binding.dsbShadowRadius.progress = it.shadowRadius.toInt()
binding.dsbShadowDx.progress = it.shadowDx.toInt()
binding.dsbShadowDy.progress = it.shadowDy.toInt()
} }
} }
@@ -1,5 +1,7 @@
package io.legato.kazusa.ui.book.read.page.provider package io.legato.kazusa.ui.book.read.page.provider
import android.annotation.SuppressLint
import android.graphics.Color
import android.graphics.Paint.FontMetrics import android.graphics.Paint.FontMetrics
import android.graphics.RectF import android.graphics.RectF
import android.graphics.Typeface import android.graphics.Typeface
@@ -38,6 +40,7 @@ import splitties.init.appCtx
import java.io.File import java.io.File
import java.util.LinkedList import java.util.LinkedList
import java.util.Locale import java.util.Locale
import androidx.core.graphics.toColorInt
/** /**
* 解析内容生成章节和页面 * 解析内容生成章节和页面
@@ -910,6 +913,7 @@ object ChapterProvider {
} ?: Typeface.DEFAULT } ?: Typeface.DEFAULT
} }
@SuppressLint("UseKtx")
private fun getPaints(typeface: Typeface?): Pair<TextPaint, TextPaint> { private fun getPaints(typeface: Typeface?): Pair<TextPaint, TextPaint> {
val bold = Typeface.create(typeface, Typeface.BOLD) val bold = Typeface.create(typeface, Typeface.BOLD)
val normal = Typeface.create(typeface, Typeface.NORMAL) val normal = Typeface.create(typeface, Typeface.NORMAL)
@@ -952,6 +956,17 @@ object ChapterProvider {
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.Q && AppConfig.optimizeRender) { if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.Q && AppConfig.optimizeRender) {
tPaint.isLinearText = true tPaint.isLinearText = true
} }
if (ReadBookConfig.textItalic) {
tPaint.textSkewX = -0.25f
}
if (ReadBookConfig.textShadow) {
tPaint.setShadowLayer(
ReadBookConfig.shadowRadius,
ReadBookConfig.shadowDx,
ReadBookConfig.shadowDy,
ReadBookConfig.textShadowColor
)
}
//正文 //正文
val cPaint = TextPaint() val cPaint = TextPaint()
cPaint.color = ReadBookConfig.textColor cPaint.color = ReadBookConfig.textColor
@@ -964,7 +979,17 @@ object ChapterProvider {
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.Q && AppConfig.optimizeRender) { if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.Q && AppConfig.optimizeRender) {
cPaint.isLinearText = true cPaint.isLinearText = true
} }
if (ReadBookConfig.textItalic) {
cPaint.textSkewX = -0.25f
}
if (ReadBookConfig.textShadow) {
cPaint.setShadowLayer(
ReadBookConfig.shadowRadius,
ReadBookConfig.shadowDx,
ReadBookConfig.shadowDy,
ReadBookConfig.textShadowColor
)
}
return Pair(tPaint, cPaint) return Pair(tPaint, cPaint)
} }
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M200,760L200,660L360,660L480,300L320,300L320,200L720,200L720,300L580,300L460,660L600,660L600,760L200,760Z"/>
</vector>
+10
View File
@@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="960"
android:viewportHeight="960"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M160,880Q127,880 103.5,856.5Q80,833 80,800L80,320Q80,287 103.5,263.5Q127,240 160,240L240,240L240,160Q240,127 263.5,103.5Q287,80 320,80L800,80Q833,80 856.5,103.5Q880,127 880,160L880,640Q880,673 856.5,696.5Q833,720 800,720L720,720L720,800Q720,833 696.5,856.5Q673,880 640,880L160,880ZM320,640L800,640Q800,640 800,640Q800,640 800,640L800,160Q800,160 800,160Q800,160 800,160L320,160Q320,160 320,160Q320,160 320,160L320,640Q320,640 320,640Q320,640 320,640Z"/>
</vector>
+135 -88
View File
@@ -11,29 +11,54 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:theme="?attr/actionBarStyle" /> android:theme="?attr/actionBarStyle" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="16dp"
android:text="@string/text_font"
android:textSize="12sp"
android:textStyle="bold" />
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="horizontal" android:orientation="horizontal"
android:paddingStart="16dp" android:paddingStart="10dp"
android:paddingEnd="2dp"> android:paddingEnd="10dp">
<TextView <com.google.android.material.button.MaterialButtonGroup
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/text_font_weight_converter" android:gravity="center_vertical">
android:textSize="12sp"
android:textStyle="bold" /> <com.google.android.material.button.MaterialButton
android:id="@+id/btn_textItalic"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/Widget.Material3Expressive.Button.IconButton.Tonal"
app:icon="@drawable/ic_format_italic"
android:checkable="true"
android:focusable="true"/>
<com.google.android.material.button.MaterialButton
android:id="@+id/btn_textShadow"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/Widget.Material3Expressive.Button.IconButton.Tonal"
app:icon="@drawable/ic_shadow"
android:checkable="true"
android:focusable="true"/>
<com.google.android.material.button.MaterialButton <com.google.android.material.button.MaterialButton
android:id="@+id/textFontWeightConverter" android:id="@+id/textFontWeightConverter"
style="@style/Widget.Material3Expressive.Button.TonalButton" style="@style/Widget.Material3Expressive.Button.IconButton.Tonal"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="12dp" android:minWidth="0dp"
android:minWidth="80dp"
android:textSize="12sp" /> android:textSize="12sp" />
</com.google.android.material.button.MaterialButtonGroup>
<com.google.android.material.slider.Slider <com.google.android.material.slider.Slider
android:id="@+id/sliderFontWeight" android:id="@+id/sliderFontWeight"
android:layout_width="0dp" android:layout_width="0dp"
@@ -47,106 +72,94 @@
android:layout_marginHorizontal="16dp" android:layout_marginHorizontal="16dp"
android:orientation="vertical"> android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:layout_marginBottom="4dp"
android:text="@string/text_indent"
android:textSize="12sp"
android:textStyle="bold" />
<com.google.android.material.button.MaterialButtonToggleGroup
android:id="@+id/bgTextIndent"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:spacing="2dp"
app:innerCornerSize="8dp"
app:selectionRequired="true"
app:singleSelection="true">
<com.google.android.material.button.MaterialButton
android:id="@+id/btnIndent0"
style="@style/Widget.Material3Expressive.Button.OutlinedButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="0"
android:textStyle="bold" />
<com.google.android.material.button.MaterialButton
android:id="@+id/btnIndent1"
style="@style/Widget.Material3Expressive.Button.OutlinedButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="1"
android:textStyle="bold" />
<com.google.android.material.button.MaterialButton
android:id="@+id/btnIndent2"
style="@style/Widget.Material3Expressive.Button.OutlinedButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="2"
android:textStyle="bold" />
<com.google.android.material.button.MaterialButton
android:id="@+id/btnIndent3"
style="@style/Widget.Material3Expressive.Button.OutlinedButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="3"
android:textStyle="bold" />
<com.google.android.material.button.MaterialButton
android:id="@+id/btnIndent4"
style="@style/Widget.Material3Expressive.Button.OutlinedButton"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:text="4"
android:textStyle="bold" />
</com.google.android.material.button.MaterialButtonToggleGroup>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginVertical="8dp"
android:gravity="center_vertical" android:gravity="center_vertical"
android:orientation="horizontal"> android:orientation="horizontal">
<io.legato.kazusa.ui.widget.SimpleCounterView <io.legato.kazusa.ui.widget.SimpleCounterView
android:id="@+id/dsb_line_size" android:id="@+id/dsb_shadow_dx"
android:layout_width="0dp" android:layout_width="120dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="32dp"
android:layout_weight="1"
app:isBottomBackground="true" app:isBottomBackground="true"
app:max="20" app:max="20"
app:title="@string/line_size" /> app:title="@string/text_shadow_x" />
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"/>
<io.legato.kazusa.ui.widget.SimpleCounterView <io.legato.kazusa.ui.widget.SimpleCounterView
android:id="@+id/dsb_text_letter_spacing" android:id="@+id/dsb_shadow_dy"
android:layout_width="0dp" android:layout_width="120dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_weight="1"
app:isBottomBackground="true" app:isBottomBackground="true"
app:max="100" app:max="20"
app:title="@string/text_letter_spacing" /> app:title="@string/text_shadow_y" />
</LinearLayout> </LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="bottom">
<io.legato.kazusa.ui.widget.SimpleCounterView
android:id="@+id/dsb_shadow_radius"
android:layout_width="120dp"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
app:isBottomBackground="true"
app:max="50"
app:title="@string/text_shadow_radius" />
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"/>
<com.google.android.material.button.MaterialButton
android:id="@+id/btnShadowColor"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
style="@style/Widget.Material3Expressive.Button.OutlinedButton"
android:text="@string/text_shadow_color" />
</LinearLayout> </LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="horizontal">
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/textInputIndentLayout"
android:layout_width="120dp"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
style="@style/Widget.Material3.TextInputLayout.FilledBox.Dense.ExposedDropdownMenu"
android:hint="@string/text_indent">
<com.google.android.material.textfield.MaterialAutoCompleteTextView
android:id="@+id/textIndentDropdown"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="none"
android:focusable="false"
android:clickable="true" />
</com.google.android.material.textfield.TextInputLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginHorizontal="16dp" android:layout_marginHorizontal="16dp"
android:layout_marginTop="8dp"
android:orientation="horizontal"> android:orientation="horizontal">
<TextView <TextView
@@ -183,7 +196,6 @@
android:id="@+id/dsb_paragraph_spacing" android:id="@+id/dsb_paragraph_spacing"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginHorizontal="4dp"
android:stepSize="1" android:stepSize="1"
android:valueFrom="0" android:valueFrom="0"
android:valueTo="20" android:valueTo="20"
@@ -191,6 +203,41 @@
app:thumbHeight="24dp" app:thumbHeight="24dp"
app:title="@string/paragraph_size" app:title="@string/paragraph_size"
app:trackHeight="24dp" /> app:trackHeight="24dp" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginVertical="8dp"
android:gravity="center_vertical"
android:orientation="horizontal">
<io.legato.kazusa.ui.widget.SimpleCounterView
android:id="@+id/dsb_line_size"
android:layout_width="120dp"
android:layout_height="wrap_content"
app:isBottomBackground="true"
app:max="20"
app:title="@string/line_size" />
<View
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"/>
<io.legato.kazusa.ui.widget.SimpleCounterView
android:id="@+id/dsb_text_letter_spacing"
android:layout_width="120dp"
android:layout_height="wrap_content"
app:isBottomBackground="true"
app:max="100"
app:title="@string/text_letter_spacing" />
</LinearLayout>
</LinearLayout>
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_view" android:id="@+id/recycler_view"
@@ -33,7 +33,7 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginVertical="4dp" android:layout_marginVertical="4dp"
android:maxWidth="48sp" android:maxWidth="56sp"
android:maxLines="2" android:maxLines="2"
android:text="@string/text" android:text="@string/text"
android:textColor="?android:attr/textColorSecondary" android:textColor="?android:attr/textColorSecondary"
@@ -63,7 +63,6 @@
android:layout_weight="3" android:layout_weight="3"
android:minWidth="64dp" android:minWidth="64dp"
android:contentDescription="@string/reduce" android:contentDescription="@string/reduce"
android:elevation="4dp"
app:backgroundTint="?attr/colorSurfaceContainer" app:backgroundTint="?attr/colorSurfaceContainer"
app:icon="@drawable/ic_reduce" app:icon="@drawable/ic_reduce"
app:iconGravity="textStart" app:iconGravity="textStart"
@@ -88,7 +87,6 @@
android:layout_weight="3" android:layout_weight="3"
android:minWidth="64dp" android:minWidth="64dp"
android:contentDescription="@string/plus" android:contentDescription="@string/plus"
android:elevation="4dp"
app:backgroundTint="?attr/colorSurfaceContainer" app:backgroundTint="?attr/colorSurfaceContainer"
app:icon="@drawable/ic_add" app:icon="@drawable/ic_add"
app:iconGravity="textStart" app:iconGravity="textStart"
+4
View File
@@ -1305,4 +1305,8 @@
<string name="read_type_long">长按设置为全局默认模式</string> <string name="read_type_long">长按设置为全局默认模式</string>
<string name="read_slider_mode">滑动条显示样式</string> <string name="read_slider_mode">滑动条显示样式</string>
<string name="bookshelf_update_limit">书架更新数量限制</string> <string name="bookshelf_update_limit">书架更新数量限制</string>
<string name="text_shadow_x">X轴距离</string>
<string name="text_shadow_y">Y轴距离</string>
<string name="text_shadow_radius">阴影半径</string>
<string name="text_shadow_color">阴影颜色</string>
</resources> </resources>
+4
View File
@@ -1306,4 +1306,8 @@
<string name="read_type_long">长按设置为全局默认模式</string> <string name="read_type_long">长按设置为全局默认模式</string>
<string name="read_slider_mode">滑动条显示样式</string> <string name="read_slider_mode">滑动条显示样式</string>
<string name="bookshelf_update_limit">书架更新数量限制</string> <string name="bookshelf_update_limit">书架更新数量限制</string>
<string name="text_shadow_x">X轴距离</string>
<string name="text_shadow_y">Y轴距离</string>
<string name="text_shadow_radius">阴影半径</string>
<string name="text_shadow_color">阴影颜色</string>
</resources> </resources>