pull/32/head
gedoor 6 years ago
parent 128421dfc5
commit 7b77644b4b
  1. 8
      app/src/main/java/io/legado/app/ui/main/booksource/BookSourceFragment.kt

@ -33,6 +33,7 @@ class BookSourceFragment : BaseFragment(R.layout.fragment_book_source), BookSour
setSupportToolbar(toolbar)
initRecyclerView()
initDataObservers()
initSearchView()
}
override fun onCompatCreateOptionsMenu(menu: Menu) {
@ -59,6 +60,13 @@ class BookSourceFragment : BaseFragment(R.layout.fragment_book_source), BookSour
ItemTouchHelper(itemTouchCallback).attachToRecyclerView(recycler_view)
}
private fun initSearchView() {
search_view.visibility = View.VISIBLE
search_view.onActionViewExpanded()
search_view.queryHint = getString(R.string.search_book_source)
search_view.clearFocus()
}
private fun initDataObservers() {
bookSourceLiveDate?.removeObservers(viewLifecycleOwner)
bookSourceLiveDate = LivePagedListBuilder(App.db.bookSourceDao().observeAll(), 30).build()

Loading…
Cancel
Save