mirror of
https://github.com/oxen-io/session-android.git
synced 2025-06-09 13:18:34 +00:00
Fix drawable crash on API 19.
This commit is contained in:
parent
d59e4f2da7
commit
1ccce24cf8
@ -5,12 +5,10 @@ import android.graphics.Color;
|
|||||||
import android.graphics.PorterDuff;
|
import android.graphics.PorterDuff;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.graphics.drawable.LayerDrawable;
|
import android.graphics.drawable.LayerDrawable;
|
||||||
|
import android.widget.ImageView;
|
||||||
|
|
||||||
import androidx.annotation.DrawableRes;
|
import androidx.annotation.DrawableRes;
|
||||||
import androidx.appcompat.content.res.AppCompatResources;
|
import androidx.appcompat.content.res.AppCompatResources;
|
||||||
import androidx.core.content.ContextCompat;
|
|
||||||
import androidx.core.graphics.drawable.DrawableCompat;
|
|
||||||
|
|
||||||
import android.widget.ImageView;
|
|
||||||
|
|
||||||
import com.amulyakhare.textdrawable.TextDrawable;
|
import com.amulyakhare.textdrawable.TextDrawable;
|
||||||
import com.makeramen.roundedimageview.RoundedDrawable;
|
import com.makeramen.roundedimageview.RoundedDrawable;
|
||||||
@ -55,7 +53,7 @@ public class ResourceContactPhoto implements FallbackContactPhoto {
|
|||||||
|
|
||||||
private Drawable buildDrawable(Context context, int resourceId, int color, boolean inverted) {
|
private Drawable buildDrawable(Context context, int resourceId, int color, boolean inverted) {
|
||||||
Drawable background = TextDrawable.builder().buildRound(" ", inverted ? Color.WHITE : color);
|
Drawable background = TextDrawable.builder().buildRound(" ", inverted ? Color.WHITE : color);
|
||||||
RoundedDrawable foreground = (RoundedDrawable) RoundedDrawable.fromDrawable(ContextCompat.getDrawable(context, resourceId));
|
RoundedDrawable foreground = (RoundedDrawable) RoundedDrawable.fromDrawable(AppCompatResources.getDrawable(context, resourceId));
|
||||||
|
|
||||||
foreground.setScaleType(ImageView.ScaleType.CENTER);
|
foreground.setScaleType(ImageView.ScaleType.CENTER);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user