Search in sources :

Example 1 with ColorGenerator

use of com.amulyakhare.textdrawable.util.ColorGenerator in project SeniorProject by 5731075221-PM.

the class CustomAdapterFirstaid method onBindViewHolder.

@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
    ((ListViewHolder) holder).blindView(position);
    String name = mFirstaids.get(position);
    String letter = String.valueOf(name.charAt(0));
    if (letter.equals("เ") || letter.equals("ใ") || letter.equals("ไ") || letter.equals("โ") || letter.equals("แ")) {
        letter = String.valueOf(name.charAt(1));
    }
    ColorGenerator generator = ColorGenerator.MATERIAL;
    TextDrawable drawable = TextDrawable.builder().buildRound(letter, generator.getRandomColor());
    ((ListViewHolder) holder).charac.setImageDrawable(drawable);
}
Also used : TextDrawable(com.amulyakhare.textdrawable.TextDrawable) ColorGenerator(com.amulyakhare.textdrawable.util.ColorGenerator)

Aggregations

TextDrawable (com.amulyakhare.textdrawable.TextDrawable)1 ColorGenerator (com.amulyakhare.textdrawable.util.ColorGenerator)1