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

Commit d82f6583 authored by Oleg Petšjonkin's avatar Oleg Petšjonkin Committed by Android (Google) Code Review
Browse files

Merge "Fixing resolution announced by Talkback" into main

parents ac0cb81e df5313a0
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -3021,6 +3021,8 @@
    <string name="screen_resolution_option_full">Max resolution</string>
    <!-- The footer message for switch screen resolution [CHAR LIMIT=NONE] -->
    <string name="screen_resolution_footer">Max resolution uses more of your battery. Switching your resolution may cause some apps to restart.</string>
    <!-- Screen resolution a11y message announced to replace 'x' in entry e.g. 600 by 800 [CHAR LIMIT=NONE] -->
    <string name="screen_resolution_delimiter_a11y"><xliff:g id="width">%1$s</xliff:g> by <xliff:g id="height">%2$s</xliff:g></string>
    <!-- Display settings screen, Color mode settings title [CHAR LIMIT=30] -->
    <string name="color_mode_title">Colors</string>
    <!-- Display settings screen, Color mode option for "natural(sRGB) color"  [CHAR LIMIT=45] -->
+14 −4
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import android.graphics.Point;
import android.graphics.drawable.Drawable;
import android.hardware.display.DisplayManager;
import android.provider.Settings;
import android.text.SpannableString;
import android.text.TextUtils;
import android.util.Log;
import android.view.Display;
@@ -32,6 +33,7 @@ import androidx.annotation.VisibleForTesting;
import androidx.preference.PreferenceScreen;

import com.android.settings.R;
import com.android.settings.Utils;
import com.android.settings.core.instrumentation.SettingsStatsLog;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settings.widget.RadioButtonPickerFragment;
@@ -58,7 +60,7 @@ public class ScreenResolutionFragment extends RadioButtonPickerFragment {
    private Display mDefaultDisplay;
    private String[] mScreenResolutionOptions;
    private Set<Point> mResolutions;
    private String[] mScreenResolutionSummaries;
    private SpannableString[] mScreenResolutionSummaries;

    private IllustrationPreference mImagePreference;
    private DisplayObserver mDisplayObserver;
@@ -84,12 +86,20 @@ public class ScreenResolutionFragment extends RadioButtonPickerFragment {
        mFullWidth = controller.getFullWidth();
        Log.i(TAG, "mHighWidth:" + mHighWidth + "mFullWidth:" + mFullWidth);
        mScreenResolutionSummaries =
                new String[] {
                    mHighWidth + " x " + controller.getHighHeight(),
                    mFullWidth + " x " + controller.getFullHeight()
                new SpannableString[] {
                    getResolutionSpannable(mHighWidth, controller.getHighHeight()),
                    getResolutionSpannable(mFullWidth, controller.getFullHeight())
                };
    }


    private SpannableString getResolutionSpannable(int width, int height) {
        String resolutionString = width + " x " + height;
        String accessibleText = mResources.getString(
                R.string.screen_resolution_delimiter_a11y, width, height);
        return Utils.createAccessibleSequence(resolutionString, accessibleText);
    }

    @Override
    protected int getPreferenceScreenResId() {
        return R.xml.screen_resolution_settings;