diff --git a/app/src/main/java/io/legado/app/ui/main/bookshelf/BookshelfAdapter.kt b/app/src/main/java/io/legado/app/ui/main/bookshelf/BookshelfAdapter.kt index c4176f78d..d3ba217a0 100644 --- a/app/src/main/java/io/legado/app/ui/main/bookshelf/BookshelfAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/main/bookshelf/BookshelfAdapter.kt @@ -3,6 +3,7 @@ package io.legado.app.ui.main.bookshelf import androidx.fragment.app.Fragment import androidx.viewpager2.adapter.FragmentStateAdapter import io.legado.app.data.entities.BookGroup +import io.legado.app.ui.main.bookshelf.books.BooksFragment class BookshelfAdapter(fragment: Fragment, val callBack: CallBack) : diff --git a/app/src/main/java/io/legado/app/ui/main/bookshelf/BooksAdapter.kt b/app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksAdapter.kt similarity index 98% rename from app/src/main/java/io/legado/app/ui/main/bookshelf/BooksAdapter.kt rename to app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksAdapter.kt index 75b0f7787..e6ca5bc6e 100644 --- a/app/src/main/java/io/legado/app/ui/main/bookshelf/BooksAdapter.kt +++ b/app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksAdapter.kt @@ -1,4 +1,4 @@ -package io.legado.app.ui.main.bookshelf +package io.legado.app.ui.main.bookshelf.books import android.content.Context import io.legado.app.R @@ -16,7 +16,6 @@ import org.jetbrains.anko.sdk27.listeners.onLongClick class BooksAdapter(context: Context, private val callBack: CallBack) : SimpleRecyclerAdapter(context, R.layout.item_bookshelf_list) { - override fun convert(holder: ItemViewHolder, item: Book, payloads: MutableList) { with(holder.itemView) { if (payloads.isEmpty()) { diff --git a/app/src/main/java/io/legado/app/ui/main/bookshelf/BooksDiffCallBack.kt b/app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksDiffCallBack.kt similarity index 96% rename from app/src/main/java/io/legado/app/ui/main/bookshelf/BooksDiffCallBack.kt rename to app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksDiffCallBack.kt index c5b7d7c03..45ad277f2 100644 --- a/app/src/main/java/io/legado/app/ui/main/bookshelf/BooksDiffCallBack.kt +++ b/app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksDiffCallBack.kt @@ -1,4 +1,4 @@ -package io.legado.app.ui.main.bookshelf +package io.legado.app.ui.main.bookshelf.books import androidx.recyclerview.widget.DiffUtil import io.legado.app.data.entities.Book diff --git a/app/src/main/java/io/legado/app/ui/main/bookshelf/BooksFragment.kt b/app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksFragment.kt similarity index 92% rename from app/src/main/java/io/legado/app/ui/main/bookshelf/BooksFragment.kt rename to app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksFragment.kt index 1cf3e17de..4e7a3df15 100644 --- a/app/src/main/java/io/legado/app/ui/main/bookshelf/BooksFragment.kt +++ b/app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksFragment.kt @@ -1,4 +1,4 @@ -package io.legado.app.ui.main.bookshelf +package io.legado.app.ui.main.bookshelf.books import android.os.Bundle import android.view.View @@ -75,7 +75,10 @@ class BooksFragment : VMBaseFragment(R.layout.fragment_books), this.setDrawable(it) } }) - booksAdapter = BooksAdapter(requireContext(), this) + booksAdapter = BooksAdapter( + requireContext(), + this + ) rv_bookshelf.adapter = booksAdapter } @@ -89,7 +92,12 @@ class BooksFragment : VMBaseFragment(R.layout.fragment_books), } bookshelfLiveData?.observe(this, Observer { val diffResult = - DiffUtil.calculateDiff(BooksDiffCallBack(booksAdapter.getItems(), it)) + DiffUtil.calculateDiff( + BooksDiffCallBack( + booksAdapter.getItems(), + it + ) + ) booksAdapter.setItems(it, false) diffResult.dispatchUpdatesTo(booksAdapter) }) diff --git a/app/src/main/java/io/legado/app/ui/main/bookshelf/BooksViewModel.kt b/app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksViewModel.kt similarity index 76% rename from app/src/main/java/io/legado/app/ui/main/bookshelf/BooksViewModel.kt rename to app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksViewModel.kt index ef6d08fbb..6a7a51da3 100644 --- a/app/src/main/java/io/legado/app/ui/main/bookshelf/BooksViewModel.kt +++ b/app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksViewModel.kt @@ -1,4 +1,4 @@ -package io.legado.app.ui.main.bookshelf +package io.legado.app.ui.main.bookshelf.books import android.app.Application import io.legado.app.base.BaseViewModel