|
|
|
@ -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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|