Fix number localization in the strings.xml

The numbers in the strings.xml should honor user settings.
To fix it we use messageformat to fill the
numbers.

Bug: 187526475
Test: manually test
Change-Id: I3e7ad96d4b889dbbfebb7110ca7ee2a738b88fd8
diff --git a/res/values/strings.xml b/res/values/strings.xml
index e023c70..9cae25b 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -5273,16 +5273,16 @@
     <string name="accessibility_screen_magnification_summary">
         <![CDATA[Quickly zoom in on the screen to make content larger.<br/><br/>
         <b>To zoom in:</b><br/>
-        1. Use shortcut to start magnification<br/>
-        2. Tap the screen<br/>
-        3. Drag 2 fingers to move around screen<br/>
-        4. Pinch with 2 fingers to adjust zoom<br/>
-        5. Use shortcut to stop magnification<br/><br/>
+        {0,number,integer}. Use shortcut to start magnification<br/>
+        {1,number,integer}. Tap the screen<br/>
+        {2,number,integer}. Drag 2 fingers to move around screen<br/>
+        {3,number,integer}. Pinch with 2 fingers to adjust zoom<br/>
+        {4,number,integer}. Use shortcut to stop magnification<br/><br/>
         <b>To zoom in temporarily:</b><br/>
-        1. Use shortcut to start magnification<br/>
-        2. Touch & hold anywhere on the screen<br/>
-        3. Drag finger to move around screen<br/>
-        4. Lift finger to stop magnification
+        {0,number,integer}. Use shortcut to start magnification<br/>
+        {1,number,integer}. Touch & hold anywhere on the screen<br/>
+        {2,number,integer}. Drag finger to move around screen<br/>
+        {3,number,integer}. Lift finger to stop magnification
         ]]>
     </string>
     <!-- Summary for the accessibility preference screen to enable screen magnification via the nav bar. [CHAR LIMIT=none] -->
@@ -5348,7 +5348,7 @@
     <!-- Part of list to compose user's accessibility shortcut list. [CHAR LIMIT=NONE] -->
     <string name="accessibility_shortcut_triple_tap_keyword">triple-tap screen</string>
     <!-- Summary for triple tap shortcut in accessibility edit shortcut dialog. [CHAR LIMIT=NONE] -->
-    <string name="accessibility_shortcut_edit_dialog_summary_triple_tap">Quickly tap screen 3 times. This shortcut may slow down your device</string>
+    <string name="accessibility_shortcut_edit_dialog_summary_triple_tap">Quickly tap screen {0,number,integer} times. This shortcut may slow down your device</string>
     <!-- Title for the accessibility edit shortcut dialog to save the preference when user clicks it. [CHAR LIMIT=20] -->
     <string name="accessibility_shortcut_edit_dialog_title_advance">Advanced</string>
     <!-- Summary text appearing on the accessibility preference screen to enable screen magnification from the nav bar when the feature is enabled, but the accessibility button is not configured correctly for the feature to be used [CHAR LIMIT=none] -->
diff --git a/src/com/android/settings/accessibility/AccessibilityEditDialogUtils.java b/src/com/android/settings/accessibility/AccessibilityEditDialogUtils.java
index 6a9d0cf..c1ac604 100644
--- a/src/com/android/settings/accessibility/AccessibilityEditDialogUtils.java
+++ b/src/com/android/settings/accessibility/AccessibilityEditDialogUtils.java
@@ -24,6 +24,7 @@
 import android.content.DialogInterface;
 import android.content.res.TypedArray;
 import android.graphics.drawable.Drawable;
+import android.icu.text.MessageFormat;
 import android.text.Spannable;
 import android.text.SpannableString;
 import android.text.SpannableStringBuilder;
@@ -318,8 +319,12 @@
         final View dialogView = view.findViewById(R.id.triple_tap_shortcut);
         final CharSequence title = context.getText(
                 R.string.accessibility_shortcut_edit_dialog_title_triple_tap);
-        final CharSequence summary = context.getText(
+        String summary = context.getString(
                 R.string.accessibility_shortcut_edit_dialog_summary_triple_tap);
+        // Format the number '3' in the summary.
+        final Object[] arguments = {3};
+        summary = MessageFormat.format(summary, arguments);
+
         setupShortcutWidget(dialogView, title, summary,
                 R.drawable.accessibility_shortcut_type_triple_tap);
         // TODO(b/142531156): Use vector drawable instead of temporal png file to avoid distorted.
diff --git a/src/com/android/settings/accessibility/MagnificationGesturesPreferenceController.java b/src/com/android/settings/accessibility/MagnificationGesturesPreferenceController.java
index 6883644..900e280 100644
--- a/src/com/android/settings/accessibility/MagnificationGesturesPreferenceController.java
+++ b/src/com/android/settings/accessibility/MagnificationGesturesPreferenceController.java
@@ -14,6 +14,7 @@
 package com.android.settings.accessibility;
 
 import android.content.Context;
+import android.icu.text.MessageFormat;
 import android.os.Bundle;
 import android.provider.Settings;
 import android.text.TextUtils;
@@ -93,8 +94,12 @@
                 Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED);
         extras.putInt(AccessibilitySettings.EXTRA_TITLE_RES,
                 R.string.accessibility_screen_magnification_gestures_title);
-        extras.putCharSequence(AccessibilitySettings.EXTRA_HTML_DESCRIPTION,
-                context.getText(R.string.accessibility_screen_magnification_summary));
+
+        String summary =  context.getString(R.string.accessibility_screen_magnification_summary);
+        final Object[] numberArguments = {1, 2, 3, 4, 5};
+        summary = MessageFormat.format(summary, numberArguments);
+        extras.putCharSequence(AccessibilitySettings.EXTRA_HTML_DESCRIPTION, summary);
+
         extras.putInt(AccessibilitySettings.EXTRA_VIDEO_RAW_RESOURCE_ID,
                 R.raw.accessibility_screen_magnification);
     }