mirror of https://github.com/M66B/FairEmail.git
A colorful world
This commit is contained in:
parent
5dbfd2bc8f
commit
bd6f0c4715
|
@ -61,16 +61,13 @@ import java.util.concurrent.Semaphore;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
class ImageHelper {
|
class ImageHelper {
|
||||||
private static final float MIN_LUMINANCE = 0.33f;
|
|
||||||
|
|
||||||
private static final ExecutorService executor =
|
private static final ExecutorService executor =
|
||||||
Helper.getBackgroundExecutor(1, "image");
|
Helper.getBackgroundExecutor(1, "image");
|
||||||
|
|
||||||
static Bitmap generateIdenticon(@NonNull String email, int size, int pixels, boolean dark) {
|
static Bitmap generateIdenticon(@NonNull String email, int size, int pixels, boolean dark) {
|
||||||
byte[] hash = getHash(email);
|
byte[] hash = getHash(email);
|
||||||
|
|
||||||
int c = email.hashCode() & 0xffffff | 0xff000000;
|
int color = Color.HSVToColor(new float[]{Math.abs(email.hashCode()) % 360, 0.5f, 1});
|
||||||
int color = Helper.adjustLuminance(c, dark, MIN_LUMINANCE);
|
|
||||||
|
|
||||||
Paint paint = new Paint();
|
Paint paint = new Paint();
|
||||||
paint.setColor(color);
|
paint.setColor(color);
|
||||||
|
@ -106,8 +103,7 @@ class ImageHelper {
|
||||||
if (text == null)
|
if (text == null)
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
int c = email.hashCode() & 0xffffff | 0xff000000;
|
int color = Color.HSVToColor(new float[]{Math.abs(email.hashCode()) % 360, 0.5f, 1});
|
||||||
int color = Helper.adjustLuminance(c, dark, MIN_LUMINANCE);
|
|
||||||
|
|
||||||
Bitmap bitmap = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888);
|
Bitmap bitmap = Bitmap.createBitmap(size, size, Bitmap.Config.ARGB_8888);
|
||||||
Canvas canvas = new Canvas(bitmap);
|
Canvas canvas = new Canvas(bitmap);
|
||||||
|
|
Loading…
Reference in New Issue