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:
@@ -18,7 +18,9 @@
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/preview_viewport"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
|
||||
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/palette_view"
|
||||
|
@@ -289,6 +289,7 @@
|
||||
<dimen name="accessibility_layout_margin_start_end">16dp</dimen>
|
||||
<dimen name="accessibility_button_preference_padding_top_bottom">18dp</dimen>
|
||||
<dimen name="accessibility_imageview_size">176dp</dimen>
|
||||
<dimen name="accessibility_illustration_view_radius">28dp</dimen>
|
||||
<!-- The margin between two Textviews-->
|
||||
<dimen name="accessibility_textview_layout_margin_bottom">24dp</dimen>
|
||||
|
||||
|
@@ -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