remove unused inverted-avatars

This commit is contained in:
B. Petersen
2019-05-22 22:51:01 +02:00
parent 87ae0e9d37
commit ecbbe30259
6 changed files with 5 additions and 50 deletions
@@ -59,7 +59,7 @@ public class AvatarImageView extends AppCompatImageView {
setAvatarClickHandler(recipient, quickContactEnabled);
}
} else {
setImageDrawable(new GeneratedContactPhoto("+").asDrawable(getContext(), ThemeUtil.getDummyContactColor(getContext()), false));
setImageDrawable(new GeneratedContactPhoto("+").asDrawable(getContext(), ThemeUtil.getDummyContactColor(getContext())));
super.setOnClickListener(listener);
}
}
@@ -6,7 +6,6 @@ import android.graphics.drawable.Drawable;
public interface FallbackContactPhoto {
public Drawable asDrawable(Context context, int color);
public Drawable asDrawable(Context context, int color, boolean inverted);
public Drawable asCallCard(Context context);
}
@@ -25,20 +25,15 @@ public class GeneratedContactPhoto implements FallbackContactPhoto {
@Override
public Drawable asDrawable(Context context, int color) {
return asDrawable(context, color, false);
}
@Override
public Drawable asDrawable(Context context, int color, boolean inverted) {
int targetSize = context.getResources().getDimensionPixelSize(R.dimen.contact_photo_target_size);
return TextDrawable.builder()
.beginConfig()
.width(targetSize)
.height(targetSize)
.textColor(inverted ? color : Color.WHITE)
.textColor(Color.WHITE)
.endConfig()
.buildRound(getCharacter(name), inverted ? Color.WHITE : color);
.buildRound(getCharacter(name), color);
}
private String getCharacter(String name) {
@@ -28,20 +28,11 @@ public class ResourceContactPhoto implements FallbackContactPhoto {
@Override
public Drawable asDrawable(Context context, int color) {
return asDrawable(context, color, false);
}
@Override
public Drawable asDrawable(Context context, int color, boolean inverted) {
Drawable background = TextDrawable.builder().buildRound(" ", inverted ? Color.WHITE : color);
Drawable background = TextDrawable.builder().buildRound(" ", color);
RoundedDrawable foreground = (RoundedDrawable) RoundedDrawable.fromDrawable(context.getResources().getDrawable(resourceId));
foreground.setScaleType(ImageView.ScaleType.CENTER);
if (inverted) {
foreground.setColorFilter(color, PorterDuff.Mode.SRC_ATOP);
}
return new ExpandingLayerDrawable(new Drawable[] {background, foreground});
}
@@ -1,30 +0,0 @@
package org.thoughtcrime.securesms.contacts.avatars;
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.support.v4.content.ContextCompat;
import com.makeramen.roundedimageview.RoundedDrawable;
import org.thoughtcrime.securesms.R;
public class TransparentContactPhoto implements FallbackContactPhoto {
public TransparentContactPhoto() {}
@Override
public Drawable asDrawable(Context context, int color) {
return asDrawable(context, color, false);
}
@Override
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 ContextCompat.getDrawable(context, R.drawable.ic_contact_picture_large);
}
}
@@ -203,7 +203,7 @@ public class Recipient {
}
public synchronized @NonNull Drawable getFallbackAvatarDrawable(Context context) {
return getFallbackContactPhoto().asDrawable(context, getFallbackAvatarColor(context), false);
return getFallbackContactPhoto().asDrawable(context, getFallbackAvatarColor(context));
}
public synchronized @NonNull FallbackContactPhoto getFallbackContactPhoto() {