diff --git a/app/src/main/java/io/legado/app/ui/rss/article/RssSortActivity.kt b/app/src/main/java/io/legado/app/ui/rss/article/RssSortActivity.kt index eb3f34b9f..81947f41b 100644 --- a/app/src/main/java/io/legado/app/ui/rss/article/RssSortActivity.kt +++ b/app/src/main/java/io/legado/app/ui/rss/article/RssSortActivity.kt @@ -1,3 +1,5 @@ +@file:Suppress("DEPRECATION") + package io.legado.app.ui.rss.article import android.content.Intent @@ -7,8 +9,7 @@ import android.view.MenuItem import androidx.activity.result.contract.ActivityResultContracts import androidx.activity.viewModels import androidx.fragment.app.Fragment -import androidx.viewpager2.adapter.FragmentStateAdapter -import com.google.android.material.tabs.TabLayoutMediator +import androidx.fragment.app.FragmentStatePagerAdapter import io.legado.app.R import io.legado.app.base.VMBaseActivity import io.legado.app.databinding.ActivityRssArtivlesBinding @@ -20,9 +21,8 @@ class RssSortActivity : VMBaseActivity() private lateinit var adapter: TabFragmentPageAdapter - private val fragmentMap = hashMapOf() + private val fragments = linkedMapOf() private val upSourceResult = registerForActivityResult( ActivityResultContracts.StartActivityForResult() ) { @@ -40,9 +40,7 @@ class RssSortActivity : VMBaseActivity - tab.text = sorts.keys.elementAt(position) - }.attach() + binding.tabLayout.setupWithViewPager(binding.viewPager) viewModel.titleLiveData.observe(this, { binding.titleBar.title = it }) @@ -78,10 +76,11 @@ class RssSortActivity : VMBaseActivity -