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 88c59221b..7d3d21755 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 @@ -2,16 +2,24 @@ package io.legado.app.ui.main.bookshelf import android.os.Bundle import android.util.Log +import android.view.MenuItem import android.view.View +import androidx.appcompat.widget.Toolbar import androidx.fragment.app.Fragment import io.legado.app.R +import kotlinx.android.synthetic.main.view_titlebar.* -class BookshelfFragment : Fragment(R.layout.fragment_bookshelf) { +class BookshelfFragment : Fragment(R.layout.fragment_bookshelf), Toolbar.OnMenuItemClickListener { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) Log.e("TAG", "BookshelfFragment") + toolbar.inflateMenu(R.menu.bookshelf) + toolbar.setOnMenuItemClickListener(this) + } + override fun onMenuItemClick(item: MenuItem?): Boolean { + return false } diff --git a/app/src/main/java/io/legado/app/ui/main/booksource/BookSourceFragment.kt b/app/src/main/java/io/legado/app/ui/main/booksource/BookSourceFragment.kt index 7f0195ab9..7e00b19c9 100644 --- a/app/src/main/java/io/legado/app/ui/main/booksource/BookSourceFragment.kt +++ b/app/src/main/java/io/legado/app/ui/main/booksource/BookSourceFragment.kt @@ -2,15 +2,24 @@ package io.legado.app.ui.main.booksource import android.os.Bundle import android.util.Log +import android.view.MenuItem import android.view.View +import androidx.appcompat.widget.Toolbar import androidx.fragment.app.Fragment import io.legado.app.R +import kotlinx.android.synthetic.main.view_titlebar.* -class BookSourceFragment : Fragment(R.layout.fragment_book_source) { +class BookSourceFragment : Fragment(R.layout.fragment_book_source), Toolbar.OnMenuItemClickListener { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) Log.e("TAG", "BookSourceFragment") + toolbar.inflateMenu(R.menu.book_source) + toolbar.setOnMenuItemClickListener(this) + } + + override fun onMenuItemClick(item: MenuItem?): Boolean { + return false } } \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/ui/main/findbook/FindBookFragment.kt b/app/src/main/java/io/legado/app/ui/main/findbook/FindBookFragment.kt index ce2140978..3650f62f9 100644 --- a/app/src/main/java/io/legado/app/ui/main/findbook/FindBookFragment.kt +++ b/app/src/main/java/io/legado/app/ui/main/findbook/FindBookFragment.kt @@ -2,15 +2,24 @@ package io.legado.app.ui.main.findbook import android.os.Bundle import android.util.Log +import android.view.MenuItem import android.view.View +import androidx.appcompat.widget.Toolbar import androidx.fragment.app.Fragment import io.legado.app.R +import kotlinx.android.synthetic.main.view_titlebar.* -class FindBookFragment : Fragment(R.layout.fragment_find_book) { +class FindBookFragment : Fragment(R.layout.fragment_find_book), Toolbar.OnMenuItemClickListener { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) Log.e("TAG", "FindBookFragment") + toolbar.inflateMenu(R.menu.find_book) + toolbar.setOnMenuItemClickListener(this) + } + + override fun onMenuItemClick(item: MenuItem?): Boolean { + return false } } \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/ui/main/myconfig/MyConfigFragment.kt b/app/src/main/java/io/legado/app/ui/main/myconfig/MyConfigFragment.kt index 052f1324a..45ca2ee4f 100644 --- a/app/src/main/java/io/legado/app/ui/main/myconfig/MyConfigFragment.kt +++ b/app/src/main/java/io/legado/app/ui/main/myconfig/MyConfigFragment.kt @@ -2,15 +2,24 @@ package io.legado.app.ui.main.myconfig import android.os.Bundle import android.util.Log +import android.view.MenuItem import android.view.View +import androidx.appcompat.widget.Toolbar import androidx.fragment.app.Fragment import io.legado.app.R +import kotlinx.android.synthetic.main.view_titlebar.* -class MyConfigFragment : Fragment(R.layout.fragment_my_config) { +class MyConfigFragment : Fragment(R.layout.fragment_my_config), Toolbar.OnMenuItemClickListener { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) Log.e("TAG", "MyConfigFragment") + toolbar.inflateMenu(R.menu.my_config) + toolbar.setOnMenuItemClickListener(this) + } + + override fun onMenuItemClick(item: MenuItem?): Boolean { + return false } } \ No newline at end of file diff --git a/app/src/main/res/menu/main.xml b/app/src/main/res/menu/book_source.xml similarity index 100% rename from app/src/main/res/menu/main.xml rename to app/src/main/res/menu/book_source.xml diff --git a/app/src/main/res/menu/bookshelf.xml b/app/src/main/res/menu/bookshelf.xml new file mode 100644 index 000000000..8c69ffa8e --- /dev/null +++ b/app/src/main/res/menu/bookshelf.xml @@ -0,0 +1,15 @@ + +
\ No newline at end of file diff --git a/app/src/main/res/menu/find_book.xml b/app/src/main/res/menu/find_book.xml new file mode 100644 index 000000000..ffa80409c --- /dev/null +++ b/app/src/main/res/menu/find_book.xml @@ -0,0 +1,15 @@ + + diff --git a/app/src/main/res/menu/my_config.xml b/app/src/main/res/menu/my_config.xml new file mode 100644 index 000000000..ffa80409c --- /dev/null +++ b/app/src/main/res/menu/my_config.xml @@ -0,0 +1,15 @@ + +