|
|
@ -1,6 +1,8 @@ |
|
|
|
package io.legado.app.ui.main.rss |
|
|
|
package io.legado.app.ui.main.rss |
|
|
|
|
|
|
|
|
|
|
|
import android.os.Bundle |
|
|
|
import android.os.Bundle |
|
|
|
|
|
|
|
import android.view.Menu |
|
|
|
|
|
|
|
import android.view.MenuItem |
|
|
|
import android.view.View |
|
|
|
import android.view.View |
|
|
|
import androidx.lifecycle.Observer |
|
|
|
import androidx.lifecycle.Observer |
|
|
|
import androidx.recyclerview.widget.GridLayoutManager |
|
|
|
import androidx.recyclerview.widget.GridLayoutManager |
|
|
@ -8,7 +10,10 @@ import io.legado.app.App |
|
|
|
import io.legado.app.R |
|
|
|
import io.legado.app.R |
|
|
|
import io.legado.app.base.BaseFragment |
|
|
|
import io.legado.app.base.BaseFragment |
|
|
|
import io.legado.app.lib.theme.ATH |
|
|
|
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.fragment_rss.* |
|
|
|
|
|
|
|
import kotlinx.android.synthetic.main.view_title_bar.* |
|
|
|
|
|
|
|
|
|
|
|
class RssFragment : BaseFragment(R.layout.fragment_rss), |
|
|
|
class RssFragment : BaseFragment(R.layout.fragment_rss), |
|
|
|
RssAdapter.CallBack { |
|
|
|
RssAdapter.CallBack { |
|
|
@ -16,10 +21,22 @@ class RssFragment : BaseFragment(R.layout.fragment_rss), |
|
|
|
private lateinit var adapter: RssAdapter |
|
|
|
private lateinit var adapter: RssAdapter |
|
|
|
|
|
|
|
|
|
|
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { |
|
|
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { |
|
|
|
|
|
|
|
setSupportToolbar(toolbar) |
|
|
|
initRecyclerView() |
|
|
|
initRecyclerView() |
|
|
|
initData() |
|
|
|
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() { |
|
|
|
private fun initRecyclerView() { |
|
|
|
ATH.applyEdgeEffectColor(recycler_view) |
|
|
|
ATH.applyEdgeEffectColor(recycler_view) |
|
|
|
adapter = RssAdapter(requireContext(), this) |
|
|
|
adapter = RssAdapter(requireContext(), this) |
|
|
|