public CountryChooserAdapter(Context context1, int layout, ArrayList<CountryItem> data) { super(context1, layout, data); context = context1; this.data = data; this.layout = layout; mDrawableBuilder = TextDrawable.builder().beginConfig().toUpperCase().endConfig().round(); }
public TextDrawable getTextDrawableWithRadius(String text, int radius, int fontSize) { String initial = "N"; if (text.length() > 0) { initial = String.valueOf(text.charAt(0)); } ColorGenerator generator = ColorGenerator.MATERIAL; int color1 = generator.getColor(text); TextDrawable drawable = TextDrawable.builder() .beginConfig() .fontSize(fontSize) .bold() .endConfig() .buildRoundRect(initial.toUpperCase(), color1, radius); return drawable; }