pull/32/head
kunfei 5 years ago
parent 8a4a1b1b14
commit d01b16627a
  1. 19
      app/src/main/java/io/legado/app/ui/main/bookshelf/BookshelfFragment.kt
  2. 40
      app/src/main/res/menu/main_bookshelf.xml

@ -1,8 +1,8 @@
package io.legado.app.ui.main.bookshelf package io.legado.app.ui.main.bookshelf
import android.os.Bundle import android.os.Bundle
import android.util.Log
import android.view.Menu import android.view.Menu
import android.view.MenuItem
import android.view.View import android.view.View
import android.widget.EditText import android.widget.EditText
import androidx.appcompat.widget.SearchView 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.noButton
import io.legado.app.lib.dialogs.yesButton import io.legado.app.lib.dialogs.yesButton
import io.legado.app.lib.theme.ATH 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.lib.theme.accentColor
import io.legado.app.ui.bookshelf.BookshelfActivity import io.legado.app.ui.bookshelf.BookshelfActivity
import io.legado.app.ui.search.SearchActivity import io.legado.app.ui.search.SearchActivity
import io.legado.app.utils.applyTint import io.legado.app.utils.*
import io.legado.app.utils.getViewModel
import io.legado.app.utils.requestInputMethod
import io.legado.app.utils.visible
import kotlinx.android.synthetic.main.dialog_edittext.view.* import kotlinx.android.synthetic.main.dialog_edittext.view.*
import kotlinx.android.synthetic.main.fragment_bookshelf.* import kotlinx.android.synthetic.main.fragment_bookshelf.*
import kotlinx.android.synthetic.main.view_title_bar.* import kotlinx.android.synthetic.main.view_title_bar.*
@ -50,14 +46,21 @@ class BookshelfFragment : VMBaseFragment<BookshelfViewModel>(R.layout.fragment_b
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
setSupportToolbar(toolbar) setSupportToolbar(toolbar)
initSearchView() // initSearchView()
initRecyclerView() initRecyclerView()
initBookGroupData() initBookGroupData()
initBookshelfData() initBookshelfData()
} }
override fun onCompatCreateOptionsMenu(menu: Menu) { 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<SearchActivity>()
}
} }
private fun initSearchView() { private fun initSearchView() {

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/action_search"
android:icon="@drawable/ic_search"
android:title="@string/search"
app:showAsAction="ifRoom" />
<item
android:id="@+id/action_add_local"
android:icon="@drawable/ic_add"
android:title="@string/book_local"
app:showAsAction="never" />
<item
android:id="@+id/action_add_url"
android:icon="@drawable/ic_add_online"
android:title="@string/add_url"
app:showAsAction="never" />
<item
android:id="@+id/action_download_all"
android:icon="@drawable/ic_download_line"
android:title="@string/download_all"
app:showAsAction="never" />
<item
android:id="@+id/action_list_grid"
android:icon="@drawable/ic_view_quilt"
android:title="@string/action_list_grid"
app:showAsAction="never" />
<item
android:id="@+id/action_arrange_bookshelf"
android:icon="@drawable/ic_arrange"
android:title="@string/arrange_bookshelf"
app:showAsAction="never" />
</menu>
Loading…
Cancel
Save