diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 7f2f0f6ef14..f7145482fcf 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -184,6 +184,7 @@ + diff --git a/app/src/main/java/org/oppia/android/app/activity/ActivityComponentImpl.kt b/app/src/main/java/org/oppia/android/app/activity/ActivityComponentImpl.kt index 83676a30f56..1d7c7809e86 100644 --- a/app/src/main/java/org/oppia/android/app/activity/ActivityComponentImpl.kt +++ b/app/src/main/java/org/oppia/android/app/activity/ActivityComponentImpl.kt @@ -57,6 +57,7 @@ import org.oppia.android.app.testing.DragDropTestActivity import org.oppia.android.app.testing.DrawableBindingAdaptersTestActivity import org.oppia.android.app.testing.ExplorationInjectionActivity import org.oppia.android.app.testing.ExplorationTestActivity +import org.oppia.android.app.testing.FractionInputInteractionViewTestActivity import org.oppia.android.app.testing.HomeFragmentTestActivity import org.oppia.android.app.testing.HomeTestActivity import org.oppia.android.app.testing.HtmlParserTestActivity @@ -125,6 +126,7 @@ interface ActivityComponentImpl : fun inject(helpActivity: HelpActivity) fun inject(homeActivity: HomeActivity) fun inject(homeFragmentTestActivity: HomeFragmentTestActivity) + fun inject(fractionInputInteractionViewTestActivity: FractionInputInteractionViewTestActivity) fun inject(homeTestActivity: HomeTestActivity) fun inject(htmlParserTestActivity: HtmlParserTestActivity) fun inject(imageRegionSelectionTestActivity: ImageRegionSelectionTestActivity) diff --git a/app/src/main/java/org/oppia/android/app/testing/FractionInputInteractionViewTestActivity.kt b/app/src/main/java/org/oppia/android/app/testing/FractionInputInteractionViewTestActivity.kt new file mode 100644 index 00000000000..0e4323e8cb8 --- /dev/null +++ b/app/src/main/java/org/oppia/android/app/testing/FractionInputInteractionViewTestActivity.kt @@ -0,0 +1,57 @@ +package org.oppia.android.app.testing + +import android.os.Bundle +import android.view.View +import androidx.databinding.DataBindingUtil +import org.oppia.android.R +import org.oppia.android.app.activity.ActivityComponentImpl +import org.oppia.android.app.activity.InjectableAppCompatActivity +import org.oppia.android.app.model.Interaction +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 +import org.oppia.android.app.player.state.itemviewmodel.FractionInteractionViewModel +import org.oppia.android.app.player.state.listener.StateKeyboardButtonListener +import org.oppia.android.app.translation.AppLanguageResourceHandler +import org.oppia.android.databinding.ActivityFractionInputInteractionViewTestBinding +import org.oppia.android.domain.translation.TranslationController +import javax.inject.Inject + +class FractionInputInteractionViewTestActivity : + InjectableAppCompatActivity(), + StateKeyboardButtonListener, + InteractionAnswerErrorOrAvailabilityCheckReceiver { + private lateinit var binding: ActivityFractionInputInteractionViewTestBinding + lateinit var fractionInteractionViewModel: FractionInteractionViewModel + + @Inject + lateinit var resourceHandler: AppLanguageResourceHandler + + @Inject + lateinit var translationController: TranslationController + + override fun onCreate(savedInstanceState: Bundle?) { + super.onCreate(savedInstanceState) + (activityComponent as ActivityComponentImpl).inject(this) + binding = DataBindingUtil.setContentView( + this, R.layout.activity_fraction_input_interaction_view_test + ) + fractionInteractionViewModel = FractionInteractionViewModel( + interaction = Interaction.getDefaultInstance(), + hasConversationView = false, + isSplitView = false, + errorOrAvailabilityCheckReceiver = this, + writtenTranslationContext = WrittenTranslationContext.getDefaultInstance(), + resourceHandler = resourceHandler, + translationController = translationController + ) + binding.fractionInteractionViewModel = fractionInteractionViewModel + } + + fun getPendingAnswerErrorOnSubmitClick(v: View) { + fractionInteractionViewModel.checkPendingAnswerError(AnswerErrorCategory.SUBMIT_TIME) + } + + override fun onEditorAction(actionCode: Int) { + } +} diff --git a/app/src/main/res/layout/activity_fraction_input_interaction_view_test.xml b/app/src/main/res/layout/activity_fraction_input_interaction_view_test.xml new file mode 100644 index 00000000000..62357ffd4db --- /dev/null +++ b/app/src/main/res/layout/activity_fraction_input_interaction_view_test.xml @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + +