mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 05:11:16 +00:00
Bug 1887126 - Add Extra to Toggle State for Page Settings and Improve Show Original r=android-reviewers,ayeddi,ohall
Differential Revision: https://phabricator.services.mozilla.com/D207341
This commit is contained in:
parent
838aaeeba5
commit
e95677bb53
@ -20,6 +20,7 @@ import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.layout.onGloballyPositioned
|
||||
import androidx.compose.ui.platform.ComposeView
|
||||
import androidx.compose.ui.platform.LocalDensity
|
||||
import androidx.compose.ui.platform.LocalView
|
||||
import androidx.compose.ui.platform.ViewCompositionStrategy
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.core.os.bundleOf
|
||||
@ -282,6 +283,8 @@ class TranslationsDialogFragment : BottomSheetDialogFragment() {
|
||||
onSettingClicked: () -> Unit,
|
||||
onShowDownloadLanguageFileDialog: () -> Unit,
|
||||
) {
|
||||
val localView = LocalView.current
|
||||
|
||||
TranslationsDialog(
|
||||
translationsDialogState = translationsDialogState,
|
||||
learnMoreUrl = learnMoreUrl,
|
||||
@ -297,6 +300,11 @@ class TranslationsDialogFragment : BottomSheetDialogFragment() {
|
||||
},
|
||||
onNegativeButtonClicked = {
|
||||
if (translationsDialogState.isTranslated) {
|
||||
localView.announceForAccessibility(
|
||||
requireContext().getString(
|
||||
R.string.translations_bottom_sheet_restore_accessibility_announcement,
|
||||
),
|
||||
)
|
||||
translationsDialogStore.dispatch(TranslationsDialogAction.RestoreTranslation)
|
||||
}
|
||||
dismiss()
|
||||
@ -393,6 +401,8 @@ class TranslationsDialogFragment : BottomSheetDialogFragment() {
|
||||
state.translationEngine.offerTranslation
|
||||
}.value
|
||||
|
||||
val localView = LocalView.current
|
||||
|
||||
TranslationsOptionsDialog(
|
||||
context = requireContext(),
|
||||
translationPageSettings = pageSettingsState,
|
||||
@ -409,6 +419,10 @@ class TranslationsDialogFragment : BottomSheetDialogFragment() {
|
||||
checked,
|
||||
),
|
||||
)
|
||||
|
||||
if (checked) {
|
||||
localView.announceForAccessibility(type.descriptionId?.let { getString(it) })
|
||||
}
|
||||
},
|
||||
onBackClicked = onBackClicked,
|
||||
onTranslationSettingsClicked = {
|
||||
|
@ -2427,6 +2427,8 @@
|
||||
<string name="translations_bottom_sheet_negative_button">Not now</string>
|
||||
<!-- Button text on the translations dialog to restore the translated website back to the original untranslated version. -->
|
||||
<string name="translations_bottom_sheet_negative_button_restore">Show original</string>
|
||||
<!-- Accessibility announcement (not visible, for screen readers etc.) for the translations dialog after restore button was pressed that indicates the original untranslated page was loaded. -->
|
||||
<string name="translations_bottom_sheet_restore_accessibility_announcement">Original untranslated page loaded</string>
|
||||
<!-- Button text on the translations dialog when a translation error appears, used to dismiss the dialog and return to the browser. -->
|
||||
<string name="translations_bottom_sheet_negative_button_error">Done</string>
|
||||
<!-- Button text on the translations dialog to begin a translation of the website. -->
|
||||
|
Loading…
Reference in New Issue
Block a user