From 673ba946e2658eac1a6f4aabf7dea97c18c6b37c Mon Sep 17 00:00:00 2001 From: Vishwajith-Shettigar Date: Sat, 6 Jul 2024 11:55:51 +0530 Subject: [PATCH] klint --- .../oppia/android/app/player/state/StateFragment.kt | 2 +- .../app/player/state/StateFragmentPresenter.kt | 8 ++++---- .../player/state/StatePlayerRecyclerViewAssembler.kt | 11 ++++++++--- .../oppia/android/app/player/state/StateViewModel.kt | 2 +- .../state/answerhandling/InteractionAnswerHandler.kt | 3 +-- .../itemviewmodel/ContinueInteractionViewModel.kt | 2 +- .../DragAndDropSortInteractionViewModel.kt | 2 +- .../itemviewmodel/FractionInteractionViewModel.kt | 2 +- .../ImageRegionSelectionInteractionViewModel.kt | 2 +- .../MathExpressionInteractionsViewModel.kt | 2 +- .../state/itemviewmodel/NumericInputViewModel.kt | 2 +- .../RatioExpressionInputInteractionViewModel.kt | 2 +- .../itemviewmodel/SelectionInteractionViewModel.kt | 11 +++++------ .../player/state/itemviewmodel/TextInputViewModel.kt | 2 +- 14 files changed, 28 insertions(+), 25 deletions(-) diff --git a/app/src/main/java/org/oppia/android/app/player/state/StateFragment.kt b/app/src/main/java/org/oppia/android/app/player/state/StateFragment.kt index fa2230df8e1..44c3d333252 100755 --- a/app/src/main/java/org/oppia/android/app/player/state/StateFragment.kt +++ b/app/src/main/java/org/oppia/android/app/player/state/StateFragment.kt @@ -10,6 +10,7 @@ import org.oppia.android.app.fragment.InjectableFragment import org.oppia.android.app.model.HelpIndex import org.oppia.android.app.model.StateFragmentArguments import org.oppia.android.app.model.UserAnswer +import org.oppia.android.app.model.UserAnswerState import org.oppia.android.app.player.state.answerhandling.InteractionAnswerErrorOrAvailabilityCheckReceiver import org.oppia.android.app.player.state.answerhandling.InteractionAnswerHandler import org.oppia.android.app.player.state.answerhandling.InteractionAnswerReceiver @@ -23,7 +24,6 @@ import org.oppia.android.app.player.state.listener.SubmitNavigationButtonListene import org.oppia.android.util.extensions.getProto import org.oppia.android.util.extensions.putProto import javax.inject.Inject -import org.oppia.android.app.model.UserAnswerState /** Fragment that represents the current state of an exploration. */ class StateFragment : diff --git a/app/src/main/java/org/oppia/android/app/player/state/StateFragmentPresenter.kt b/app/src/main/java/org/oppia/android/app/player/state/StateFragmentPresenter.kt index c84474cc9c1..a0b73c6d137 100755 --- a/app/src/main/java/org/oppia/android/app/player/state/StateFragmentPresenter.kt +++ b/app/src/main/java/org/oppia/android/app/player/state/StateFragmentPresenter.kt @@ -27,6 +27,7 @@ import org.oppia.android.app.model.ProfileId import org.oppia.android.app.model.State import org.oppia.android.app.model.SurveyQuestionName import org.oppia.android.app.model.UserAnswer +import org.oppia.android.app.model.UserAnswerState import org.oppia.android.app.player.audio.AudioButtonListener import org.oppia.android.app.player.audio.AudioFragment import org.oppia.android.app.player.audio.AudioUiManager @@ -54,7 +55,6 @@ import org.oppia.android.util.gcsresource.DefaultResourceBucketName import org.oppia.android.util.parser.html.ExplorationHtmlParserEntityType import org.oppia.android.util.system.OppiaClock import javax.inject.Inject -import org.oppia.android.app.model.UserAnswerState const val STATE_FRAGMENT_PROFILE_ID_ARGUMENT_KEY = "StateFragmentPresenter.state_fragment_profile_id" @@ -127,7 +127,7 @@ class StateFragmentPresenter @Inject constructor( /* attachToRoot= */ false ) recyclerViewAssembler = createRecyclerViewAssembler( - assemblerBuilderFactory.create(resourceBucketName, entityType, profileId,userAnswerState), + assemblerBuilderFactory.create(resourceBucketName, entityType, profileId, userAnswerState), binding.congratulationsTextView, binding.congratulationsTextConfettiView, binding.fullScreenConfettiView @@ -367,7 +367,7 @@ class StateFragmentPresenter @Inject constructor( private fun subscribeToAnswerOutcome( answerOutcomeResultLiveData: LiveData> ) { - if (stateViewModel.getCanSubmitAnswer().get()==true){ + if (stateViewModel.getCanSubmitAnswer().get() == true) { recyclerViewAssembler.resetUserAnswerState() } val answerOutcomeLiveData = getAnswerOutcome(answerOutcomeResultLiveData) @@ -392,7 +392,7 @@ class StateFragmentPresenter @Inject constructor( /** Returns the [UserAnswerState] representing the user's current pending answer. */ fun getUserAnswerState(): UserAnswerState { - return stateViewModel.getUserAnswerState(recyclerViewAssembler::getPendingAnswerHandler) + return stateViewModel.getUserAnswerState(recyclerViewAssembler::getPendingAnswerHandler) } /** Helper for subscribeToAnswerOutcome. */ diff --git a/app/src/main/java/org/oppia/android/app/player/state/StatePlayerRecyclerViewAssembler.kt b/app/src/main/java/org/oppia/android/app/player/state/StatePlayerRecyclerViewAssembler.kt index bc8416eeb30..5dd9202c470 100644 --- a/app/src/main/java/org/oppia/android/app/player/state/StatePlayerRecyclerViewAssembler.kt +++ b/app/src/main/java/org/oppia/android/app/player/state/StatePlayerRecyclerViewAssembler.kt @@ -28,6 +28,7 @@ import org.oppia.android.app.model.ProfileId import org.oppia.android.app.model.StringList import org.oppia.android.app.model.SubtitledHtml import org.oppia.android.app.model.UserAnswer +import org.oppia.android.app.model.UserAnswerState import org.oppia.android.app.model.WrittenTranslationContext import org.oppia.android.app.player.audio.AudioUiManager import org.oppia.android.app.player.state.StatePlayerRecyclerViewAssembler.Builder.Factory @@ -93,7 +94,6 @@ import org.oppia.android.util.accessibility.AccessibilityService import org.oppia.android.util.parser.html.HtmlParser import org.oppia.android.util.threading.BackgroundDispatcher import javax.inject.Inject -import org.oppia.android.app.model.UserAnswerState private typealias AudioUiManagerRetriever = () -> AudioUiManager? @@ -912,7 +912,7 @@ class StatePlayerRecyclerViewAssembler private constructor( private val translationController: TranslationController, private val multiTypeBuilderFactory: BindableAdapter.MultiTypeBuilder.Factory, private val singleTypeBuilderFactory: BindableAdapter.SingleTypeBuilder.Factory, - private val userAnswerState: UserAnswerState + private val userAnswerState: UserAnswerState ) { private val adapterBuilder: BindableAdapter.MultiTypeBuilder null AnswerErrorCategory.SUBMIT_TIME -> diff --git a/app/src/main/java/org/oppia/android/app/player/state/itemviewmodel/TextInputViewModel.kt b/app/src/main/java/org/oppia/android/app/player/state/itemviewmodel/TextInputViewModel.kt index e76dbf35378..6a62f05019c 100644 --- a/app/src/main/java/org/oppia/android/app/player/state/itemviewmodel/TextInputViewModel.kt +++ b/app/src/main/java/org/oppia/android/app/player/state/itemviewmodel/TextInputViewModel.kt @@ -9,6 +9,7 @@ import org.oppia.android.R import org.oppia.android.app.model.Interaction import org.oppia.android.app.model.InteractionObject import org.oppia.android.app.model.UserAnswer +import org.oppia.android.app.model.UserAnswerState import org.oppia.android.app.model.WrittenTranslationContext import org.oppia.android.app.player.state.answerhandling.AnswerErrorCategory import org.oppia.android.app.player.state.answerhandling.InteractionAnswerErrorOrAvailabilityCheckReceiver @@ -17,7 +18,6 @@ import org.oppia.android.app.player.state.answerhandling.InteractionAnswerReceiv import org.oppia.android.app.translation.AppLanguageResourceHandler import org.oppia.android.domain.translation.TranslationController import javax.inject.Inject -import org.oppia.android.app.model.UserAnswerState /** [StateItemViewModel] for the text input interaction. */ class TextInputViewModel private constructor(