Increase contrast between identicon and background.

parent 43558ca0
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
......@@ -10,7 +11,9 @@
android:layout_height="@dimen/listitem_picture_size"
android:layout_centerVertical="true"
android:layout_marginLeft="@dimen/listitem_horizontal_margin"
android:layout_marginStart="@dimen/listitem_horizontal_margin"/>
android:layout_marginStart="@dimen/listitem_horizontal_margin"
app:civ_border_width="@dimen/avatar_border_width"
app:civ_border_color="@color/briar_text_primary"/>
<ImageView
android:id="@+id/statusView"
......
......@@ -2,6 +2,7 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical">
......@@ -9,14 +10,16 @@
<de.hdodenhof.circleimageview.CircleImageView
android:id="@+id/avatarView"
android:layout_width="@dimen/dropdown_picture_size"
android:layout_height="@dimen/dropdown_picture_size"/>
android:layout_height="@dimen/dropdown_picture_size"
android:layout_margin="@dimen/margin_small"
app:civ_border_width="@dimen/avatar_border_width"
app:civ_border_color="@color/briar_text_primary"/>
<TextView
android:id="@+id/nameView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/margin_medium"
android:layout_marginStart="@dimen/margin_medium"
android:layout_margin="@dimen/margin_small"
android:ellipsize="end"
android:singleLine="true"
android:textSize="@dimen/text_size_medium"
......
......@@ -2,6 +2,7 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
......@@ -19,7 +20,9 @@
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:layout_marginLeft="@dimen/listitem_horizontal_margin"
android:layout_marginStart="@dimen/listitem_horizontal_margin"/>
android:layout_marginStart="@dimen/listitem_horizontal_margin"
app:civ_border_width="@dimen/avatar_border_width"
app:civ_border_color="@color/briar_text_primary"/>
<LinearLayout
android:id="@+id/bulbHolder"
......
......@@ -2,6 +2,7 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
......@@ -16,7 +17,8 @@
android:layout_height="@dimen/listitem_picture_size"
android:layout_marginLeft="@dimen/listitem_horizontal_margin"
android:layout_marginStart="@dimen/listitem_horizontal_margin"
/>
app:civ_border_width="@dimen/avatar_border_width"
app:civ_border_color="@color/briar_text_primary"/>
<RelativeLayout
android:id="@+id/msgLayout"
......
......@@ -21,11 +21,10 @@
<dimen name="nav_seperator_height">1dp</dimen>
<dimen name="listitem_horizontal_margin">16dp</dimen>
<dimen name="listitem_picture_size">40dp</dimen>
<dimen name="listitem_text_left_margin">72dp</dimen>
<dimen name="listitem_height_one_line_avatar">56dp</dimen>
<dimen name="listitem_picture_size">40dp</dimen>
<dimen name="dropdown_picture_size">32dp</dimen>
<dimen name="avatar_border_width">1dp</dimen>
</resources>
......@@ -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) {
......
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);
}
};
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment