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"
android:shape="oval">
<solid android:color="@android:color/transparent" />
<stroke
android:width="1dp"
android:color="@color/divider_color_dark" />

View file

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

View file

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

View file

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