fix issue with challenge list when rotated

This commit is contained in:
Phillip Thelen 2025-03-05 17:34:50 +01:00
parent 9d0a0270be
commit fcb7490ad1

View file

@ -76,6 +76,9 @@ class ChallengeListFragment :
savedInstanceState: Bundle?
) {
super.onViewCreated(view, savedInstanceState)
if (savedInstanceState?.containsKey("viewUserChallengesOnly") == true) {
viewUserChallengesOnly = savedInstanceState.getBoolean("viewUserChallengesOnly")
}
challengeAdapter = ChallengesListViewAdapter(viewUserChallengesOnly, userViewModel.userID)
challengeAdapter?.onOpenChallengeFragment = { openDetailFragment(it) }
@ -129,6 +132,12 @@ class ChallengeListFragment :
retrieveChallengesPage(true)
}
override fun onSaveInstanceState(outState: Bundle) {
outState.putBoolean("viewUserChallengesOnly", viewUserChallengesOnly)
super.onSaveInstanceState(outState)
}
private fun openDetailFragment(challengeID: String) {
MainNavigationController.navigate(
ChallengesOverviewFragmentDirections.openChallengeDetail(