pull/1198/head
gedoor 3 years ago
parent bd4848a7af
commit e4cf02fca7
  1. 5
      app/src/main/java/io/legado/app/ui/main/MainActivity.kt
  2. 9
      app/src/main/java/io/legado/app/ui/main/bookshelf/style2/BookshelfFragment2.kt

@ -136,6 +136,11 @@ class MainActivity : VMBaseActivity<ActivityMainBinding, MainViewModel>(),
binding.viewPagerMain.currentItem = 0 binding.viewPagerMain.currentItem = 0
return true return true
} }
(fragmentMap[getFragmentId(0)] as? BookshelfFragment2)?.let {
if (it.back()) {
return true
}
}
if (System.currentTimeMillis() - exitTime > 2000) { if (System.currentTimeMillis() - exitTime > 2000) {
toastOnUi(R.string.double_click_exit) toastOnUi(R.string.double_click_exit)
exitTime = System.currentTimeMillis() exitTime = System.currentTimeMillis()

@ -140,6 +140,15 @@ class BookshelfFragment2 : BaseBookshelfFragment(R.layout.fragment_bookshelf1),
} }
} }
fun back(): Boolean {
if (groupId != AppConst.bookGroupNoneId) {
groupId = AppConst.bookGroupNoneId
initBooksData()
return true
}
return false
}
override fun onQueryTextSubmit(query: String?): Boolean { override fun onQueryTextSubmit(query: String?): Boolean {
SearchActivity.start(requireContext(), query) SearchActivity.start(requireContext(), query)
return false return false

Loading…
Cancel
Save