Skip to content

Commit

Permalink
Migrate from QuestionPlayerActivityPresenter
Browse files Browse the repository at this point in the history
  • Loading branch information
dattasneha committed Sep 5, 2024
1 parent 763f1a7 commit 789dd1c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package org.oppia.android.app.topic.questionplayer
import android.content.Context
import android.content.Intent
import android.os.Bundle
import androidx.activity.OnBackPressedCallback
import org.oppia.android.app.activity.ActivityComponentImpl
import org.oppia.android.app.activity.InjectableAutoLocalizedAppCompatActivity
import org.oppia.android.app.hintsandsolution.HintsAndSolutionListener
Expand Down Expand Up @@ -56,11 +57,17 @@ class QuestionPlayerActivity :
val profileId =
intent.extractCurrentUserProfileId()
questionPlayerActivityPresenter.handleOnCreate(profileId)
}

override fun onBackPressed() {
showStopExplorationDialogFragment()
questionPlayerActivityPresenter.setReadingTextSizeNormal()
onBackPressedDispatcher.addCallback(
this,
object : OnBackPressedCallback(/* enabled = */ true) {
override fun handleOnBackPressed() {
showStopExplorationDialogFragment()
questionPlayerActivityPresenter.setReadingTextSizeNormal()
finish()
}
}
)
}

override fun restartSession() = questionPlayerActivityPresenter.restartSession()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ class QuestionPlayerActivityPresenter @Inject constructor(
activity.setSupportActionBar(binding.questionPlayerToolbar)

binding.questionPlayerToolbar.setNavigationOnClickListener {
@Suppress("DEPRECATION") // TODO(#5404): Migrate to a back pressed dispatcher.
activity.onBackPressed()
activity.onBackPressedDispatcher.onBackPressed()
}

retrieveReadingTextSize().observe(
Expand Down

0 comments on commit 789dd1c

Please sign in to comment.