Fix default favorite color

This commit is contained in:
Alexey Kulish 2015-10-21 14:53:25 +03:00
parent ac8c6d7cd8
commit 76f20fa5ee

View file

@ -5,6 +5,7 @@ import android.content.res.Resources;
import android.graphics.Bitmap; import android.graphics.Bitmap;
import android.graphics.BitmapFactory; import android.graphics.BitmapFactory;
import android.graphics.Canvas; import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.ColorFilter; import android.graphics.ColorFilter;
import android.graphics.Paint; import android.graphics.Paint;
import android.graphics.PorterDuff; import android.graphics.PorterDuff;
@ -29,7 +30,8 @@ public class FavoriteImageDrawable extends Drawable {
this.resources = ctx.getResources(); this.resources = ctx.getResources();
this.color = color; this.color = color;
paintIcon = new Paint(); paintIcon = new Paint();
paintIcon.setColorFilter(new PorterDuffColorFilter(color, PorterDuff.Mode.SRC_IN)); int col = color == 0 || color == Color.BLACK ? getResources().getColor(R.color.color_favorite) : color;
paintIcon.setColorFilter(new PorterDuffColorFilter(col, PorterDuff.Mode.SRC_IN));
paintBackground = new Paint(); paintBackground = new Paint();
favIcon = BitmapFactory.decodeResource(ctx.getResources(), R.drawable.ic_action_fav_dark); favIcon = BitmapFactory.decodeResource(ctx.getResources(), R.drawable.ic_action_fav_dark);
favBackground = BitmapFactory.decodeResource(ctx.getResources(), R.drawable.map_white_shield); favBackground = BitmapFactory.decodeResource(ctx.getResources(), R.drawable.map_white_shield);