diff --git a/app/src/main/java/io/legado/app/ui/widget/LabelsBar.kt b/app/src/main/java/io/legado/app/ui/widget/LabelsBar.kt index 2d830ca55..a2f354772 100644 --- a/app/src/main/java/io/legado/app/ui/widget/LabelsBar.kt +++ b/app/src/main/java/io/legado/app/ui/widget/LabelsBar.kt @@ -38,7 +38,7 @@ class LabelsBar(context: Context, attrs: AttributeSet?) : LinearLayout(context, val tv = if (unUsedViews.isEmpty()) { AccentBgTextView(context, null).apply { setPadding(3.dp, 0, 3.dp, 0) - setRadios(2) + setRadius(2) val lp = LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT) lp.setMargins(0, 0, 2.dp, 0) layoutParams = lp diff --git a/app/src/main/java/io/legado/app/ui/widget/text/AccentBgTextView.kt b/app/src/main/java/io/legado/app/ui/widget/text/AccentBgTextView.kt index 6f48e81af..b2dcc2578 100644 --- a/app/src/main/java/io/legado/app/ui/widget/text/AccentBgTextView.kt +++ b/app/src/main/java/io/legado/app/ui/widget/text/AccentBgTextView.kt @@ -14,31 +14,31 @@ import io.legado.app.utils.getCompatColor class AccentBgTextView(context: Context, attrs: AttributeSet?) : AppCompatTextView(context, attrs) { - private var radios = 0 + private var radius = 0 init { val typedArray = context.obtainStyledAttributes(attrs, R.styleable.AccentBgTextView) - radios = typedArray.getDimensionPixelOffset(R.styleable.AccentBgTextView_radius, radios) + radius = typedArray.getDimensionPixelOffset(R.styleable.AccentBgTextView_radius, radius) typedArray.recycle() upBackground() setTextColor(Color.WHITE) } - fun setRadios(radio: Int) { - this.radios = radio.dp + fun setRadius(radius: Int) { + this.radius = radius.dp upBackground() } private fun upBackground() { background = if (isInEditMode) { Selector.shapeBuild() - .setCornerRadius(radios) + .setCornerRadius(radius) .setDefaultBgColor(context.getCompatColor(R.color.colorAccent)) .setPressedBgColor(ColorUtils.darkenColor(context.getCompatColor(R.color.colorAccent))) .create() } else { Selector.shapeBuild() - .setCornerRadius(radios) + .setCornerRadius(radius) .setDefaultBgColor(ThemeStore.accentColor(context)) .setPressedBgColor(ColorUtils.darkenColor(ThemeStore.accentColor(context))) .create() diff --git a/app/src/main/java/io/legado/app/ui/widget/text/StrokeTextView.kt b/app/src/main/java/io/legado/app/ui/widget/text/StrokeTextView.kt index df4da33ea..3fa0544d3 100644 --- a/app/src/main/java/io/legado/app/ui/widget/text/StrokeTextView.kt +++ b/app/src/main/java/io/legado/app/ui/widget/text/StrokeTextView.kt @@ -12,10 +12,24 @@ import io.legado.app.utils.getCompatColor open class StrokeTextView(context: Context, attrs: AttributeSet?) : AppCompatTextView(context, attrs) { + private var radius = 1.dp + init { + val typedArray = context.obtainStyledAttributes(attrs, R.styleable.StrokeTextView) + radius = typedArray.getDimensionPixelOffset(R.styleable.StrokeTextView_radius, radius) + typedArray.recycle() + upBackground() + } + + fun setRadius(radius: Int) { + this.radius = radius.dp + upBackground() + } + + private fun upBackground() { if (isInEditMode) { background = Selector.shapeBuild() - .setCornerRadius(1.dp) + .setCornerRadius(radius) .setStrokeWidth(1.dp) .setDisabledStrokeColor(context.getCompatColor(R.color.md_grey_500)) .setDefaultStrokeColor(context.getCompatColor(R.color.tv_text_secondary)) @@ -31,7 +45,7 @@ open class StrokeTextView(context: Context, attrs: AttributeSet?) : ) } else { background = Selector.shapeBuild() - .setCornerRadius(1.dp) + .setCornerRadius(radius) .setStrokeWidth(1.dp) .setDisabledStrokeColor(context.getCompatColor(R.color.md_grey_500)) .setDefaultStrokeColor(ThemeStore.textColorSecondary(context)) diff --git a/app/src/main/res/layout/dialog_read_book_style.xml b/app/src/main/res/layout/dialog_read_book_style.xml index da110908f..4adff8b72 100644 --- a/app/src/main/res/layout/dialog_read_book_style.xml +++ b/app/src/main/res/layout/dialog_read_book_style.xml @@ -29,7 +29,8 @@ android:paddingBottom="4dp" android:text="@string/title" android:gravity="center" - android:textSize="14sp" /> + android:textSize="14sp" + app:radius="3dp" /> + android:textSize="14sp" + app:radius="3dp" /> + android:textSize="14sp" + app:radius="3dp" /> + android:textSize="14sp" + app:radius="3dp" /> + android:textSize="14sp" + app:radius="3dp" /> + android:textSize="14sp" + app:radius="3dp" /> + + + +