Skip to content

Commit

Permalink
Transcripts - Talkback (#2712)
Browse files Browse the repository at this point in the history
  • Loading branch information
ashiagr authored Aug 27, 2024
1 parent 5374cf4 commit f354e0b
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,7 @@ class PlayerHeaderFragment : BaseFragment(), PlayerClickListener {
}

private fun AdapterPlayerHeaderBinding.openTranscript() {
updatePlayerViewsAccessibility(enable = false)
playerGroup.layoutTransition = LayoutTransition()
transcriptPage.isVisible = true
shelf.isVisible = false
Expand All @@ -393,6 +394,7 @@ class PlayerHeaderFragment : BaseFragment(), PlayerClickListener {
private fun AdapterPlayerHeaderBinding.closeTranscript(
withTransition: Boolean,
) {
updatePlayerViewsAccessibility(enable = true)
playerGroup.layoutTransition = if (withTransition) LayoutTransition() else null
shelf.isVisible = true
transcriptPage.isVisible = false
Expand All @@ -408,6 +410,16 @@ class PlayerHeaderFragment : BaseFragment(), PlayerClickListener {
playerGroup.layoutTransition = null // Reset to null to avoid animation when changing children visibility anytime later
}

private fun AdapterPlayerHeaderBinding.updatePlayerViewsAccessibility(enable: Boolean) {
val importantForAccessibility = if (enable) View.IMPORTANT_FOR_ACCESSIBILITY_YES else View.IMPORTANT_FOR_ACCESSIBILITY_NO
episodeTitle.importantForAccessibility = importantForAccessibility
chapterTimeRemaining.importantForAccessibility = importantForAccessibility
chapterSummary.importantForAccessibility = importantForAccessibility
nextChapter.importantForAccessibility = importantForAccessibility
previousChapter.importantForAccessibility = importantForAccessibility
podcastTitle.importantForAccessibility = importantForAccessibility
}

private fun setupUpNextDrag(binding: AdapterPlayerHeaderBinding) {
val flingGestureDetector = GestureDetectorCompat(
requireContext(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,11 @@ fun TranscriptToolbar(
.padding(start = 16.dp),
onClick = onCloseClick,
tintColor = TranscriptColors.iconColor(),
contentDescription = if (expandSearch) {
stringResource(LR.string.transcript_search_close)
} else {
stringResource(LR.string.transcript_close)
},
)
}

Expand All @@ -191,7 +196,7 @@ fun TranscriptToolbar(
) {
Icon(
imageVector = Icons.Default.Search,
contentDescription = stringResource(LR.string.search),
contentDescription = stringResource(LR.string.transcript_search),
tint = Color.White,
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:importantForAccessibility="no"
android:fillViewport="true">

<androidx.constraintlayout.widget.ConstraintLayout
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:importantForAccessibility="no">
<LinearLayout
android:orientation="vertical"
android:layout_width="match_parent"
Expand Down Expand Up @@ -94,6 +95,7 @@
android:id="@+id/viewPager"
android:layout_width="match_parent"
android:layout_height="0dp"
android:importantForAccessibility="no"
android:layout_weight="1" />
</LinearLayout>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,14 @@ fun CloseButton(
onClick: () -> Unit,
modifier: Modifier = Modifier,
tintColor: Color = Color.White,
contentDescription: String = stringResource(NavigationButton.Close.contentDescription),
) = IconButton(
onClick = onClick,
modifier = modifier,
) {
Icon(
imageVector = NavigationButton.Close.image,
contentDescription = stringResource(NavigationButton.Close.contentDescription),
contentDescription = contentDescription,
tint = tintColor,
)
}
Expand Down
3 changes: 3 additions & 0 deletions modules/services/localization/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1901,6 +1901,9 @@ up <string name="player_sleep_in_one_chapter">Sleeping in 1 chapter</string>
<string name="error_transcript_format_not_supported">Sorry, but this transcript format is not supported: %s</string>
<string name="error_transcript_failed_to_parse">Sorry, but something went wrong while parsing this transcript.</string>
<string name="transcript_empty">Transcript is empty.</string>
<string name="transcript_close">Close transcript</string>
<string name="transcript_search">Search transcript</string>
<string name="transcript_search_close">Close search</string>

<!-- Tasker Plugin-->

Expand Down

0 comments on commit f354e0b

Please sign in to comment.