diff --git a/feature/dashboard/src/main/res/layout/fragment_sync_info.xml b/feature/dashboard/src/main/res/layout/fragment_sync_info.xml index 55cef3bd59..90ec6e3ae6 100644 --- a/feature/dashboard/src/main/res/layout/fragment_sync_info.xml +++ b/feature/dashboard/src/main/res/layout/fragment_sync_info.xml @@ -1,363 +1,369 @@ - + android:layout_height="match_parent"> - + tools:context=".settings.syncinfo.SyncInfoFragment"> - - - - - + android:layout_height="wrap_content" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent"> - + - + - - - + + - - - - - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + + + - - - - + + + + - - + + + + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + + + + + - - - - - - - - - - + android:orientation="vertical" + android:padding="10dp"> + + + + + + + + + + + app:layout_constraintBottom_toTopOf="@+id/moduleSelectionButton" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@+id/syncButton" + tools:ignore="SpeakableTextPresentCheck"> + android:text="@string/dashboard_sync_info_selected_modules" + android:textAlignment="center" /> - + - + android:fadeScrollbars="false" + android:orientation="vertical" + android:padding="10dp" + android:scrollbars="vertical" + app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" + tools:itemCount="100" + tools:listitem="@layout/item_module_count" /> - - - - - - - - - - - - - - - + android:layout_marginStart="10dp" + android:layout_marginTop="15dp" + android:layout_marginEnd="10dp" + android:layout_marginBottom="15dp" + android:text="@string/dashboard_sync_info_select_modules_button" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="@+id/modulesTabHost" + app:layout_constraintStart_toStartOf="@+id/modulesTabHost" + app:layout_constraintTop_toBottomOf="@+id/modulesTabHost" /> + + - + + \ No newline at end of file diff --git a/feature/orchestrator/src/main/java/com/simprints/feature/orchestrator/OrchestratorActivity.kt b/feature/orchestrator/src/main/java/com/simprints/feature/orchestrator/OrchestratorActivity.kt index 94e05bbd47..dbe69c2748 100644 --- a/feature/orchestrator/src/main/java/com/simprints/feature/orchestrator/OrchestratorActivity.kt +++ b/feature/orchestrator/src/main/java/com/simprints/feature/orchestrator/OrchestratorActivity.kt @@ -2,6 +2,7 @@ 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 @@ -16,8 +17,14 @@ internal class OrchestratorActivity : BaseActivity() { private val binding by viewBinding(ActivityOrchestratorBinding::inflate) + /** + * 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. + */ + private var isGraphInitialized = false override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) + isGraphInitialized = savedInstanceState?.getBoolean(KEY_IS_GRAPH_INITIALIZED) ?: false setContentView(binding.root) binding.orchestrationHost.handleResult(this, R.id.orchestratorRootFragment) { result -> @@ -28,13 +35,24 @@ internal class OrchestratorActivity : BaseActivity() { override fun onStart() { super.onStart() - val action = intent.action.orEmpty() - val extras = intent.extras ?: bundleOf() + if(!isGraphInitialized) { + val action = intent.action.orEmpty() + val extras = intent.extras ?: bundleOf() + + findNavController(R.id.orchestrationHost).setGraph( + R.navigation.graph_orchestration, + OrchestratorFragmentArgs(action, extras).toBundle() + ) + isGraphInitialized = true + } + } - findNavController(R.id.orchestrationHost).setGraph( - R.navigation.graph_orchestration, - OrchestratorFragmentArgs(action, extras).toBundle() - ) + 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" + } } diff --git a/feature/orchestrator/src/main/java/com/simprints/feature/orchestrator/OrchestratorFragment.kt b/feature/orchestrator/src/main/java/com/simprints/feature/orchestrator/OrchestratorFragment.kt index f83e099756..e6989a32fc 100644 --- a/feature/orchestrator/src/main/java/com/simprints/feature/orchestrator/OrchestratorFragment.kt +++ b/feature/orchestrator/src/main/java/com/simprints/feature/orchestrator/OrchestratorFragment.kt @@ -61,9 +61,6 @@ import javax.inject.Inject @AndroidEntryPoint internal class OrchestratorFragment : Fragment(R.layout.fragment_orchestrator) { - private var isActivityRestored = false - private var requestProcessed = false - @Inject lateinit var alertConfigurationMapper: AlertConfigurationMapper @@ -79,6 +76,7 @@ internal class OrchestratorFragment : Fragment(R.layout.fragment_orchestrator) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) + orchestratorVm.isActivityRestored = savedInstanceState != null observeLoginCheckVm() observeClientApiVm() @@ -177,9 +175,9 @@ internal class OrchestratorFragment : Fragment(R.layout.fragment_orchestrator) { override fun onResume() { super.onResume() - if (!isActivityRestored && !requestProcessed) { + if (!orchestratorVm.isActivityRestored && !orchestratorVm.requestProcessed) { if (loginCheckVm.isDeviceSafe()) { - requestProcessed = true + orchestratorVm.requestProcessed = true lifecycleScope.launch { val actionRequest = clientApiVm.handleIntent(args.requestAction, args.requestParams) if (actionRequest != null) { diff --git a/feature/orchestrator/src/main/java/com/simprints/feature/orchestrator/OrchestratorViewModel.kt b/feature/orchestrator/src/main/java/com/simprints/feature/orchestrator/OrchestratorViewModel.kt index 33e31d7287..a2bba2e095 100644 --- a/feature/orchestrator/src/main/java/com/simprints/feature/orchestrator/OrchestratorViewModel.kt +++ b/feature/orchestrator/src/main/java/com/simprints/feature/orchestrator/OrchestratorViewModel.kt @@ -46,6 +46,8 @@ internal class OrchestratorViewModel @Inject constructor( private val updateDailyActivity: UpdateDailyActivityUseCase, ) : ViewModel() { + var isActivityRestored = false + var requestProcessed = false private var modalities = emptySet() private var steps = emptyList() private var actionRequest: ActionRequest? = null