书架动画与性能优化 #291
This commit is contained in:
@@ -187,9 +187,11 @@ class BooksFragment() : BaseFragment(R.layout.fragment_books),
|
||||
|
||||
fun upBookSort(sort: Int) {
|
||||
if (!isAdded || view == null) return
|
||||
arguments?.putInt("bookSort", sort)
|
||||
bookSort = sort
|
||||
upRecyclerData()
|
||||
binding.root.post {
|
||||
arguments?.putInt("bookSort", sort)
|
||||
bookSort = sort
|
||||
upRecyclerData()
|
||||
}
|
||||
}
|
||||
|
||||
fun setEnableRefresh(enable: Boolean) {
|
||||
@@ -246,6 +248,7 @@ class BooksFragment() : BaseFragment(R.layout.fragment_books),
|
||||
binding.emptyView.isGone = list.isNotEmpty()
|
||||
binding.refreshLayout.isEnabled = enableRefresh && list.isNotEmpty()
|
||||
booksAdapter.setItems(list)
|
||||
delay(100)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-2
@@ -18,8 +18,7 @@ abstract class BaseBooksAdapter<VB : ViewBinding>(context: Context) :
|
||||
object : DiffUtil.ItemCallback<Book>() {
|
||||
|
||||
override fun areItemsTheSame(oldItem: Book, newItem: Book): Boolean {
|
||||
return oldItem.bookUrl == newItem.bookUrl &&
|
||||
oldItem.durChapterTime == newItem.durChapterTime
|
||||
return oldItem.bookUrl == newItem.bookUrl
|
||||
}
|
||||
|
||||
override fun areContentsTheSame(oldItem: Book, newItem: Book): Boolean {
|
||||
|
||||
-1
@@ -24,7 +24,6 @@ class BooksAdapterGrid(context: Context, private val callBack: CallBack) :
|
||||
item: Book,
|
||||
payloads: MutableList<Any>
|
||||
) = binding.run {
|
||||
binding.cdCover.transitionName = "book_${item.bookUrl}"
|
||||
if (payloads.isEmpty()) {
|
||||
tvName.text = item.name
|
||||
ivCover.load(item.getDisplayCover(), item.name, item.author, false, item.origin)
|
||||
|
||||
-1
@@ -23,7 +23,6 @@ class BooksAdapterGridCompact(context: Context, private val callBack: CallBack)
|
||||
item: Book,
|
||||
payloads: MutableList<Any>
|
||||
) = binding.run {
|
||||
binding.cvContent.transitionName = "book_${item.bookUrl}"
|
||||
if (payloads.isEmpty()) {
|
||||
tvName.text = item.name
|
||||
ivCover.load(item.getDisplayCover(), item.name, item.author, false, item.origin)
|
||||
|
||||
-1
@@ -24,7 +24,6 @@ class BooksAdapterGridCover(context: Context, private val callBack: CallBack) :
|
||||
item: Book,
|
||||
payloads: MutableList<Any>
|
||||
) = binding.run {
|
||||
binding.cvContent.transitionName = "book_${item.bookUrl}"
|
||||
if (payloads.isEmpty()) {
|
||||
tvName.gone()
|
||||
ivCover.load(item.getDisplayCover(), item.name, item.author, false, item.origin)
|
||||
|
||||
-1
@@ -33,7 +33,6 @@ class BooksAdapterList(
|
||||
item: Book,
|
||||
payloads: MutableList<Any>
|
||||
) = binding.run {
|
||||
binding.cdCover.transitionName = "book_${item.bookUrl}"
|
||||
if (payloads.isEmpty()) {
|
||||
tvName.text = item.name
|
||||
tvAuthor.text = item.author
|
||||
|
||||
-1
@@ -34,7 +34,6 @@ class BooksAdapterListCompact(
|
||||
item: Book,
|
||||
payloads: MutableList<Any>
|
||||
) = binding.run {
|
||||
binding.cdCover.transitionName = "book_${item.bookUrl}"
|
||||
if (payloads.isEmpty()) {
|
||||
tvName.text = item.name
|
||||
tvAuthor.text =
|
||||
|
||||
Reference in New Issue
Block a user