diff --git a/app/src/main/java/io/legado/app/ui/main/my/MyFragment.kt b/app/src/main/java/io/legado/app/ui/main/my/MyFragment.kt index ff96e01cc..36f2db63b 100644 --- a/app/src/main/java/io/legado/app/ui/main/my/MyFragment.kt +++ b/app/src/main/java/io/legado/app/ui/main/my/MyFragment.kt @@ -36,7 +36,7 @@ class MyFragment : BaseFragment(R.layout.fragment_my_config) { } override fun onCompatCreateOptionsMenu(menu: Menu) { - menuInflater.inflate(R.menu.my_config, menu) + menuInflater.inflate(R.menu.main_my, menu) } override fun onCompatOptionsItemSelected(item: MenuItem) { diff --git a/app/src/main/java/io/legado/app/ui/main/rss/RssFragment.kt b/app/src/main/java/io/legado/app/ui/main/rss/RssFragment.kt index 70df16148..2126b3929 100644 --- a/app/src/main/java/io/legado/app/ui/main/rss/RssFragment.kt +++ b/app/src/main/java/io/legado/app/ui/main/rss/RssFragment.kt @@ -1,6 +1,8 @@ package io.legado.app.ui.main.rss import android.os.Bundle +import android.view.Menu +import android.view.MenuItem import android.view.View import androidx.lifecycle.Observer import androidx.recyclerview.widget.GridLayoutManager @@ -8,7 +10,10 @@ import io.legado.app.App import io.legado.app.R import io.legado.app.base.BaseFragment import io.legado.app.lib.theme.ATH +import io.legado.app.ui.rss.source.RssSourceActivity +import io.legado.app.utils.startActivity import kotlinx.android.synthetic.main.fragment_rss.* +import kotlinx.android.synthetic.main.view_title_bar.* class RssFragment : BaseFragment(R.layout.fragment_rss), RssAdapter.CallBack { @@ -16,10 +21,22 @@ class RssFragment : BaseFragment(R.layout.fragment_rss), private lateinit var adapter: RssAdapter override fun onViewCreated(view: View, savedInstanceState: Bundle?) { + setSupportToolbar(toolbar) initRecyclerView() initData() } + override fun onCompatCreateOptionsMenu(menu: Menu) { + menuInflater.inflate(R.menu.main_rss, menu) + } + + override fun onCompatOptionsItemSelected(item: MenuItem) { + super.onCompatOptionsItemSelected(item) + when (item.itemId) { + R.id.menu_rss_config -> startActivity() + } + } + private fun initRecyclerView() { ATH.applyEdgeEffectColor(recycler_view) adapter = RssAdapter(requireContext(), this) diff --git a/app/src/main/res/menu/my_config.xml b/app/src/main/res/menu/main_my.xml similarity index 100% rename from app/src/main/res/menu/my_config.xml rename to app/src/main/res/menu/main_my.xml diff --git a/app/src/main/res/menu/main_rss.xml b/app/src/main/res/menu/main_rss.xml new file mode 100644 index 000000000..9c051a1d2 --- /dev/null +++ b/app/src/main/res/menu/main_rss.xml @@ -0,0 +1,11 @@ + + + + + + \ No newline at end of file