diff --git a/app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksAdapterGrid.kt b/app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksAdapterGrid.kt index 6bb5509ae..f6761ce78 100644 --- a/app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksAdapterGrid.kt +++ b/app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksAdapterGrid.kt @@ -12,16 +12,13 @@ import kotlinx.android.synthetic.main.item_bookshelf_grid.view.* import org.jetbrains.anko.sdk27.listeners.onClick import org.jetbrains.anko.sdk27.listeners.onLongClick -class BooksAdapterGrid(context: Context, private val span: Int, private val callBack: CallBack) : +class BooksAdapterGrid(context: Context, private val callBack: CallBack) : BooksAdapter(context, R.layout.item_bookshelf_grid) { override fun convert(holder: ItemViewHolder, item: Book, payloads: MutableList) { with(holder.itemView) { if (payloads.isEmpty()) { ATH.applyBackgroundTint(this) - tv_name.textSize = (16 - span).toFloat() - bv_author.textSize = (10 - span).toFloat() - bv_unread.textSize = (10 - span).toFloat() tv_name.text = item.name bv_author.text = item.author item.getDisplayCover()?.let { diff --git a/app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksFragment.kt b/app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksFragment.kt index 3ccb39105..765c06697 100644 --- a/app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksFragment.kt +++ b/app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksFragment.kt @@ -71,7 +71,7 @@ class BooksFragment : BaseFragment(R.layout.fragment_books), booksAdapter = BooksAdapterList(requireContext(), this) } else { rv_bookshelf.layoutManager = GridLayoutManager(context, bookshelfLayout + 2) - booksAdapter = BooksAdapterGrid(requireContext(), bookshelfLayout, this) + booksAdapter = BooksAdapterGrid(requireContext(),this) } rv_bookshelf.adapter = booksAdapter } 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 d9d5e1ee8..a0764724e 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 @@ -74,6 +74,10 @@ class BadgeView @JvmOverloads constructor( } init { + val typedArray = context.obtainStyledAttributes(attrs, R.styleable.BadgeView) + val radios = + typedArray.getDimensionPixelOffset(R.styleable.BadgeView_bv_radius, 8) + if (layoutParams !is LayoutParams) { val layoutParams = LayoutParams( ViewGroup.LayoutParams.WRAP_CONTENT, @@ -88,7 +92,7 @@ class BadgeView @JvmOverloads constructor( //setTypeface(Typeface.DEFAULT_BOLD); setTextSize(TypedValue.COMPLEX_UNIT_SP, 11f) setPadding(dip2Px(5f), dip2Px(1f), dip2Px(5f), dip2Px(1f)) - radius = 8f + radius = radios.toFloat() // set default background setBackground(radius, context.accentColor) diff --git a/app/src/main/res/layout/item_bookshelf_grid.xml b/app/src/main/res/layout/item_bookshelf_grid.xml index 58eb839a2..c36b288c5 100644 --- a/app/src/main/res/layout/item_bookshelf_grid.xml +++ b/app/src/main/res/layout/item_bookshelf_grid.xml @@ -51,19 +51,19 @@ @@ -78,7 +78,7 @@ android:ellipsize="end" android:text="@string/book_name" android:textColor="@color/tv_text_default" - android:textSize="16sp" + android:textSize="12sp" app:layout_constraintLeft_toLeftOf="@+id/iv_cover" app:layout_constraintRight_toRightOf="@+id/iv_cover" app:layout_constraintTop_toBottomOf="@+id/iv_cover" diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml index b873165ff..7534dcab1 100644 --- a/app/src/main/res/values/arrays.xml +++ b/app/src/main/res/values/arrays.xml @@ -40,7 +40,7 @@ @string/layout_grid3 @string/layout_grid4 @string/layout_grid5 - + @string/layout_grid6 diff --git a/app/src/main/res/values/attrs.xml b/app/src/main/res/values/attrs.xml index 0bf3c2f05..de2fe5dc5 100644 --- a/app/src/main/res/values/attrs.xml +++ b/app/src/main/res/values/attrs.xml @@ -140,4 +140,8 @@ + + + + \ No newline at end of file