Update the background of the Daltonizer preview.
Add the corner radii in to be consistent with the Settings style. Bug: 213440059 Test: manual test Change-Id: I68edf243ae33e9bb1e39020ad7553451fad66477
This commit is contained in:
@@ -148,6 +148,8 @@ public final class PaletteListPreference extends Preference {
|
||||
|
||||
rootView.addView(textView);
|
||||
}
|
||||
|
||||
updateFirstAndLastItemsBackground(context, rootView, paletteData.size());
|
||||
}
|
||||
|
||||
private GradientDrawable createGradientDrawable(ViewGroup rootView, @ColorInt int color) {
|
||||
@@ -164,6 +166,19 @@ public final class PaletteListPreference extends Preference {
|
||||
return gradientDrawable;
|
||||
}
|
||||
|
||||
private void updateFirstAndLastItemsBackground(Context context, ViewGroup rootView, int size) {
|
||||
final int radius =
|
||||
context.getResources().getDimensionPixelSize(
|
||||
R.dimen.accessibility_illustration_view_radius);
|
||||
final int lastIndex = size - 1;
|
||||
final GradientDrawable firstItem =
|
||||
(GradientDrawable) rootView.getChildAt(0).getBackground();
|
||||
final GradientDrawable lastItem =
|
||||
(GradientDrawable) rootView.getChildAt(lastIndex).getBackground();
|
||||
firstItem.setCornerRadii(new float[]{radius, radius, radius, radius, 0, 0, 0, 0});
|
||||
lastItem.setCornerRadii(new float[]{0, 0, 0, 0, radius, radius, radius, radius});
|
||||
}
|
||||
|
||||
private List<Integer> getPaletteColors(Context context) {
|
||||
final int[] paletteResources =
|
||||
context.getResources().getIntArray(R.array.setting_palette_colors);
|
||||
|
Reference in New Issue
Block a user