diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/grade/GradeFragment.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/grade/GradeFragment.kt index 0678e13e..91e39e06 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/grade/GradeFragment.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/grade/GradeFragment.kt @@ -33,7 +33,6 @@ class GradeFragment : BaseFragment(R.layout.fragment_grade private var semesterSwitchMenu: MenuItem? = null companion object { - private const val SAVED_SEMESTER_KEY = "CURRENT_SEMESTER" fun newInstance() = GradeFragment() } @@ -52,7 +51,7 @@ class GradeFragment : BaseFragment(R.layout.fragment_grade override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) binding = FragmentGradeBinding.bind(view) - presenter.onAttachView(this, savedInstanceState?.getInt(SAVED_SEMESTER_KEY)) + presenter.onAttachView(this) } override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) { @@ -161,11 +160,6 @@ class GradeFragment : BaseFragment(R.layout.fragment_grade (pagerAdapter.getFragmentInstance(index) as? GradeView.GradeChildView)?.onParentChangeSemester() } - override fun onSaveInstanceState(outState: Bundle) { - super.onSaveInstanceState(outState) - outState.putInt(SAVED_SEMESTER_KEY, presenter.selectedIndex) - } - override fun onDestroyView() { presenter.onDetachView() super.onDestroyView() diff --git a/app/src/main/java/io/github/wulkanowy/ui/modules/grade/GradePresenter.kt b/app/src/main/java/io/github/wulkanowy/ui/modules/grade/GradePresenter.kt index d64613c0..bfc504d2 100644 --- a/app/src/main/java/io/github/wulkanowy/ui/modules/grade/GradePresenter.kt +++ b/app/src/main/java/io/github/wulkanowy/ui/modules/grade/GradePresenter.kt @@ -21,8 +21,7 @@ class GradePresenter @Inject constructor( private val analytics: AnalyticsHelper ) : BasePresenter(errorHandler, studentRepository) { - var selectedIndex = 0 - private set + private var selectedIndex = 0 private var schoolYear = 0 @@ -32,9 +31,8 @@ class GradePresenter @Inject constructor( private lateinit var lastError: Throwable - fun onAttachView(view: GradeView, savedIndex: Int?) { + override fun onAttachView(view: GradeView) { super.onAttachView(view) - selectedIndex = savedIndex ?: 0 view.initView() Timber.i("Grade view was initialized with $selectedIndex index") errorHandler.showErrorMessage = ::showErrorViewOnError