mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2025-02-18 12:50:34 +01:00
remember the scrollstate of events list
This commit is contained in:
parent
db06fcd683
commit
fbfe752f44
@ -3,6 +3,7 @@ package com.simplemobiletools.calendar.fragments
|
|||||||
import android.app.Activity
|
import android.app.Activity
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import android.os.Parcelable
|
||||||
import android.support.v4.app.Fragment
|
import android.support.v4.app.Fragment
|
||||||
import android.view.*
|
import android.view.*
|
||||||
import android.widget.AbsListView
|
import android.widget.AbsListView
|
||||||
@ -30,6 +31,7 @@ class EventListFragment : Fragment(), DBHelper.GetEventsListener, AdapterView.On
|
|||||||
var mSelectedItemsCnt = 0
|
var mSelectedItemsCnt = 0
|
||||||
var mListItems: ArrayList<ListItem> = ArrayList()
|
var mListItems: ArrayList<ListItem> = ArrayList()
|
||||||
var mAllEvents: MutableList<Event>? = null
|
var mAllEvents: MutableList<Event>? = null
|
||||||
|
var mState: Parcelable? = null
|
||||||
lateinit var mToBeDeleted: MutableList<Int>
|
lateinit var mToBeDeleted: MutableList<Int>
|
||||||
lateinit var mView: View
|
lateinit var mView: View
|
||||||
|
|
||||||
@ -44,6 +46,11 @@ class EventListFragment : Fragment(), DBHelper.GetEventsListener, AdapterView.On
|
|||||||
checkEvents()
|
checkEvents()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onPause() {
|
||||||
|
super.onPause()
|
||||||
|
mState = mView.calendar_events_list.onSaveInstanceState()
|
||||||
|
}
|
||||||
|
|
||||||
private fun checkEvents() {
|
private fun checkEvents() {
|
||||||
val fromTS = (DateTime().millis / 1000).toInt()
|
val fromTS = (DateTime().millis / 1000).toInt()
|
||||||
val toTS = (DateTime().plusYears(1).millis / 1000).toInt()
|
val toTS = (DateTime().plusYears(1).millis / 1000).toInt()
|
||||||
@ -72,6 +79,9 @@ class EventListFragment : Fragment(), DBHelper.GetEventsListener, AdapterView.On
|
|||||||
adapter = eventsAdapter
|
adapter = eventsAdapter
|
||||||
onItemClickListener = this@EventListFragment
|
onItemClickListener = this@EventListFragment
|
||||||
setMultiChoiceModeListener(this@EventListFragment)
|
setMultiChoiceModeListener(this@EventListFragment)
|
||||||
|
|
||||||
|
if (mState != null)
|
||||||
|
onRestoreInstanceState(mState)
|
||||||
}
|
}
|
||||||
checkPlaceholderVisibility()
|
checkPlaceholderVisibility()
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user