diff --git a/app/src/main/java/io/legado/app/ui/widget/BadgeView.kt b/app/src/main/java/io/legado/app/ui/widget/BadgeView.kt index b644ad5fb..3f1572164 100644 --- a/app/src/main/java/io/legado/app/ui/widget/BadgeView.kt +++ b/app/src/main/java/io/legado/app/ui/widget/BadgeView.kt @@ -36,6 +36,7 @@ class BadgeView @JvmOverloads constructor( text = text } private var radius: Float = 0.toFloat() + private var flatangle: Boolean val badgeCount: Int? get() { @@ -77,6 +78,8 @@ class BadgeView @JvmOverloads constructor( val typedArray = context.obtainStyledAttributes(attrs, R.styleable.BadgeView) val radios = typedArray.getDimensionPixelOffset(R.styleable.BadgeView_bv_radius, 8) + flatangle = + typedArray.getBoolean(R.styleable.BadgeView_up_flat_angle, false) typedArray.recycle() if (layoutParams !is LayoutParams) { @@ -111,6 +114,7 @@ class BadgeView @JvmOverloads constructor( val radius = dip2Px(dipRadius).toFloat() val radiusArray = floatArrayOf(radius, radius, radius, radius, radius, radius, radius, radius) + if (flatangle) { radiusArray.fill(0f, 0, 3) } val roundRect = RoundRectShape(radiusArray, null, null) val bgDrawable = ShapeDrawable(roundRect) diff --git a/app/src/main/res/layout/item_bookshelf_grid.xml b/app/src/main/res/layout/item_bookshelf_grid.xml index ca639edd4..20d5ab3e2 100644 --- a/app/src/main/res/layout/item_bookshelf_grid.xml +++ b/app/src/main/res/layout/item_bookshelf_grid.xml @@ -56,6 +56,7 @@ android:includeFontPadding="false" android:singleLine="true" app:bv_radius="1dp" + app:up_flat_angle="true" app:layout_constraintLeft_toLeftOf="@id/iv_cover" app:layout_constraintBottom_toBottomOf="@id/iv_cover" tools:ignore="RtlHardcoded" /> diff --git a/app/src/main/res/values/attrs.xml b/app/src/main/res/values/attrs.xml index de2fe5dc5..297ba1065 100644 --- a/app/src/main/res/values/attrs.xml +++ b/app/src/main/res/values/attrs.xml @@ -143,5 +143,6 @@ + \ No newline at end of file