Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit eff73403 authored by PETER LIANG's avatar PETER LIANG Committed by Automerger Merge Worker
Browse files

Merge "Should popup the confirmation toast after clicking the reset button."...

Merge "Should popup the confirmation toast after clicking the reset button." into tm-dev am: 8cb0439d

Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/17822267



Change-Id: I543d48929fffe3e7da4f218bcf99a7feeca143e3
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents a02cd9a9 8cb0439d
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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] -->
+4 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import android.app.settings.SettingsEnums;
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 @@ public class TextReadingPreferenceFragment extends DashboardFragment {
        } else {
            mResetStateListeners.forEach(ResetStateListener::resetState);
        }

        Toast.makeText(getPrefContext(), R.string.accessibility_text_reading_reset_message,
                Toast.LENGTH_SHORT).show();
    }

    private List<ResetStateListener> getResetStateListeners() {
+15 −0
Original line number Diff line number Diff line
@@ -47,6 +47,7 @@ import org.mockito.Mock;
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 @@ public class TextReadingPreferenceFragmentTest {
        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));
    }
}