Small improvement

This commit is contained in:
M66B 2019-10-14 13:52:04 +02:00
parent 0eca86845d
commit 4438911940
1 changed files with 15 additions and 17 deletions

View File

@ -551,28 +551,26 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
boolean circular = prefs.getBoolean("circular", true); boolean circular = prefs.getBoolean("circular", true);
int size = Helper.dp2pixels(context, 36); int size = Helper.dp2pixels(context, 36);
byte[] hash = ImageHelper.getHash("test@example.com"); byte[] ahash = ImageHelper.getHash("abc@example.com");
byte[] bhash = ImageHelper.getHash("bcd@example.com");
byte[] chash = ImageHelper.getHash("cde@example.com");
Integer radius = (circular && !identicons ? null : Helper.dp2pixels(context, 3)); Integer radius = (circular && !identicons ? null : Helper.dp2pixels(context, 3));
Bitmap red = identicons Bitmap red = (identicons
? ImageHelper.generateIdenticon(hash, 0f, size, 5, context) ? ImageHelper.generateIdenticon(ahash, 0f, size, 5, context)
: ImageHelper.generateLetterIcon("A", 0f, size, context); : ImageHelper.generateLetterIcon("A", 0f, size, context));
Bitmap green = identicons Bitmap green = (identicons
? ImageHelper.generateIdenticon(hash, 120f, size, 5, context) ? ImageHelper.generateIdenticon(bhash, 120f, size, 5, context)
: ImageHelper.generateLetterIcon("B", 120f, size, context); : ImageHelper.generateLetterIcon("B", 120f, size, context));
Bitmap blue = identicons Bitmap blue = (identicons
? ImageHelper.generateIdenticon(hash, 240f, size, 5, context) ? ImageHelper.generateIdenticon(chash, 240f, size, 5, context)
: ImageHelper.generateLetterIcon("C", 240f, size, context); : ImageHelper.generateLetterIcon("C", 240f, size, context));
red = ImageHelper.makeCircular(red, radius); ivRed.setImageBitmap(ImageHelper.makeCircular(red, radius));
green = ImageHelper.makeCircular(green, radius); ivGreen.setImageBitmap(ImageHelper.makeCircular(green, radius));
blue = ImageHelper.makeCircular(blue, radius); ivBlue.setImageBitmap(ImageHelper.makeCircular(blue, radius));
ivRed.setImageBitmap(red);
ivGreen.setImageBitmap(green);
ivBlue.setImageBitmap(blue);
} }
public static class FragmentDialogTheme extends FragmentDialogBase { public static class FragmentDialogTheme extends FragmentDialogBase {