Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #5612 Talk back is not reading Arabic language in Preferred Audio Language #5613

Open
wants to merge 26 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
d819e70
Merge pull request #1 from oppia/develop
subhajitxyz Jul 23, 2024
c6f54ea
Merge branch 'oppia:develop' into develop
subhajitxyz Jul 27, 2024
d44015b
Merge remote-tracking branch 'upstream/develop' into develop
subhajitxyz Aug 17, 2024
d604bc2
Merge pull request #2 from oppia/develop
subhajitxyz Aug 26, 2024
cc0ddef
Merge pull request #3 from oppia/develop
subhajitxyz Aug 26, 2024
52c6bb1
Merge pull request #4 from oppia/develop
subhajitxyz Aug 29, 2024
773c810
Merge remote-tracking branch 'upstream/develop' into develop
subhajitxyz Sep 5, 2024
56af5ae
Merge pull request #5 from oppia/develop
subhajitxyz Sep 16, 2024
3883f70
Merge pull request #6 from oppia/develop
subhajitxyz Sep 27, 2024
10c8e6e
Fix #5404: Migrate away from onBackPressed for remaining activities (…
dattasneha Oct 3, 2024
5e140e9
Fix #5404: Migrate away from onBackPressed for RevisionCardActivity (…
dattasneha Oct 9, 2024
b4ad7a3
Merge branch 'oppia:develop' into develop
subhajitxyz Oct 11, 2024
238645d
Merge pull request #8 from oppia/develop
subhajitxyz Oct 12, 2024
5a546b9
Merge pull request #9 from oppia/develop
subhajitxyz Nov 3, 2024
b1ca8e1
Merge pull request #10 from oppia/develop
subhajitxyz Nov 19, 2024
ad7e380
Merge pull request #11 from oppia/develop
subhajitxyz Dec 11, 2024
b938a4c
Fix #5508: Skipping redundant code coverage and APK/AAB report commen…
Rd4dev Dec 12, 2024
fc2f932
Fix part of #4865: Use profileId in classroom activity and presenter …
tobioyelekan Dec 16, 2024
35f937b
Merge branch 'oppia:develop' into develop
subhajitxyz Dec 17, 2024
21b0986
Merge branch 'oppia:develop' into develop
subhajitxyz Dec 18, 2024
d891a5a
Merge branch 'oppia:develop' into develop
subhajitxyz Dec 21, 2024
3e6404d
add content desc and test for arabicDisplayName
subhajitxyz Dec 21, 2024
9312dcf
added kdoc for fun languageContentDescription
subhajitxyz Dec 21, 2024
b1d0ca1
add string in string.xml and change test name
subhajitxyz Dec 23, 2024
7c12668
Merge branch 'oppia:develop' into develop
subhajitxyz Dec 23, 2024
6df6480
Merge branch 'develop' of https://github.com/subhajitxyz/oppia-androi…
subhajitxyz Dec 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,14 @@ class AudioLanguageItemViewModel(
val isLanguageSelected: LiveData<Boolean> by lazy {
Transformations.map(currentSelectedLanguage) { it == language }
}
/**
* Returns the content description for the current language. This is used for accessibility
* purposes to provide a readable description of the language in the UI.
*/
fun languageContentDescription(): String {
return when (language) {
AudioLanguage.ARABIC_LANGUAGE -> "Arabic"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please move this to strings.xml with a descriptive name?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adhiamboperes , I have added this to strings.xml. Please check if it is okay.

else -> languageDisplayName
}
}
}
1 change: 1 addition & 0 deletions app/src/main/res/layout/audio_language_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
android:layout_height="wrap_content"
android:layout_marginEnd="24dp"
android:fontFamily="sans-serif"
android:contentDescription="@{viewModel.languageContentDescription()}"
android:text="@{viewModel.languageDisplayName}"
android:textColor="@color/component_color_shared_primary_text_color"
android:textSize="16sp" />
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -686,4 +686,8 @@
<string name="audio_language_fragment_text">In %s, you can listen to lessons!</string>
<string name="audio_language_fragment_subtitle">Select the audio language to listen to lessons</string>
<string name="onboarding_step_count_five">STEP 5 OF 5</string>

<!-- AudioLanguageFragment -->
<string name="arabic_language_display_name_content_description">Arabic</string>

</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import androidx.test.espresso.matcher.RootMatchers.withDecorView
import androidx.test.espresso.matcher.ViewMatchers.Visibility
import androidx.test.espresso.matcher.ViewMatchers.isChecked
import androidx.test.espresso.matcher.ViewMatchers.isRoot
import androidx.test.espresso.matcher.ViewMatchers.withContentDescription
import androidx.test.espresso.matcher.ViewMatchers.withEffectiveVisibility
import androidx.test.espresso.matcher.ViewMatchers.withId
import androidx.test.espresso.matcher.ViewMatchers.withText
Expand Down Expand Up @@ -499,6 +500,32 @@ class AudioLanguageFragmentTest {
}
}

@Test
fun testFragment_withEnglish_verifyContentDescriptionReadsArabicLanguage() {
initializeTestApplicationComponent(enableOnboardingFlowV2 = false)
launchActivityWithLanguage(ENGLISH_AUDIO_LANGUAGE).use {
verifyEnglishIsSelected()

onView(
atPositionOnView(
R.id.audio_language_recycler_view,
3,
R.id.language_text_view
)
).check(matches(withText(R.string.arabic_localized_language_name)))

onView(
atPositionOnView(
R.id.audio_language_recycler_view,
3,
R.id.language_text_view
)
).check(
matches(withContentDescription(R.string.arabic_language_display_name_content_description))
)
}
}

private fun launchActivityWithLanguage(
audioLanguage: AudioLanguage
): ActivityScenario<AppLanguageActivity> {
Expand Down
Loading