From 4f6476a1c3cc7e00efed70be015dc703809139fd Mon Sep 17 00:00:00 2001 From: Rajat Talesra Date: Thu, 7 Nov 2019 18:05:08 +0530 Subject: [PATCH] Fix topic-play-expanded-list (#316) --- .../java/org/oppia/app/topic/play/TopicPlayFragment.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/org/oppia/app/topic/play/TopicPlayFragment.kt b/app/src/main/java/org/oppia/app/topic/play/TopicPlayFragment.kt index e68d4d8e7ed..c217af1246b 100644 --- a/app/src/main/java/org/oppia/app/topic/play/TopicPlayFragment.kt +++ b/app/src/main/java/org/oppia/app/topic/play/TopicPlayFragment.kt @@ -24,7 +24,10 @@ class TopicPlayFragment : InjectableFragment(), ExpandedChapterListIndexListener override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View? { if (savedInstanceState != null) { - currentExpandedChapterListIndex = savedInstanceState.getInt(KEY_CURRENT_EXPANDED_LIST_INDEX) + currentExpandedChapterListIndex = savedInstanceState.getInt(KEY_CURRENT_EXPANDED_LIST_INDEX, -1) + if (currentExpandedChapterListIndex == -1) { + currentExpandedChapterListIndex = null + } } return topicPlayFragmentPresenter.handleCreateView( inflater, @@ -36,7 +39,7 @@ class TopicPlayFragment : InjectableFragment(), ExpandedChapterListIndexListener override fun onSaveInstanceState(outState: Bundle) { super.onSaveInstanceState(outState) - if(currentExpandedChapterListIndex!=null) { + if (currentExpandedChapterListIndex != null) { outState.putInt(KEY_CURRENT_EXPANDED_LIST_INDEX, currentExpandedChapterListIndex!!) } }