pull/51/head
kunfei 6 years ago
parent 1dbe0fdb34
commit bc3b52d44b
  1. 19
      app/src/main/java/io/legado/app/ui/main/bookshelf/books/BooksFragment.kt

@ -70,18 +70,13 @@ class BooksFragment : VMBaseFragment<BooksViewModel>(R.layout.fragment_books),
activityViewModel.upChapterList() activityViewModel.upChapterList()
} }
val bookshelfLayout = getPrefInt(PreferKey.bookshelfLayout) val bookshelfLayout = getPrefInt(PreferKey.bookshelfLayout)
rv_bookshelf.layoutManager = if (bookshelfLayout == 0) {
if (bookshelfLayout == 0) { rv_bookshelf.layoutManager = LinearLayoutManager(context)
LinearLayoutManager(context) booksAdapter = BooksAdapterList(requireContext(), this)
} else { } else {
GridLayoutManager(context, bookshelfLayout) rv_bookshelf.layoutManager = GridLayoutManager(context, bookshelfLayout)
} booksAdapter = BooksAdapterGrid(requireContext(), this)
booksAdapter = }
if (bookshelfLayout == 0) {
BooksAdapterList(requireContext(), this)
} else {
BooksAdapterGrid(requireContext(), this)
}
rv_bookshelf.adapter = booksAdapter rv_bookshelf.adapter = booksAdapter
} }

Loading…
Cancel
Save