pull/34/head
kunfei 5 years ago
parent fa74b90275
commit 838e784bcf
  1. 2
      app/src/main/java/io/legado/app/ui/main/my/MyFragment.kt
  2. 17
      app/src/main/java/io/legado/app/ui/main/rss/RssFragment.kt
  3. 0
      app/src/main/res/menu/main_my.xml
  4. 11
      app/src/main/res/menu/main_rss.xml

@ -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) {

@ -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<RssSourceActivity>()
}
}
private fun initRecyclerView() {
ATH.applyEdgeEffectColor(recycler_view)
adapter = RssAdapter(requireContext(), this)

@ -0,0 +1,11 @@
<?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/menu_rss_config"
android:title="@string/setting"
android:icon="@drawable/ic_settings"
app:showAsAction="always" />
</menu>
Loading…
Cancel
Save