From d01b16627a5d3b4b2f02187ee98f0432a4ddcd83 Mon Sep 17 00:00:00 2001 From: kunfei Date: Mon, 5 Aug 2019 09:34:42 +0800 Subject: [PATCH] up --- .../ui/main/bookshelf/BookshelfFragment.kt | 19 +++++---- app/src/main/res/menu/main_bookshelf.xml | 40 +++++++++++++++++++ 2 files changed, 51 insertions(+), 8 deletions(-) create mode 100644 app/src/main/res/menu/main_bookshelf.xml diff --git a/app/src/main/java/io/legado/app/ui/main/bookshelf/BookshelfFragment.kt b/app/src/main/java/io/legado/app/ui/main/bookshelf/BookshelfFragment.kt index 24b67a9f2..0b014304a 100644 --- a/app/src/main/java/io/legado/app/ui/main/bookshelf/BookshelfFragment.kt +++ b/app/src/main/java/io/legado/app/ui/main/bookshelf/BookshelfFragment.kt @@ -1,8 +1,8 @@ package io.legado.app.ui.main.bookshelf import android.os.Bundle -import android.util.Log import android.view.Menu +import android.view.MenuItem import android.view.View import android.widget.EditText import androidx.appcompat.widget.SearchView @@ -22,14 +22,10 @@ import io.legado.app.lib.dialogs.customView import io.legado.app.lib.dialogs.noButton import io.legado.app.lib.dialogs.yesButton import io.legado.app.lib.theme.ATH -import io.legado.app.lib.theme.ThemeStore import io.legado.app.lib.theme.accentColor import io.legado.app.ui.bookshelf.BookshelfActivity import io.legado.app.ui.search.SearchActivity -import io.legado.app.utils.applyTint -import io.legado.app.utils.getViewModel -import io.legado.app.utils.requestInputMethod -import io.legado.app.utils.visible +import io.legado.app.utils.* import kotlinx.android.synthetic.main.dialog_edittext.view.* import kotlinx.android.synthetic.main.fragment_bookshelf.* import kotlinx.android.synthetic.main.view_title_bar.* @@ -50,14 +46,21 @@ class BookshelfFragment : VMBaseFragment(R.layout.fragment_b override fun onViewCreated(view: View, savedInstanceState: Bundle?) { setSupportToolbar(toolbar) - initSearchView() +// initSearchView() initRecyclerView() initBookGroupData() initBookshelfData() } override fun onCompatCreateOptionsMenu(menu: Menu) { - menuInflater.inflate(R.menu.bookshelf, menu) + menuInflater.inflate(R.menu.main_bookshelf, menu) + } + + override fun onCompatOptionsItemSelected(item: MenuItem) { + super.onCompatOptionsItemSelected(item) + when (item.itemId) { + R.id.action_search -> startActivity() + } } private fun initSearchView() { diff --git a/app/src/main/res/menu/main_bookshelf.xml b/app/src/main/res/menu/main_bookshelf.xml new file mode 100644 index 000000000..6c69069c1 --- /dev/null +++ b/app/src/main/res/menu/main_bookshelf.xml @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + \ No newline at end of file