Fix color issue in the color selector on API 16

This commit is contained in:
Dima-1 2019-12-26 13:09:22 +02:00
parent bc0ef56fba
commit 1531ee3bec
4 changed files with 14 additions and 11 deletions

View file

@ -1,5 +1,6 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android" <shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval"> android:shape="oval">
<solid android:color="@android:color/transparent" />
<stroke <stroke
android:width="1dp" android:width="1dp"
android:color="@color/divider_color_dark" /> android:color="@color/divider_color_dark" />

View file

@ -1,5 +1,6 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android" <shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="oval"> android:shape="oval">
<solid android:color="@android:color/transparent" />
<stroke <stroke
android:width="1dp" android:width="1dp"
android:color="@color/divider_color_light" /> android:color="@color/divider_color_light" />

View file

@ -12,11 +12,11 @@
app:srcCompat="@drawable/circle_contour_bg_light" /> app:srcCompat="@drawable/circle_contour_bg_light" />
<ImageView <ImageView
android:id="@+id/bckgroundCircle" android:id="@+id/backgroundCircle"
android:layout_width="48dp" android:layout_width="48dp"
android:layout_height="48dp" android:layout_height="48dp"
android:layout_margin="4dp" android:layout_margin="4dp"
app:srcCompat="@drawable/ic_action_circle" /> app:srcCompat="@drawable/circle_background_light" />
<ImageView <ImageView
android:id="@+id/checkMark" android:id="@+id/checkMark"
@ -31,5 +31,4 @@
android:layout_marginStart="16dp" android:layout_marginStart="16dp"
android:layout_marginEnd="4dp" /> android:layout_marginEnd="4dp" />
</FrameLayout> </FrameLayout>

View file

@ -327,8 +327,9 @@ public class ProfileAppearanceFragment extends BaseSettingsFragment {
private View createColorItemView(final ApplicationMode.ProfileIconColors colorRes, ViewGroup rootView) { private View createColorItemView(final ApplicationMode.ProfileIconColors colorRes, ViewGroup rootView) {
FrameLayout colorItemView = (FrameLayout) UiUtilities.getInflater(getContext(), isNightMode()) FrameLayout colorItemView = (FrameLayout) UiUtilities.getInflater(getContext(), isNightMode())
.inflate(R.layout.preference_circle_item, rootView, false); .inflate(R.layout.preference_circle_item, rootView, false);
ImageView coloredCircle = colorItemView.findViewById(R.id.bckgroundCircle); ImageView coloredCircle = colorItemView.findViewById(R.id.backgroundCircle);
coloredCircle.setImageDrawable(getPaintedIcon(R.drawable.circle_background_light, AndroidUtils.setBackground(coloredCircle,
UiUtilities.tintDrawable(ContextCompat.getDrawable(app, R.drawable.circle_background_light),
ContextCompat.getColor(app, colorRes.getColor(isNightMode())))); ContextCompat.getColor(app, colorRes.getColor(isNightMode()))));
coloredCircle.setOnClickListener(new View.OnClickListener() { coloredCircle.setOnClickListener(new View.OnClickListener() {
@Override @Override
@ -365,8 +366,9 @@ public class ProfileAppearanceFragment extends BaseSettingsFragment {
.inflate(R.layout.preference_circle_item, rootView, false); .inflate(R.layout.preference_circle_item, rootView, false);
ImageView checkMark = iconItemView.findViewById(R.id.checkMark); ImageView checkMark = iconItemView.findViewById(R.id.checkMark);
checkMark.setImageDrawable(app.getUIUtilities().getIcon(iconRes, R.color.icon_color_default_light)); checkMark.setImageDrawable(app.getUIUtilities().getIcon(iconRes, R.color.icon_color_default_light));
ImageView coloredCircle = iconItemView.findViewById(R.id.bckgroundCircle); ImageView coloredCircle = iconItemView.findViewById(R.id.backgroundCircle);
coloredCircle.setImageDrawable(getPaintedIcon(R.drawable.circle_background_light, AndroidUtils.setBackground(coloredCircle,
UiUtilities.tintDrawable(ContextCompat.getDrawable(app, R.drawable.circle_background_light),
UiUtilities.getColorWithAlpha(ContextCompat.getColor(app, R.color.icon_color_default_light), 0.1f))); UiUtilities.getColorWithAlpha(ContextCompat.getColor(app, R.color.icon_color_default_light), 0.1f)));
coloredCircle.setOnClickListener(new View.OnClickListener() { coloredCircle.setOnClickListener(new View.OnClickListener() {
@Override @Override
@ -386,8 +388,8 @@ public class ProfileAppearanceFragment extends BaseSettingsFragment {
iconItem.findViewById(R.id.outlineCircle).setVisibility(View.GONE); iconItem.findViewById(R.id.outlineCircle).setVisibility(View.GONE);
ImageView checkMark = iconItem.findViewById(R.id.checkMark); ImageView checkMark = iconItem.findViewById(R.id.checkMark);
checkMark.setImageDrawable(app.getUIUtilities().getIcon(changedProfile.iconRes, R.color.icon_color_default_light)); checkMark.setImageDrawable(app.getUIUtilities().getIcon(changedProfile.iconRes, R.color.icon_color_default_light));
ImageView coloredCircle = iconItem.findViewById(R.id.bckgroundCircle); AndroidUtils.setBackground(iconItem.findViewById(R.id.backgroundCircle),
coloredCircle.setImageDrawable(getPaintedIcon(R.drawable.circle_background_light, UiUtilities.tintDrawable(ContextCompat.getDrawable(app, R.drawable.circle_background_light),
UiUtilities.getColorWithAlpha(ContextCompat.getColor(app, R.color.icon_color_default_light), 0.1f))); UiUtilities.getColorWithAlpha(ContextCompat.getColor(app, R.color.icon_color_default_light), 0.1f)));
changedProfile.iconRes = iconRes; changedProfile.iconRes = iconRes;
updateProfileButton(); updateProfileButton();
@ -398,8 +400,8 @@ public class ProfileAppearanceFragment extends BaseSettingsFragment {
app.getDaynightHelper().isNightModeForMapControls())); app.getDaynightHelper().isNightModeForMapControls()));
View iconItem = iconItems.findViewWithTag(iconRes); View iconItem = iconItems.findViewWithTag(iconRes);
if (iconItem != null) { if (iconItem != null) {
ImageView coloredCircle = iconItem.findViewById(R.id.bckgroundCircle); AndroidUtils.setBackground(iconItem.findViewById(R.id.backgroundCircle),
coloredCircle.setImageDrawable(getPaintedIcon(R.drawable.circle_background_light, UiUtilities.tintDrawable(ContextCompat.getDrawable(app, R.drawable.circle_background_light),
UiUtilities.getColorWithAlpha(ContextCompat.getColor(app, changedProfile.color.getColor(isNightMode())), 0.1f))); UiUtilities.getColorWithAlpha(ContextCompat.getColor(app, changedProfile.color.getColor(isNightMode())), 0.1f)));
ImageView outlineCircle = iconItem.findViewById(R.id.outlineCircle); ImageView outlineCircle = iconItem.findViewById(R.id.outlineCircle);
GradientDrawable circleContourDrawable = (GradientDrawable) ContextCompat.getDrawable(app, R.drawable.circle_contour_bg_light); GradientDrawable circleContourDrawable = (GradientDrawable) ContextCompat.getDrawable(app, R.drawable.circle_contour_bg_light);