Merge 8b07ffcd2b
into 9d02eb33c7
This commit is contained in:
commit
e6383569e7
|
@ -8,6 +8,7 @@ import android.graphics.drawable.LayerDrawable;
|
|||
import android.widget.ImageView;
|
||||
|
||||
import androidx.annotation.DrawableRes;
|
||||
import androidx.appcompat.content.res.AppCompatResources;
|
||||
|
||||
import com.amulyakhare.textdrawable.TextDrawable;
|
||||
import com.makeramen.roundedimageview.RoundedDrawable;
|
||||
|
@ -31,7 +32,7 @@ public class ResourceContactPhoto implements FallbackContactPhoto {
|
|||
@Override
|
||||
public Drawable asDrawable(Context context, int color, boolean inverted) {
|
||||
Drawable background = TextDrawable.builder().buildRound(" ", inverted ? Color.WHITE : color);
|
||||
RoundedDrawable foreground = (RoundedDrawable) RoundedDrawable.fromDrawable(context.getResources().getDrawable(resourceId));
|
||||
RoundedDrawable foreground = (RoundedDrawable) RoundedDrawable.fromDrawable(AppCompatResources.getDrawable(context, resourceId);
|
||||
|
||||
foreground.setScaleType(ImageView.ScaleType.CENTER_CROP);
|
||||
|
||||
|
@ -39,8 +40,10 @@ public class ResourceContactPhoto implements FallbackContactPhoto {
|
|||
foreground.setColorFilter(color, PorterDuff.Mode.SRC_ATOP);
|
||||
}
|
||||
|
||||
Drawable gradient = context.getResources().getDrawable(ThemeUtil.isDarkTheme(context) ? R.drawable.avatar_gradient_dark
|
||||
: R.drawable.avatar_gradient_light);
|
||||
Drawable gradient = AppCompatResources.getDrawable(
|
||||
context,
|
||||
ThemeUtil.isDarkTheme(context) ? R.drawable.avatar_gradient_dark : R.drawable.avatar_gradient_light
|
||||
);
|
||||
|
||||
return new ExpandingLayerDrawable(new Drawable[] {background, foreground, gradient});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue