From 1bfd273ee73f585b838b3dd397fe613135fb1030 Mon Sep 17 00:00:00 2001 From: Administrator Date: Wed, 8 Jan 2020 17:09:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9bookshelf=20grid=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/bookshelf/books/BooksAdapterGrid.kt | 7 +++- .../ui/main/bookshelf/books/BooksFragment.kt | 2 +- .../main/res/layout/item_bookshelf_grid.xml | 38 ++++++++++--------- app/src/main/res/values/arrays.xml | 2 +- 4 files changed, 28 insertions(+), 21 deletions(-) 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 c6d1cbba4..6bb5509ae 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,15 +12,18 @@ 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 callBack: CallBack) : +class BooksAdapterGrid(context: Context, private val span: Int, 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 - tv_author.text = item.author + bv_author.text = item.author item.getDisplayCover()?.let { ImageLoader.load(context, it)//Glide自动识别http://和file:// .placeholder(R.drawable.image_cover_default) 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 fe2363b5c..3ccb39105 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(), this) + booksAdapter = BooksAdapterGrid(requireContext(), bookshelfLayout, this) } rv_bookshelf.adapter = booksAdapter } diff --git a/app/src/main/res/layout/item_bookshelf_grid.xml b/app/src/main/res/layout/item_bookshelf_grid.xml index 4ed7e8158..58eb839a2 100644 --- a/app/src/main/res/layout/item_bookshelf_grid.xml +++ b/app/src/main/res/layout/item_bookshelf_grid.xml @@ -49,13 +49,33 @@ tools:ignore="RtlHardcoded" /> + + + + + + - - \ No newline at end of file diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml index 7534dcab1..b873165ff 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 +