Switched HistoryDetail contact avatar to avatar helper class
This commit is contained in:
parent
3a80db5b7f
commit
ec64e6f8c6
4 changed files with 57 additions and 23 deletions
|
@ -42,16 +42,16 @@ import org.linphone.core.ProxyConfig;
|
|||
import org.linphone.core.tools.Log;
|
||||
import org.linphone.fragments.FragmentsAvailable;
|
||||
import org.linphone.settings.LinphonePreferences;
|
||||
import org.linphone.utils.ImageUtils;
|
||||
import org.linphone.utils.LinphoneUtils;
|
||||
import org.linphone.views.ContactAvatar;
|
||||
|
||||
public class HistoryDetailFragment extends Fragment implements OnClickListener {
|
||||
private ImageView mDialBack, mChat, mAddToContacts, mGoToContact, mBack;
|
||||
private View mView;
|
||||
private ImageView mContactPicture, mCallDirection;
|
||||
private ImageView mCallDirection;
|
||||
private TextView mContactName, mContactAddress, mTime, mDate;
|
||||
private String mSipUri, mDisplayName;
|
||||
private RelativeLayout mWaitLayout;
|
||||
private RelativeLayout mWaitLayout, mAvatarLayout;
|
||||
private LinphoneContact mContact;
|
||||
private ChatRoom mChatRoom;
|
||||
private ChatRoomListenerStub mChatRoomCreationListener;
|
||||
|
@ -91,7 +91,7 @@ public class HistoryDetailFragment extends Fragment implements OnClickListener {
|
|||
mGoToContact = mView.findViewById(R.id.goto_contact);
|
||||
mGoToContact.setOnClickListener(this);
|
||||
|
||||
mContactPicture = mView.findViewById(R.id.contact_picture);
|
||||
mAvatarLayout = mView.findViewById(R.id.avatar_layout);
|
||||
|
||||
mContactName = mView.findViewById(R.id.contact_name);
|
||||
mContactAddress = mView.findViewById(R.id.contact_address);
|
||||
|
@ -156,13 +156,10 @@ public class HistoryDetailFragment extends Fragment implements OnClickListener {
|
|||
if (lAddress != null) {
|
||||
mContactAddress.setText(LinphoneUtils.getDisplayableAddress(lAddress));
|
||||
mContact = ContactsManager.getInstance().findContactFromAddress(lAddress);
|
||||
|
||||
if (mContact != null) {
|
||||
mContactName.setText(mContact.getFullName());
|
||||
ImageUtils.setImagePictureFromUri(
|
||||
mView.getContext(),
|
||||
mContactPicture,
|
||||
mContact.getPhotoUri(),
|
||||
mContact.getThumbnailUri());
|
||||
ContactAvatar.displayAvatar(mContact, mAvatarLayout);
|
||||
mAddToContacts.setVisibility(View.GONE);
|
||||
mGoToContact.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
|
@ -170,8 +167,8 @@ public class HistoryDetailFragment extends Fragment implements OnClickListener {
|
|||
mDisplayName == null
|
||||
? LinphoneUtils.getAddressDisplayName(mSipUri)
|
||||
: mDisplayName);
|
||||
mContactPicture.setImageBitmap(
|
||||
ContactsManager.getInstance().getDefaultAvatarBitmap());
|
||||
ContactAvatar.displayAvatar(
|
||||
LinphoneUtils.getAddressDisplayName(lAddress), mAvatarLayout);
|
||||
mAddToContacts.setVisibility(View.VISIBLE);
|
||||
mGoToContact.setVisibility(View.GONE);
|
||||
}
|
||||
|
|
42
app/src/main/res/layout/contact_avatar_big.xml
Normal file
42
app/src/main/res/layout/contact_avatar_big.xml
Normal file
|
@ -0,0 +1,42 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/avatar_layout"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/contact_picture"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:adjustViewBounds="true"
|
||||
android:src="@drawable/avatar" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/mask"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:adjustViewBounds="true"
|
||||
android:src="@drawable/avatar_mask" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/generated_avatar"
|
||||
style="@style/contact_avatar_letters_big"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:background="@drawable/generated_avatar_bg"
|
||||
android:gravity="center"
|
||||
android:maxLines="1" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/security_level"
|
||||
android:layout_width="20dp"
|
||||
android:layout_height="20dp"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentRight="true"
|
||||
android:src="@drawable/security_alert_indicator"
|
||||
android:visibility="gone" />
|
||||
|
||||
</RelativeLayout>
|
|
@ -70,18 +70,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:gravity="center">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/contact_picture"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:contentDescription="@string/content_description_contact_picture"
|
||||
android:src="@drawable/avatar" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/mask"
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:src="@drawable/avatar_mask" />
|
||||
<include layout="@layout/contact_avatar_big"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
|
|
|
@ -147,6 +147,12 @@
|
|||
<item name="android:textStyle">bold</item>
|
||||
</style>
|
||||
|
||||
<style name="contact_avatar_letters_big" parent="@android:style/TextAppearance.Large">
|
||||
<item name="android:textColor">@color/colorH</item>
|
||||
<item name="android:textSize">70sp</item>
|
||||
<item name="android:textStyle">bold</item>
|
||||
</style>
|
||||
|
||||
<style name="imdn_read_font" parent="@android:style/TextAppearance.Medium">
|
||||
<item name="android:textColor">@color/colorK</item>
|
||||
<item name="android:textSize">15sp</item>
|
||||
|
|
Loading…
Reference in a new issue