Add a new activity that allows editing key profiles

This commit is contained in:
Alexander Bakker 2017-12-27 22:04:22 +01:00
parent 05cfc0bc5f
commit 07c3e43160
15 changed files with 551 additions and 13 deletions

View file

@ -1,5 +1,8 @@
package me.impy.aegis;
import com.amulyakhare.textdrawable.TextDrawable;
import com.amulyakhare.textdrawable.util.ColorGenerator;
import java.io.Serializable;
import java.lang.reflect.UndeclaredThrowableException;
@ -29,4 +32,16 @@ public class KeyProfile implements Serializable {
}
return _code;
}
public TextDrawable getDrawable() {
String name = _entry.getName();
if (name == null) {
return null;
}
ColorGenerator generator = ColorGenerator.MATERIAL;
int color = generator.getColor(name);
return TextDrawable.builder().buildRound(name.substring(0, 1).toUpperCase(), color);
}
}