Should popup the confirmation toast after clicking the reset button.

Goal: Users may not notice what the change after resetting all settings configs in the Text and reading options. So we will use the toast to give nice feedback for them.

Fix: 220126995
Test: make RunSettingsRoboTests  ROBOTEST_FILTER=TextReadingPreferenceFragmentTest
Change-Id: Ife42b0c9d8a0241d7b8c3e5dbe7f9f1e2a6d759a
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 462c677..a398c38 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -5306,6 +5306,8 @@
     <string name="accessibility_text_reading_preview_mail_content">Good morning!\n\nI just wanted to check how the designs are coming. Will they be ready before we start building the new balloons?</string>
     <!-- Title for the reset button of the accessibility text reading page to reset all preferences state. [CHAR LIMIT=25] -->
     <string name="accessibility_text_reading_reset_button_title">Reset settings</string>
+    <!-- Message for the toast after clicking the reset button of the dialog of the accessibility text reading page. [CHAR LIMIT=NONE] -->
+    <string name="accessibility_text_reading_reset_message">Display size and text settings have been reset</string>
     <!-- Title for the confirm dialog of reset settings. [CHAR LIMIT=NONE] -->
     <string name="accessibility_text_reading_confirm_dialog_title">Reset display size and text?</string>
     <!-- Message for the confirm dialog of reset settings. [CHAR LIMIT=NONE] -->
diff --git a/src/com/android/settings/accessibility/TextReadingPreferenceFragment.java b/src/com/android/settings/accessibility/TextReadingPreferenceFragment.java
index 1148584..a4ee961c 100644
--- a/src/com/android/settings/accessibility/TextReadingPreferenceFragment.java
+++ b/src/com/android/settings/accessibility/TextReadingPreferenceFragment.java
@@ -23,6 +23,7 @@
 import android.content.Context;
 import android.content.DialogInterface;
 import android.os.Bundle;
+import android.widget.Toast;
 
 import androidx.appcompat.app.AlertDialog;
 
@@ -178,6 +179,9 @@
         } else {
             mResetStateListeners.forEach(ResetStateListener::resetState);
         }
+
+        Toast.makeText(getPrefContext(), R.string.accessibility_text_reading_reset_message,
+                Toast.LENGTH_SHORT).show();
     }
 
     private List<ResetStateListener> getResetStateListeners() {
diff --git a/tests/robotests/src/com/android/settings/accessibility/TextReadingPreferenceFragmentTest.java b/tests/robotests/src/com/android/settings/accessibility/TextReadingPreferenceFragmentTest.java
index 1793cc2..b72cdf7 100644
--- a/tests/robotests/src/com/android/settings/accessibility/TextReadingPreferenceFragmentTest.java
+++ b/tests/robotests/src/com/android/settings/accessibility/TextReadingPreferenceFragmentTest.java
@@ -47,6 +47,7 @@
 import org.mockito.MockitoAnnotations;
 import org.robolectric.Robolectric;
 import org.robolectric.RobolectricTestRunner;
+import org.robolectric.shadows.ShadowToast;
 
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -104,4 +105,18 @@
         verify(listener1).resetState();
         verify(listener2).resetState();
     }
+
+    @Test
+    public void onDialogPositiveButtonClicked_boldTextEnabled_showToast() {
+        Settings.Secure.putInt(mContext.getContentResolver(),
+                Settings.Secure.FONT_WEIGHT_ADJUSTMENT, BOLD_TEXT_ADJUSTMENT);
+        final AlertDialog dialog = (AlertDialog) mFragment.onCreateDialog(
+                DialogEnums.DIALOG_RESET_SETTINGS);
+        dialog.show();
+
+        dialog.getButton(DialogInterface.BUTTON_POSITIVE).callOnClick();
+
+        assertThat(ShadowToast.getTextOfLatestToast())
+                .isEqualTo(mContext.getString(R.string.accessibility_text_reading_reset_message));
+    }
 }