Merge "Update contentDescription to announce 'than' rather than '>'" into main

This commit is contained in:
Jason Hsu
2024-12-19 08:38:33 -08:00
committed by Android (Google) Code Review
2 changed files with 18 additions and 0 deletions

View File

@@ -5672,6 +5672,8 @@
<string name="accessibility_hearing_device_about_title">About hearing devices</string>
<!-- Description for text in accessibility hearing aids footer. [CHAR LIMIT=NONE BACKUP_MESSAGE_ID=7451899224828040581] -->
<string name="accessibility_hearing_device_footer_summary">To find other hearing devices that arent supported by ASHA or LE Audio, tap <b>Pair new device</b> > <b>See more devices</b></string>
<!-- Description for text in accessibility hearing aids footer. Replace '>' to 'then' for TTS to announce. [CHAR LIMIT=NONE BACKUP_MESSAGE_ID=7451899224828040581] -->
<string name="accessibility_hearing_device_footer_summary_tts">To find other hearing devices that arent supported by ASHA or LE Audio, tap <b>Pair new device</b> then <b>See more devices</b></string>
<!-- Title for the pair hearing device page. [CHAR LIMIT=25] -->
<string name="accessibility_hearing_device_pairing_page_title">Pair hearing device</string>
<!-- Subtitle for the pair hearing device page. [CHAR LIMIT=NONE] -->

View File

@@ -18,6 +18,9 @@ package com.android.settings.accessibility;
import android.content.Context;
import androidx.annotation.NonNull;
import androidx.preference.PreferenceScreen;
import com.android.settings.R;
/** Preference controller for footer in hearing device page. */
@@ -32,4 +35,17 @@ public class HearingDeviceFooterPreferenceController extends
protected String getIntroductionTitle() {
return mContext.getString(R.string.accessibility_hearing_device_about_title);
}
@Override
public void displayPreference(@NonNull PreferenceScreen screen) {
super.displayPreference(screen);
final AccessibilityFooterPreference footerPreference =
screen.findPreference(getPreferenceKey());
// Need to update contentDescription string to announce "than" rather than ">"
final String summaryTts = mContext.getString(
R.string.accessibility_hearing_device_footer_summary_tts);
final String contentDescription = getIntroductionTitle() + "\n\n" + summaryTts;
footerPreference.setContentDescription(contentDescription);
}
}