pull/35/head
kunfei 5 years ago
parent 65211b19d5
commit 4b846714d0
  1. 11
      app/src/main/java/io/legado/app/ui/main/bookshelf/BooksFragment.kt
  2. 3
      app/src/main/java/io/legado/app/ui/main/bookshelf/BookshelfFragment.kt

@ -2,6 +2,7 @@ package io.legado.app.ui.main.bookshelf
import android.os.Bundle
import android.view.View
import androidx.core.content.ContextCompat
import androidx.lifecycle.LiveData
import androidx.lifecycle.Observer
import androidx.paging.LivePagedListBuilder
@ -62,11 +63,11 @@ class BooksFragment : VMBaseFragment<BooksViewModel>(R.layout.fragment_books),
}
rv_bookshelf.layoutManager = LinearLayoutManager(context)
rv_bookshelf.addItemDecoration(
DividerItemDecoration(
rv_bookshelf.context,
LinearLayoutManager.VERTICAL
)
)
DividerItemDecoration(requireContext(), DividerItemDecoration.VERTICAL).apply {
ContextCompat.getDrawable(requireContext(), R.drawable.ic_divider)?.let {
this.setDrawable(it)
}
})
booksAdapter = BooksAdapter(this)
rv_bookshelf.adapter = booksAdapter

@ -9,6 +9,7 @@ import android.widget.EditText
import androidx.appcompat.widget.SearchView
import androidx.lifecycle.LiveData
import androidx.lifecycle.Observer
import com.google.android.material.tabs.TabLayout
import com.google.android.material.tabs.TabLayoutMediator
import io.legado.app.App
import io.legado.app.R
@ -62,6 +63,8 @@ class BookshelfFragment : VMBaseFragment<BookshelfViewModel>(R.layout.fragment_b
}
private fun initRecyclerView() {
tab_layout.isTabIndicatorFullWidth = false
tab_layout.tabMode = TabLayout.MODE_SCROLLABLE
ATH.applyEdgeEffectColor(view_pager_bookshelf)
view_pager_bookshelf.adapter = BookshelfAdapter(this, this)
TabLayoutMediator(tab_layout, view_pager_bookshelf) { tab, position ->

Loading…
Cancel
Save