aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2019-03-07 18:18:10 -0500
committerAllan Wang <me@allanwang.ca>2019-03-07 18:18:10 -0500
commit7b5df27ea3051676ca29e5960d72a36eebdcde03 (patch)
tree3cb252d5a9501440510b29ad993137d8099bab30
parentadf9f2f6f23de17aae51435f792de16a0680f286 (diff)
downloadfrost-7b5df27ea3051676ca29e5960d72a36eebdcde03.tar.gz
frost-7b5df27ea3051676ca29e5960d72a36eebdcde03.tar.bz2
frost-7b5df27ea3051676ca29e5960d72a36eebdcde03.zip
Set page limit based on tab count
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt6
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 ca30401a..1f96f076 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/BaseMainActivity.kt
@@ -71,7 +71,6 @@ import com.pitchedapps.frost.contracts.MainActivityContract
import com.pitchedapps.frost.contracts.VideoViewHolder
import com.pitchedapps.frost.db.CookieDao
import com.pitchedapps.frost.db.FbTabDao
-import com.pitchedapps.frost.db.TAB_COUNT
import com.pitchedapps.frost.db.currentCookie
import com.pitchedapps.frost.db.selectAll
import com.pitchedapps.frost.enums.MainActivityLayout
@@ -162,12 +161,13 @@ abstract class BaseMainActivity : BaseActivity(), MainActivityContract,
}
setSupportActionBar(toolbar)
viewPager.adapter = adapter
- viewPager.offscreenPageLimit = TAB_COUNT
tabs.setBackgroundColor(Prefs.mainActivityLayout.backgroundColor())
onNestedCreate(savedInstanceState)
L.i { "Main finished loading UI in ${System.currentTimeMillis() - start} ms" }
launch {
- adapter.setPages(tabDao.selectAll())
+ val tabs = tabDao.selectAll()
+ adapter.setPages(tabs)
+ viewPager.offscreenPageLimit = tabs.size
}
controlWebview = WebView(this)
if (BuildConfig.VERSION_CODE > Prefs.versionCode) {