Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package com.simprints.feature.orchestrator

import android.content.Intent
import android.os.Bundle
import android.os.PersistableBundle
import androidx.core.os.bundleOf
import androidx.navigation.findNavController
import com.simprints.core.tools.activity.BaseActivity
Expand All @@ -29,15 +28,14 @@ internal class OrchestratorActivity : BaseActivity() {

/**
* Flag for the navigation graph initialization state. The graph should only be initialized once
* during the existence of this activity, and the flag tracks graph's state.
* while the activity is in memory. Recreation of the activity should result in graph re-init
*/
private var isGraphInitialized = false

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
Simber.d("OrchestratorActivity.onCreate isGraphInitialized=$isGraphInitialized", tag = ORCHESTRATION)

isGraphInitialized = savedInstanceState?.getBoolean(KEY_IS_GRAPH_INITIALIZED) ?: false
lifecycle.addObserver(activityTracker)

setContentView(binding.root)
Expand Down Expand Up @@ -80,16 +78,4 @@ internal class OrchestratorActivity : BaseActivity() {
finish()
}
}

override fun onSaveInstanceState(
outState: Bundle,
outPersistentState: PersistableBundle,
) {
outState.putBoolean(KEY_IS_GRAPH_INITIALIZED, isGraphInitialized)
super.onSaveInstanceState(outState, outPersistentState)
}

companion object {
private const val KEY_IS_GRAPH_INITIALIZED = "KEY_IS_GRAPH_INITIALIZED"
}
}
Loading