1
0
Fork 0

For #2449: App crashes when switching themes (#2450)

master
Colin Lee 2019-05-13 10:59:05 -05:00 committed by GitHub
parent e68d594bbb
commit 155353f0ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 11 deletions

View File

@ -167,17 +167,20 @@ class HomeFragment : Fragment(), CoroutineScope {
override fun onSaveInstanceState(outState: Bundle) { override fun onSaveInstanceState(outState: Bundle) {
super.onSaveInstanceState(outState) super.onSaveInstanceState(outState)
val state = sessionControlComponent.stateObservable.blockingFirst() // This can get called before onCreateView, before the component is defined
outState.putParcelableArrayList( view?.let {
KEY_TABS, val state = sessionControlComponent.stateObservable.blockingFirst()
ArrayList(state.tabs) outState.putParcelableArrayList(
) KEY_TABS,
outState.putParcelableArrayList( ArrayList(state.tabs)
KEY_COLLECTIONS, )
ArrayList(state.collections) outState.putParcelableArrayList(
) KEY_COLLECTIONS,
val modeInt = if (state.mode is Mode.Private) 0 else 1 ArrayList(state.collections)
outState.putInt(KEY_MODE, modeInt) )
val modeInt = if (state.mode is Mode.Private) 0 else 1
outState.putInt(KEY_MODE, modeInt)
}
} }
override fun onViewStateRestored(savedInstanceState: Bundle?) { override fun onViewStateRestored(savedInstanceState: Bundle?) {