Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Julian Dehm
briar
Commits
e62d60ff
Commit
e62d60ff
authored
Jan 05, 2016
by
str4d
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add identicons to contact list
parent
c7387ee3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
76 additions
and
41 deletions
+76
-41
briar-android/res/layout/list_item_contact.xml
briar-android/res/layout/list_item_contact.xml
+62
-40
briar-android/res/values/dimens.xml
briar-android/res/values/dimens.xml
+6
-0
briar-android/src/org/briarproject/android/contact/ContactListAdapter.java
.../org/briarproject/android/contact/ContactListAdapter.java
+8
-1
No files found.
briar-android/res/layout/list_item_contact.xml
View file @
e62d60ff
...
...
@@ -2,49 +2,71 @@
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
android:orientation=
"vertical"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
>
<LinearLayout
android:orientation=
"horizontal"
<RelativeLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:background=
"?attr/selectableItemBackground"
android:padding=
"12dp"
>
<ImageView
android:id=
"@+id/bulbView"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginRight=
"@dimen/margin_medium"
android:layout_marginEnd=
"@dimen/margin_medium"
android:layout_gravity=
"center_vertical"
tools:src=
"@drawable/contact_disconnected"
/>
<TextView
android:id=
"@+id/nameView"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_weight=
"1"
android:layout_gravity=
"center_vertical"
android:layout_marginRight=
"@dimen/margin_small"
android:layout_marginEnd=
"@dimen/margin_small"
android:textSize=
"@dimen/text_size_medium"
android:gravity=
"center_vertical"
tools:text=
"This is a name of a contact. It can be quite long."
/>
<TextView
android:id=
"@+id/dateView"
android:layout_width=
"wrap_content"
android:layout_height=
"match_parent"
android:layout_marginRight=
"@dimen/margin_small"
android:layout_marginEnd=
"@dimen/margin_small"
android:gravity=
"center_vertical"
android:textColor=
"@color/no_private_messages"
tools:text=
"Dec 24"
/>
</LinearLayout>
android:layout_height=
"@dimen/listitem_height_one_line_avatar"
android:background=
"?attr/selectableItemBackground"
>
<im.delight.android.identicons.SymmetricIdenticon
android:id=
"@+id/identiconView"
android:layout_width=
"@dimen/listitem_picture_size"
android:layout_height=
"@dimen/listitem_picture_size"
android:layout_alignParentLeft=
"true"
android:layout_alignParentStart=
"true"
android:layout_centerVertical=
"true"
android:layout_marginLeft=
"@dimen/listitem_horizontal_margin"
android:layout_marginStart=
"@dimen/listitem_horizontal_margin"
/>
<LinearLayout
android:id=
"@+id/bulbHolder"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_alignParentEnd=
"true"
android:layout_alignParentRight=
"true"
android:layout_centerVertical=
"true"
android:layout_marginEnd=
"@dimen/listitem_horizontal_margin"
android:layout_marginRight=
"@dimen/listitem_horizontal_margin"
android:gravity=
"right"
android:orientation=
"vertical"
>
<ImageView
android:id=
"@+id/bulbView"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
tools:src=
"@drawable/contact_disconnected"
/>
<TextView
android:id=
"@+id/dateView"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:textColor=
"@color/no_private_messages"
tools:text=
"Dec 24"
/>
</LinearLayout>
<TextView
android:id=
"@+id/nameView"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_alignParentLeft=
"true"
android:layout_alignParentStart=
"true"
android:layout_centerVertical=
"true"
android:layout_marginEnd=
"@dimen/margin_small"
android:layout_marginLeft=
"@dimen/listitem_text_left_margin"
android:layout_marginRight=
"@dimen/margin_small"
android:layout_marginStart=
"@dimen/listitem_text_left_margin"
android:layout_toLeftOf=
"@id/bulbHolder"
android:layout_toStartOf=
"@id/bulbHolder"
android:gravity=
"center_vertical"
android:maxLines=
"2"
android:textSize=
"@dimen/text_size_medium"
tools:text=
"This is a name of a contact. It can be quite long."
/>
</RelativeLayout>
<View
style=
"@style/Divider.Horizontal"
/>
...
...
briar-android/res/values/dimens.xml
View file @
e62d60ff
...
...
@@ -20,4 +20,10 @@
<dimen
name=
"nav_drawer_width"
>
300dp
</dimen>
<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>
</resources>
briar-android/src/org/briarproject/android/contact/ContactListAdapter.java
View file @
e62d60ff
...
...
@@ -14,10 +14,13 @@ import android.widget.TextView;
import
org.briarproject.R
;
import
org.briarproject.api.contact.ContactId
;
import
org.briarproject.api.identity.Author
;
import
org.briarproject.api.sync.GroupId
;
import
java.util.List
;
import
im.delight.android.identicons.IdenticonView
;
import
static
android
.
support
.
v7
.
util
.
SortedList
.
INVALID_POSITION
;
public
class
ContactListAdapter
...
...
@@ -113,7 +116,9 @@ public class ContactListAdapter
ui
.
bulb
.
setImageResource
(
R
.
drawable
.
contact_disconnected
);
}
String
contactName
=
item
.
getContact
().
getAuthor
().
getName
();
Author
author
=
item
.
getContact
().
getAuthor
();
ui
.
identicon
.
show
(
author
.
getId
().
getBytes
());
String
contactName
=
author
.
getName
();
if
(
unread
>
0
)
{
ui
.
name
.
setText
(
contactName
+
" ("
+
unread
+
")"
);
}
else
{
...
...
@@ -193,6 +198,7 @@ public class ContactListAdapter
public
static
class
ContactHolder
extends
RecyclerView
.
ViewHolder
{
public
ViewGroup
layout
;
public
ImageView
bulb
;
public
IdenticonView
identicon
;
public
TextView
name
;
public
TextView
date
;
...
...
@@ -201,6 +207,7 @@ public class ContactListAdapter
layout
=
(
ViewGroup
)
v
;
bulb
=
(
ImageView
)
v
.
findViewById
(
R
.
id
.
bulbView
);
identicon
=
(
IdenticonView
)
v
.
findViewById
(
R
.
id
.
identiconView
);
name
=
(
TextView
)
v
.
findViewById
(
R
.
id
.
nameView
);
date
=
(
TextView
)
v
.
findViewById
(
R
.
id
.
dateView
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment