diff options
author | Christian S <kriztan@users.noreply.github.com> | 2015-07-04 13:23:03 +0200 |
---|---|---|
committer | Christian S <christian@pix-art.de> | 2015-07-04 16:21:49 +0200 |
commit | d5c03e5ab3f381789bf1b57717e9bb2f271004b9 (patch) | |
tree | 725cf22aee2e0df6cbffcd573da963c2006ce0c4 | |
parent | 23cf6157d5bbadff9dc88a5af934f7f7d0feb591 (diff) |
small avatar modifications
*show bigger avatar in contact details
*prefer profile avatar instead of contact picture from addressbook
*show more bigger avatar in contact details
-rw-r--r-- | src/main/java/eu/siacs/conversations/services/AvatarService.java | 12 | ||||
-rw-r--r-- | src/main/res/layout/activity_contact_details.xml | 33 |
2 files changed, 28 insertions, 17 deletions
diff --git a/src/main/java/eu/siacs/conversations/services/AvatarService.java b/src/main/java/eu/siacs/conversations/services/AvatarService.java index 7412eb933..e88047f67 100644 --- a/src/main/java/eu/siacs/conversations/services/AvatarService.java +++ b/src/main/java/eu/siacs/conversations/services/AvatarService.java @@ -44,12 +44,12 @@ public class AvatarService { if (avatar != null || cachedOnly) { return avatar; } - if (contact.getProfilePhoto() != null) { - avatar = mXmppConnectionService.getFileBackend().cropCenterSquare(Uri.parse(contact.getProfilePhoto()), size); - } if (avatar == null && contact.getAvatar() != null) { avatar = mXmppConnectionService.getFileBackend().getAvatar(contact.getAvatar(), size); } + if (avatar == null && contact.getProfilePhoto() != null) { + avatar = mXmppConnectionService.getFileBackend().cropCenterSquare(Uri.parse(contact.getProfilePhoto()), size); + } if (avatar == null) { avatar = get(contact.getDisplayName(), size, cachedOnly); } @@ -265,11 +265,11 @@ public class AvatarService { Contact contact = user.getContact(); if (contact != null) { Uri uri = null; - if (contact.getProfilePhoto() != null) { - uri = Uri.parse(contact.getProfilePhoto()); - } else if (contact.getAvatar() != null) { + if (contact.getAvatar() != null) { uri = mXmppConnectionService.getFileBackend().getAvatarUri( contact.getAvatar()); + } else if (contact.getProfilePhoto() != null) { + uri = Uri.parse(contact.getProfilePhoto()); } if (uri != null) { Bitmap bitmap = mXmppConnectionService.getFileBackend() diff --git a/src/main/res/layout/activity_contact_details.xml b/src/main/res/layout/activity_contact_details.xml index 1254a3ab7..f3b9cff45 100644 --- a/src/main/res/layout/activity_contact_details.xml +++ b/src/main/res/layout/activity_contact_details.xml @@ -21,18 +21,24 @@ <QuickContactBadge android:id="@+id/details_contact_badge" - android:layout_width="72dp" - android:layout_height="72dp" + android:layout_width="192dp" + android:layout_height="192dp" + android:scaleType="centerCrop" android:layout_alignParentTop="true" - android:scaleType="centerCrop" /> + android:layout_centerHorizontal="true" + /> <LinearLayout android:id="@+id/details_jidbox" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginLeft="16dp" - android:layout_toRightOf="@+id/details_contact_badge" - android:orientation="vertical" > + android:orientation="vertical" + android:layout_below="@+id/details_contact_badge" + android:layout_alignParentRight="true" + android:layout_alignParentEnd="true" + android:layout_marginTop="16dp" + android:layout_alignParentLeft="true" + android:layout_alignParentStart="true"> <TextView android:id="@+id/details_contactjid" @@ -41,12 +47,14 @@ android:text="@string/account_settings_example_jabber_id" android:textColor="@color/primarytext" android:textSize="?attr/TextSizeHeadline" - android:textStyle="bold" /> + android:textStyle="bold" + android:layout_gravity="center_horizontal" /> <LinearLayout android:layout_width="wrap_content" android:layout_height="wrap_content" - android:orientation="vertical" > + android:orientation="vertical" + android:layout_gravity="center_horizontal"> <LinearLayout android:id="@+id/tags" @@ -54,7 +62,8 @@ android:layout_height="wrap_content" android:layout_marginTop="4dp" android:layout_marginBottom="4dp" - android:orientation="horizontal"> + android:orientation="horizontal" + android:layout_gravity="center_horizontal"> </LinearLayout> <TextView @@ -62,7 +71,8 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:textColor="@color/secondarytext" - android:textSize="?attr/TextSizeBody" /> + android:textSize="?attr/TextSizeBody" + android:layout_gravity="center_horizontal" /> </LinearLayout> <Button @@ -70,7 +80,8 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="8dp" - android:text="@string/add_contact"/> + android:text="@string/add_contact" + android:layout_gravity="center_horizontal" /> <CheckBox android:id="@+id/details_send_presence" |