Merge "Fixing resolution announced by Talkback" into main

This commit is contained in:
Oleg Petšjonkin
2025-03-04 02:37:03 -08:00
committed by Android (Google) Code Review
2 changed files with 16 additions and 4 deletions

View File

@@ -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;