fix(hct): Hardcode the names of Outline text and HCT in our notif.
This should help prevent localization issues caused by capitalization of this templated string, since these feature names should not be capitalized unless they are at the beginning of the sentence. The 'Settings' app name should always be capitalized since it's the proper name of an app, so that remains templated. Bug: 399358129 Test: atest HighContrastTextMigrationReceiverTest; (this test asserts against a hardcoded version of the entire string) Flag: com.android.graphics.hwui.flags.high_contrast_text_small_text_rect Change-Id: Iaaa2ac10a56c1e4f7e5a8fd0d1c8eaf8b0293a27
This commit is contained in:
@@ -5541,8 +5541,8 @@
|
||||
<string name="accessibility_toggle_high_text_contrast_preference_summary">Change text color to black or white. Maximizes contrast with the background.</string>
|
||||
<!-- Title for the notification that high contrast text has been replaced. [CHAR LIMIT=NONE] -->
|
||||
<string name="accessibility_notification_high_contrast_text_title">Improve text contrast</string>
|
||||
<!-- Text content for the notification that high contrast text has been replaced. [CHAR LIMIT=NONE] -->
|
||||
<string name="accessibility_notification_high_contrast_text_body"><xliff:g example="Outline text" id="outline_text">%1$s</xliff:g> has replaced <xliff:g example="high contrast text" id="high_contrast_text">%2$s</xliff:g>. You can turn it on in <xliff:g example="Settings" id="settings">%3$s</xliff:g>.</string>
|
||||
<!-- Text content for the notification that the accessibility feature called "high contrast text" has been replaced by a new feature called "outline text". [CHAR LIMIT=NONE] -->
|
||||
<string name="accessibility_notification_high_contrast_text_body_message">Outline text has replaced high contrast text. You can turn it on in <xliff:g example="Settings" id="settings">%1$s</xliff:g>.</string>
|
||||
<!-- Action for the notification to high contrast text to open the Settings app. [CHAR LIMIT=35] -->
|
||||
<string name="accessibility_notification_high_contrast_text_action_open_settings">Go to <xliff:g example="Settings" id="settings">%1$s</xliff:g></string>
|
||||
<!-- Title for the accessibility preference that adds an outline behind text to increase contrast and legibility. [CHAR LIMIT=35] -->
|
||||
|
@@ -43,7 +43,6 @@ import com.google.common.annotations.VisibleForTesting;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* Handling smooth migration to the new high contrast text appearance
|
||||
@@ -134,15 +133,10 @@ public class HighContrastTextMigrationReceiver extends BroadcastReceiver {
|
||||
}
|
||||
|
||||
private String getNotificationContentText(Context context) {
|
||||
final String newName = context.getString(
|
||||
R.string.accessibility_toggle_maximize_text_contrast_preference_title);
|
||||
final String oldName = context.getString(
|
||||
R.string.accessibility_toggle_high_text_contrast_preference_title)
|
||||
.toLowerCase(Locale.getDefault());
|
||||
final String settingsAppName = context.getString(R.string.settings_label);
|
||||
return context.getString(
|
||||
R.string.accessibility_notification_high_contrast_text_body,
|
||||
newName, oldName, settingsAppName);
|
||||
R.string.accessibility_notification_high_contrast_text_body_message,
|
||||
settingsAppName);
|
||||
}
|
||||
|
||||
private void showNotification(Context context) {
|
||||
|
Reference in New Issue
Block a user