|
|
|
@ -8,22 +8,27 @@ import androidx.lifecycle.Observer |
|
|
|
|
import androidx.recyclerview.widget.GridLayoutManager |
|
|
|
|
import io.legado.app.App |
|
|
|
|
import io.legado.app.R |
|
|
|
|
import io.legado.app.base.BaseFragment |
|
|
|
|
import io.legado.app.base.VMBaseFragment |
|
|
|
|
import io.legado.app.data.entities.RssSource |
|
|
|
|
import io.legado.app.lib.theme.ATH |
|
|
|
|
import io.legado.app.ui.main.MainViewModel |
|
|
|
|
import io.legado.app.ui.rss.article.RssSortActivity |
|
|
|
|
import io.legado.app.ui.rss.favorites.RssFavoritesActivity |
|
|
|
|
import io.legado.app.ui.rss.source.edit.RssSourceEditActivity |
|
|
|
|
import io.legado.app.ui.rss.source.manage.RssSourceActivity |
|
|
|
|
import io.legado.app.ui.rss.source.manage.RssSourceViewModel |
|
|
|
|
import io.legado.app.utils.getViewModel |
|
|
|
|
import io.legado.app.utils.getViewModelOfActivity |
|
|
|
|
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), |
|
|
|
|
class RssFragment : VMBaseFragment<RssSourceViewModel>(R.layout.fragment_rss), |
|
|
|
|
RssAdapter.CallBack { |
|
|
|
|
|
|
|
|
|
private lateinit var adapter: RssAdapter |
|
|
|
|
override val viewModel: RssSourceViewModel |
|
|
|
|
get() = getViewModel(RssSourceViewModel::class.java) |
|
|
|
|
|
|
|
|
|
override fun onFragmentCreated(view: View, savedInstanceState: Bundle?) { |
|
|
|
|
setSupportToolbar(toolbar) |
|
|
|
@ -62,4 +67,16 @@ class RssFragment : BaseFragment(R.layout.fragment_rss), |
|
|
|
|
override fun openRss(rssSource: RssSource) { |
|
|
|
|
startActivity<RssSortActivity>(Pair("url", rssSource.sourceUrl)) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
override fun toTop(rssSource: RssSource) { |
|
|
|
|
viewModel.topSource(rssSource) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
override fun edit(rssSource: RssSource) { |
|
|
|
|
startActivity<RssSourceEditActivity>(Pair("data", rssSource.sourceUrl)) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
override fun del(rssSource: RssSource) { |
|
|
|
|
viewModel.del(rssSource) |
|
|
|
|
} |
|
|
|
|
} |