|
|
|
@ -12,6 +12,7 @@ import io.legado.app.App |
|
|
|
|
import io.legado.app.R |
|
|
|
|
import io.legado.app.base.VMBaseActivity |
|
|
|
|
import io.legado.app.constant.Bus |
|
|
|
|
import io.legado.app.help.ActivityHelp |
|
|
|
|
import io.legado.app.help.permission.Permissions |
|
|
|
|
import io.legado.app.help.permission.PermissionsCompat |
|
|
|
|
import io.legado.app.lib.dialogs.alert |
|
|
|
@ -103,22 +104,12 @@ class MainActivity : VMBaseActivity<MainViewModel>(R.layout.activity_main), |
|
|
|
|
return super.onKeyUp(keyCode, event) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private inner class TabFragmentPageAdapter internal constructor(fm: FragmentManager) : |
|
|
|
|
FragmentPagerAdapter(fm, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT) { |
|
|
|
|
|
|
|
|
|
override fun getItem(position: Int): Fragment { |
|
|
|
|
return when (position) { |
|
|
|
|
0 -> BookshelfFragment() |
|
|
|
|
1 -> ExploreFragment() |
|
|
|
|
2 -> RssFragment() |
|
|
|
|
else -> MyFragment() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
override fun getCount(): Int { |
|
|
|
|
return 4 |
|
|
|
|
override fun finish() { |
|
|
|
|
if (ActivityHelp.size() > 1) { |
|
|
|
|
moveTaskToBack(true) |
|
|
|
|
} else { |
|
|
|
|
super.finish() |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
override fun observeLiveBus() { |
|
|
|
@ -127,3 +118,20 @@ class MainActivity : VMBaseActivity<MainViewModel>(R.layout.activity_main), |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private class TabFragmentPageAdapter internal constructor(fm: FragmentManager) : |
|
|
|
|
FragmentPagerAdapter(fm, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT) { |
|
|
|
|
|
|
|
|
|
override fun getItem(position: Int): Fragment { |
|
|
|
|
return when (position) { |
|
|
|
|
0 -> BookshelfFragment() |
|
|
|
|
1 -> ExploreFragment() |
|
|
|
|
2 -> RssFragment() |
|
|
|
|
else -> MyFragment() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
override fun getCount(): Int { |
|
|
|
|
return 4 |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|