pull/32/head
kunfei 6 years ago
parent d1f407d4c2
commit c75ba5028d
  1. 4
      app/src/main/java/io/legado/app/ui/main/booksource/BookSourceAdapter.kt
  2. 7
      app/src/main/java/io/legado/app/ui/main/booksource/BookSourceFragment.kt
  3. 3
      app/src/main/res/layout/view_title_bar.xml

@ -57,6 +57,10 @@ class BookSourceAdapter : PagedListAdapter<BookSource, BookSourceAdapter.MyViewH
} }
} }
fun clearSelect() {
checkedList.clear()
}
fun selectAll() { fun selectAll() {
currentList?.let { currentList?.let {
if (checkedList.size == it.size) { if (checkedList.size == it.size) {

@ -86,12 +86,15 @@ class BookSourceFragment : BaseFragment(R.layout.fragment_book_source), BookSour
App.db.bookSourceDao().observeAll() App.db.bookSourceDao().observeAll()
else else
App.db.bookSourceDao().observeSearch(searchKey) App.db.bookSourceDao().observeSearch(searchKey)
bookSourceLiveDate = LivePagedListBuilder(dataFactory, 2000).build() bookSourceLiveDate = LivePagedListBuilder(dataFactory, 50).build()
bookSourceLiveDate?.observe(viewLifecycleOwner, Observer { adapter.submitList(it) }) bookSourceLiveDate?.observe(viewLifecycleOwner, Observer { adapter.submitList(it) })
} }
override fun onQueryTextChange(newText: String?): Boolean { override fun onQueryTextChange(newText: String?): Boolean {
newText?.let { initDataObserve("%$it%") } newText?.let {
adapter.clearSelect()
initDataObserve("%$it%")
}
return false return false
} }

@ -12,6 +12,9 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:visibility="gone" android:visibility="gone"
android:imeOptions="actionSearch"
app:iconifiedByDefault="false"
app:searchIcon="@null"
app:defaultQueryHint="搜索" /> app:defaultQueryHint="搜索" />
</androidx.appcompat.widget.Toolbar> </androidx.appcompat.widget.Toolbar>

Loading…
Cancel
Save