From 60771172107552f9ae4823e1a103490782b939bf Mon Sep 17 00:00:00 2001 From: kunfei Date: Sat, 8 Feb 2020 10:31:02 +0800 Subject: [PATCH] delete MainAdapter --- .../java/io/legado/app/ui/main/MainAdapter.kt | 49 ------------------- 1 file changed, 49 deletions(-) delete mode 100644 app/src/main/java/io/legado/app/ui/main/MainAdapter.kt diff --git a/app/src/main/java/io/legado/app/ui/main/MainAdapter.kt b/app/src/main/java/io/legado/app/ui/main/MainAdapter.kt deleted file mode 100644 index 874912da0..000000000 --- a/app/src/main/java/io/legado/app/ui/main/MainAdapter.kt +++ /dev/null @@ -1,49 +0,0 @@ -package io.legado.app.ui.main - -import androidx.fragment.app.Fragment -import androidx.viewpager2.adapter.FragmentStateAdapter -import io.legado.app.help.AppConfig -import io.legado.app.ui.main.bookshelf.BookshelfFragment -import io.legado.app.ui.main.explore.ExploreFragment -import io.legado.app.ui.main.my.MyFragment -import io.legado.app.ui.main.rss.RssFragment - -class MainAdapter(val activity: MainActivity) : FragmentStateAdapter(activity) { - - private val fid1 = 111.toLong() - private val fid2 = 222.toLong() - private val fid3 = 333.toLong() - private val fid4 = 444.toLong() - - private val ids: ArrayList - get() = if (AppConfig.isShowRSS) { - arrayListOf(fid1, fid2, fid3, fid4) - } else { - arrayListOf(fid1, fid2, fid4) - } - - private val createdIds = hashSetOf() - - override fun getItemCount(): Int { - return if (AppConfig.isShowRSS) 4 else 3 - } - - override fun getItemId(position: Int): Long { - return ids[position] - } - - override fun containsItem(itemId: Long): Boolean { - return createdIds.contains(itemId) - } - - override fun createFragment(position: Int): Fragment { - val id = ids[position] - createdIds.add(id) - return when (id) { - fid4 -> MyFragment() - fid3 -> RssFragment() - fid2 -> ExploreFragment() - else -> BookshelfFragment() - } - } -} \ No newline at end of file