This should fix #144.

This commit is contained in:
Amine Bou 2017-12-07 06:20:15 +01:00
parent 686ec5dd90
commit 059c2991fb

View File

@ -25,6 +25,8 @@ import retrofit2.Response
class ReaderActivity : AppCompatActivity() { class ReaderActivity : AppCompatActivity() {
private var markOnScroll: Boolean = false
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
Scoop.getInstance().apply(this) Scoop.getInstance().apply(this)
@ -39,7 +41,7 @@ class ReaderActivity : AppCompatActivity() {
val debugReadingItems = sharedPref.getBoolean("read_debug", false) val debugReadingItems = sharedPref.getBoolean("read_debug", false)
val userIdentifier = sharedPref.getString("unique_id", "") val userIdentifier = sharedPref.getString("unique_id", "")
val markOnScroll = sharedPref.getBoolean("mark_on_scroll", false) markOnScroll = sharedPref.getBoolean("mark_on_scroll", false)
if (allItems.isEmpty()) { if (allItems.isEmpty()) {
Crashlytics.setUserIdentifier(userIdentifier) Crashlytics.setUserIdentifier(userIdentifier)
@ -130,12 +132,14 @@ class ReaderActivity : AppCompatActivity() {
override fun onPause() { override fun onPause() {
super.onPause() super.onPause()
if (markOnScroll) {
pager.clearOnPageChangeListeners() pager.clearOnPageChangeListeners()
} }
}
override fun onStop() { override fun onSaveInstanceState(oldInstanceState: Bundle?) {
super.onStop() super.onSaveInstanceState(oldInstanceState)
allItems = ArrayList() oldInstanceState!!.clear()
} }
private inner class ScreenSlidePagerAdapter(fm: FragmentManager) : FragmentStatePagerAdapter(fm) { private inner class ScreenSlidePagerAdapter(fm: FragmentManager) : FragmentStatePagerAdapter(fm) {