diff --git a/app/src/main/java/org/oppia/android/app/hintsandsolution/HintsAndSolutionDialogFragmentPresenter.kt b/app/src/main/java/org/oppia/android/app/hintsandsolution/HintsAndSolutionDialogFragmentPresenter.kt index 89f021ef9ef..2a3930441b8 100644 --- a/app/src/main/java/org/oppia/android/app/hintsandsolution/HintsAndSolutionDialogFragmentPresenter.kt +++ b/app/src/main/java/org/oppia/android/app/hintsandsolution/HintsAndSolutionDialogFragmentPresenter.kt @@ -74,6 +74,9 @@ class HintsAndSolutionDialogFragmentPresenter @Inject constructor( this.solutionIndex = solutionIndex this.isSolutionRevealed = isSolutionRevealed binding.hintsAndSolutionToolbar.setNavigationIcon(R.drawable.ic_close_white_24dp) + binding.hintsAndSolutionToolbar.setNavigationContentDescription( + R.string.hints_andSolution_close_icon_description + ) binding.hintsAndSolutionToolbar.setNavigationOnClickListener { (fragment.requireActivity() as? HintsAndSolutionListener)?.dismiss() } diff --git a/app/src/main/res/layout-land/question_player_fragment.xml b/app/src/main/res/layout-land/question_player_fragment.xml index 42d2724b167..1783cfd7699 100644 --- a/app/src/main/res/layout-land/question_player_fragment.xml +++ b/app/src/main/res/layout-land/question_player_fragment.xml @@ -147,6 +147,7 @@ android:layout_height="6dp" android:layout_gravity="top|end" android:layout_margin="8dp" + android:contentDescription="@string/new_hint_available" android:src="@drawable/ic_dot_yellow_24dp" android:visibility="@{viewModel.isHintOpenedAndUnRevealed() ? View.VISIBLE : View.GONE}" /> @@ -155,6 +156,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="12dp" + android:contentDescription="@string/show_hints_and_solution" android:src="@drawable/ic_hint_bulb_white_24dp" /> diff --git a/app/src/main/res/layout-sw600dp-land/question_player_fragment.xml b/app/src/main/res/layout-sw600dp-land/question_player_fragment.xml index dac8acb4e66..f3a66264526 100644 --- a/app/src/main/res/layout-sw600dp-land/question_player_fragment.xml +++ b/app/src/main/res/layout-sw600dp-land/question_player_fragment.xml @@ -151,6 +151,7 @@ android:layout_height="6dp" android:layout_gravity="top|end" android:layout_margin="8dp" + android:contentDescription="@string/new_hint_available" android:src="@drawable/ic_dot_yellow_24dp" android:visibility="@{viewModel.isHintOpenedAndUnRevealed() ? View.VISIBLE : View.GONE}" /> @@ -159,6 +160,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="12dp" + android:contentDescription="@string/show_hints_and_solution" android:src="@drawable/ic_hint_bulb_white_24dp" /> diff --git a/app/src/main/res/layout-sw600dp-port/question_player_fragment.xml b/app/src/main/res/layout-sw600dp-port/question_player_fragment.xml index d1a581cb875..ba3d6a3f7d5 100644 --- a/app/src/main/res/layout-sw600dp-port/question_player_fragment.xml +++ b/app/src/main/res/layout-sw600dp-port/question_player_fragment.xml @@ -151,6 +151,7 @@ android:layout_height="6dp" android:layout_gravity="top|end" android:layout_margin="8dp" + android:contentDescription="@string/new_hint_available" android:src="@drawable/ic_dot_yellow_24dp" android:visibility="@{viewModel.isHintOpenedAndUnRevealed() ? View.VISIBLE : View.GONE}" /> @@ -159,6 +160,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="12dp" + android:contentDescription="@string/show_hints_and_solution" android:src="@drawable/ic_hint_bulb_white_24dp" /> diff --git a/app/src/main/res/layout/question_player_fragment.xml b/app/src/main/res/layout/question_player_fragment.xml index 4fac5b965fd..120ec3f6b26 100644 --- a/app/src/main/res/layout/question_player_fragment.xml +++ b/app/src/main/res/layout/question_player_fragment.xml @@ -127,6 +127,7 @@ android:layout_height="6dp" android:layout_gravity="top|end" android:layout_margin="8dp" + android:contentDescription="@string/new_hint_available" android:src="@drawable/ic_dot_yellow_24dp" android:visibility="@{viewModel.isHintOpenedAndUnRevealed() ? View.VISIBLE : View.GONE}" /> @@ -135,6 +136,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="12dp" + android:contentDescription="@string/show_hints_and_solution" android:src="@drawable/ic_hint_bulb_white_24dp" /> diff --git a/app/src/main/res/layout/state_fragment.xml b/app/src/main/res/layout/state_fragment.xml index fa2231bcbb4..3568b2df265 100755 --- a/app/src/main/res/layout/state_fragment.xml +++ b/app/src/main/res/layout/state_fragment.xml @@ -113,6 +113,7 @@ android:layout_height="6dp" android:layout_gravity="top|end" android:layout_margin="8dp" + android:contentDescription="@string/new_hint_available" android:src="@drawable/ic_dot_yellow_24dp" android:visibility="@{viewModel.isHintOpenedAndUnRevealed() ? View.VISIBLE : View.GONE}" /> @@ -121,6 +122,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="12dp" + android:contentDescription="@string/show_hints_and_solution" android:src="@drawable/ic_hint_bulb_white_24dp" /> diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index a65916d59fb..66a402e3d41 100755 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -379,6 +379,9 @@ Pick a \ndifferent topic. Are you interested in:\n%s? + New hint available + Show hints and solution + Navigate up Hints Reveal Solution Reveal Hint diff --git a/app/src/sharedTest/java/org/oppia/android/app/player/state/StateFragmentTest.kt b/app/src/sharedTest/java/org/oppia/android/app/player/state/StateFragmentTest.kt index 0c192b25b6e..e5adec4e8ab 100644 --- a/app/src/sharedTest/java/org/oppia/android/app/player/state/StateFragmentTest.kt +++ b/app/src/sharedTest/java/org/oppia/android/app/player/state/StateFragmentTest.kt @@ -1020,6 +1020,77 @@ class StateFragmentTest { } } + @Test + fun testStateFragment_forHintsAndSolution_incorrectInputTwice_hintBulbContainerIsVisible() { + launchForExploration(FRACTIONS_EXPLORATION_ID_1).use { + startPlayingExploration() + selectMultipleChoiceOption( + optionPosition = 3, + expectedOptionText = "No, because, in a fraction, the pieces must be the same size." + ) + clickContinueNavigationButton() + + // Entering incorrect answer twice. + typeFractionText("1/2") + clickSubmitAnswerButton() + scrollToViewType(FRACTION_INPUT_INTERACTION) + typeFractionText("1/2") + clickSubmitAnswerButton() + + onView(withId(R.id.hints_and_solution_fragment_container)).check(matches(isDisplayed())) + } + } + + @Test + fun testStateFragment_showHintsAndSolutionBulb_dotHasCorrectContentDescription() { + launchForExploration(FRACTIONS_EXPLORATION_ID_1).use { + startPlayingExploration() + selectMultipleChoiceOption( + optionPosition = 3, + expectedOptionText = "No, because, in a fraction, the pieces must be the same size." + ) + clickContinueNavigationButton() + + // Entering incorrect answer twice. + typeFractionText("1/2") + clickSubmitAnswerButton() + scrollToViewType(FRACTION_INPUT_INTERACTION) + typeFractionText("1/2") + clickSubmitAnswerButton() + + onView(withId(R.id.dot_hint)).check( + matches( + withContentDescription(R.string.new_hint_available) + ) + ) + } + } + + @Test + fun testStateFragment_showHintsAndSolutionBulb_bulbHasCorrectContentDescription() { + launchForExploration(FRACTIONS_EXPLORATION_ID_1).use { + startPlayingExploration() + selectMultipleChoiceOption( + optionPosition = 3, + expectedOptionText = "No, because, in a fraction, the pieces must be the same size." + ) + clickContinueNavigationButton() + + // Entering incorrect answer twice. + typeFractionText("1/2") + clickSubmitAnswerButton() + scrollToViewType(FRACTION_INPUT_INTERACTION) + typeFractionText("1/2") + clickSubmitAnswerButton() + + onView(withId(R.id.hint_bulb)).check( + matches( + withContentDescription(R.string.show_hints_and_solution) + ) + ) + } + } + @Test fun testStateFragment_forMisconception_showsLinkTextForConceptCard() { launchForExploration(FRACTIONS_EXPLORATION_ID_1).use {