mirror of
https://github.com/oxen-io/session-android.git
synced 2025-10-25 23:08:49 +00:00
Support for Signal calls.
Merge in RedPhone // FREEBIE
This commit is contained in:
@@ -2,6 +2,7 @@ package org.thoughtcrime.securesms.contacts.avatars;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.drawable.BitmapDrawable;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.widget.ImageView;
|
||||
|
||||
@@ -26,4 +27,9 @@ public class BitmapContactPhoto implements ContactPhoto {
|
||||
.setScaleType(ImageView.ScaleType.CENTER_CROP)
|
||||
.setOval(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Drawable asCallCard(Context context) {
|
||||
return new BitmapDrawable(context.getResources(), bitmap);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,6 @@ public interface ContactPhoto {
|
||||
|
||||
public Drawable asDrawable(Context context, int color);
|
||||
public Drawable asDrawable(Context context, int color, boolean inverted);
|
||||
|
||||
public Drawable asCallCard(Context context);
|
||||
|
||||
}
|
||||
|
||||
@@ -35,4 +35,9 @@ public class GeneratedContactPhoto implements ContactPhoto {
|
||||
.endConfig()
|
||||
.buildRound(String.valueOf(name.charAt(0)), inverted ? Color.WHITE : color);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Drawable asCallCard(Context context) {
|
||||
return context.getDrawable(R.drawable.ic_contact_picture);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,6 +40,11 @@ public class ResourceContactPhoto implements ContactPhoto {
|
||||
return new ExpandingLayerDrawable(new Drawable[] {background, foreground});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Drawable asCallCard(Context context) {
|
||||
return context.getDrawable(resourceId);
|
||||
}
|
||||
|
||||
private static class ExpandingLayerDrawable extends LayerDrawable {
|
||||
public ExpandingLayerDrawable(Drawable[] layers) {
|
||||
super(layers);
|
||||
|
||||
@@ -5,6 +5,8 @@ import android.graphics.drawable.Drawable;
|
||||
|
||||
import com.makeramen.roundedimageview.RoundedDrawable;
|
||||
|
||||
import org.thoughtcrime.securesms.R;
|
||||
|
||||
public class TransparentContactPhoto implements ContactPhoto {
|
||||
|
||||
TransparentContactPhoto() {}
|
||||
@@ -18,4 +20,9 @@ public class TransparentContactPhoto implements ContactPhoto {
|
||||
public Drawable asDrawable(Context context, int color, boolean inverted) {
|
||||
return RoundedDrawable.fromDrawable(context.getResources().getDrawable(android.R.color.transparent));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Drawable asCallCard(Context context) {
|
||||
return context.getDrawable(R.drawable.ic_contact_picture);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user