优化强调色和文字颜色一样是文字颜色的显示

pull/1835/head
kunfei 3 years ago
parent fe2f4d2c7a
commit d66cace0a7
  1. 23
      app/src/main/java/io/legado/app/ui/widget/text/AccentBgTextView.kt
  2. 2
      app/src/main/res/layout-land/activity_book_info.xml
  3. 2
      app/src/main/res/layout/activity_book_info.xml

@ -23,7 +23,6 @@ class AccentBgTextView @JvmOverloads constructor(
radius = typedArray.getDimensionPixelOffset(R.styleable.AccentBgTextView_radius, radius)
typedArray.recycle()
upBackground()
setTextColor(Color.WHITE)
}
fun setRadius(radius: Int) {
@ -32,18 +31,22 @@ class AccentBgTextView @JvmOverloads constructor(
}
private fun upBackground() {
background = if (isInEditMode) {
Selector.shapeBuild()
.setCornerRadius(radius)
.setDefaultBgColor(context.getCompatColor(R.color.accent))
.setPressedBgColor(ColorUtils.darkenColor(context.getCompatColor(R.color.accent)))
.create()
val accentColor = if (isInEditMode) {
context.getCompatColor(R.color.accent)
} else {
Selector.shapeBuild()
ThemeStore.accentColor(context)
}
background = Selector.shapeBuild()
.setCornerRadius(radius)
.setDefaultBgColor(ThemeStore.accentColor(context))
.setPressedBgColor(ColorUtils.darkenColor(ThemeStore.accentColor(context)))
.setDefaultBgColor(accentColor)
.setPressedBgColor(ColorUtils.darkenColor(accentColor))
.create()
setTextColor(
if (ColorUtils.isColorLight(accentColor)) {
Color.BLACK
} else {
Color.WHITE
}
)
}
}

@ -402,11 +402,9 @@
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/selector_btn_accent_bg"
android:gravity="center"
android:includeFontPadding="false"
android:text="@string/reading"
android:textColor="@color/tv_text_button_nor"
android:textSize="15sp" />
</LinearLayout>

@ -383,11 +383,9 @@
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:background="@drawable/selector_btn_accent_bg"
android:gravity="center"
android:includeFontPadding="false"
android:text="@string/reading"
android:textColor="@color/tv_text_button_nor"
android:textSize="15sp" />
</LinearLayout>

Loading…
Cancel
Save