mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-14 11:49:04 +01:00
Increase contrast between identicon and background.
This commit is contained in:
@@ -17,7 +17,6 @@ package im.delight.android.identicons;
|
||||
*/
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
import org.briarproject.api.crypto.CryptoComponent;
|
||||
@@ -73,11 +72,6 @@ public class AsymmetricIdenticon extends IdenticonView {
|
||||
protected boolean isCellVisible(int row, int column) {
|
||||
return getByte(3 + row * getColumnCount() + column) >= 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getIconColor() {
|
||||
return Color.rgb(getByte(0) + 128, getByte(1) + 128, getByte(2) + 128);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -93,15 +93,15 @@ public abstract class IdenticonBase {
|
||||
|
||||
abstract protected boolean isCellVisible(int row, int column);
|
||||
|
||||
abstract protected int getIconColor();
|
||||
protected int getIconColor() {
|
||||
int r = getByte(0) * 3 / 4 + 96;
|
||||
int g = getByte(1) * 3 / 4 + 96;
|
||||
int b = getByte(2) * 3 / 4 + 96;
|
||||
return Color.rgb(r, g, b);
|
||||
}
|
||||
|
||||
protected int getBackgroundColor() {
|
||||
float[] hsv = new float[3];
|
||||
Color.colorToHSV(getIconColor(), hsv);
|
||||
if (hsv[2] < 0.5)
|
||||
return Color.parseColor("#ffeeeeee"); // @color/background_material_light
|
||||
else
|
||||
return Color.parseColor("#ff303030"); // @color/background_material_dark
|
||||
return Color.WHITE;
|
||||
}
|
||||
|
||||
public void updateSize(int w, int h) {
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package im.delight.android.identicons;
|
||||
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.ColorFilter;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.Drawable;
|
||||
@@ -39,11 +38,6 @@ public class IdenticonDrawable extends Drawable {
|
||||
protected boolean isCellVisible(int row, int column) {
|
||||
return getByte(3 + row * CENTER_COLUMN_INDEX + getSymmetricColumnIndex(column)) >= 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getIconColor() {
|
||||
return Color.rgb(getByte(0) + 128, getByte(1) + 128, getByte(2) + 128);
|
||||
}
|
||||
};
|
||||
mDelegate.show(toShow);
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@ package im.delight.android.identicons;
|
||||
*/
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
import org.briarproject.api.crypto.CryptoComponent;
|
||||
@@ -70,11 +69,6 @@ public class SymmetricIdenticon extends IdenticonView {
|
||||
protected boolean isCellVisible(int row, int column) {
|
||||
return getByte(3 + row * CENTER_COLUMN_INDEX + getSymmetricColumnIndex(column)) >= 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getIconColor() {
|
||||
return Color.rgb(getByte(0) + 128, getByte(1) + 128, getByte(2) + 128);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user