diff options
author | Allan Wang <me@allanwang.ca> | 2019-03-07 19:01:30 -0500 |
---|---|---|
committer | Allan Wang <me@allanwang.ca> | 2019-03-07 19:01:30 -0500 |
commit | 0f500024a3b4196623dba9ef75e7f604bec32040 (patch) | |
tree | 4badd96f6e3fe87ceaa05551e290f8c5b06b206f /app | |
parent | 2056d9cb72ef8088a6993cbbb48d5bbb41ffddf2 (diff) | |
download | frost-0f500024a3b4196623dba9ef75e7f604bec32040.tar.gz frost-0f500024a3b4196623dba9ef75e7f604bec32040.tar.bz2 frost-0f500024a3b4196623dba9ef75e7f604bec32040.zip |
Move viewpager page setup to adapter
Diffstat (limited to 'app')
-rw-r--r-- | app/src/main/kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt index 1f96f076..458e97c9 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt @@ -32,6 +32,7 @@ import android.webkit.WebView import android.widget.FrameLayout import androidx.annotation.StringRes import androidx.coordinatorlayout.widget.CoordinatorLayout +import androidx.core.view.size import androidx.fragment.app.Fragment import androidx.fragment.app.FragmentPagerAdapter import ca.allanwang.kau.searchview.SearchItem @@ -165,9 +166,7 @@ abstract class BaseMainActivity : BaseActivity(), MainActivityContract, onNestedCreate(savedInstanceState) L.i { "Main finished loading UI in ${System.currentTimeMillis() - start} ms" } launch { - val tabs = tabDao.selectAll() - adapter.setPages(tabs) - viewPager.offscreenPageLimit = tabs.size + adapter.setPages(tabDao.selectAll()) } controlWebview = WebView(this) if (BuildConfig.VERSION_CODE > Prefs.versionCode) { @@ -551,6 +550,7 @@ abstract class BaseMainActivity : BaseActivity(), MainActivityContract, } lastPosition = 0 viewPager.setCurrentItem(0, false) + viewPager.offscreenPageLimit = pages.size viewPager.post { if (!fragmentChannel.isClosedForSend) fragmentChannel.offer(0) |