MainActivity is now using CircleImageView too

This commit is contained in:
Michael Schättgen 2018-06-06 23:53:33 +02:00
parent 34b6cf944f
commit 97eb3490d8
5 changed files with 20 additions and 14 deletions

View file

@ -1,5 +1,7 @@
package me.impy.aegis.helpers;
import android.view.View;
import com.amulyakhare.textdrawable.TextDrawable;
import com.amulyakhare.textdrawable.util.ColorGenerator;
@ -8,7 +10,7 @@ public class TextDrawableHelper {
}
public static TextDrawable generate(String s) {
public static TextDrawable generate(String s, View view) {
if (s == null || s.length() <= 1) {
return null;
}
@ -16,7 +18,7 @@ public class TextDrawableHelper {
ColorGenerator generator = ColorGenerator.MATERIAL;
int color = generator.getColor(s);
return TextDrawable.builder().beginConfig()
.width(100)
.height(100).endConfig().buildRect(s.substring(0, 1).toUpperCase(), color);
.width(view.getWidth())
.height(view.getHeight()).endConfig().buildRect(s.substring(0, 1).toUpperCase(), color);
}
}