MainActivity: basic UI state restore

This commit is contained in:
dece 2021-03-17 18:47:54 +01:00
parent b26feaeb46
commit 01d01e315b

View file

@ -61,6 +61,18 @@ class MainActivity : AppCompatActivity() {
return true return true
} }
override fun onSaveInstanceState(outState: Bundle) {
outState.putString("cvp", currentVideoPath)
outState.putParcelable("cvi", currentVideoUri)
super.onSaveInstanceState(outState)
}
override fun onRestoreInstanceState(savedInstanceState: Bundle) {
currentVideoPath = savedInstanceState.getString("cvp")
currentVideoUri = savedInstanceState.getParcelable("cvi")
super.onRestoreInstanceState(savedInstanceState)
}
override fun onOptionsItemSelected(item: MenuItem): Boolean { override fun onOptionsItemSelected(item: MenuItem): Boolean {
// Handle action bar item clicks here. The action bar will // Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long // automatically handle clicks on the Home/Up button, so long