Added contacts' pictures in chat creation view
This commit is contained in:
parent
6c406d42a9
commit
27671e25cd
5 changed files with 49 additions and 19 deletions
|
@ -7,6 +7,33 @@
|
|||
android:gravity="center_vertical"
|
||||
android:orientation="vertical">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/avatar_layout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/contact_picture"
|
||||
android:src="@drawable/avatar"
|
||||
android:contentDescription="@string/content_description_contact_picture"
|
||||
android:layout_width="35dp"
|
||||
android:layout_height="35dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_marginLeft="5dp"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/mask"
|
||||
android:src="@drawable/avatar_mask"
|
||||
android:layout_width="35dp"
|
||||
android:layout_height="35dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_marginLeft="5dp"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/layout"
|
||||
android:background="@drawable/list_selector"
|
||||
|
@ -15,7 +42,8 @@
|
|||
android:gravity="center_vertical"
|
||||
android:orientation="vertical"
|
||||
android:layout_toLeftOf="@+id/contact_linphone"
|
||||
android:layout_toStartOf="@+id/contact_linphone"
|
||||
android:layout_toRightOf="@id/avatar_layout"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_alignParentTop="true"
|
||||
android:layout_alignParentBottom="true">
|
||||
|
||||
|
@ -34,13 +62,14 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:ellipsize="end"
|
||||
android:gravity="bottom|left"
|
||||
android:lines="1"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/contact_linphone"
|
||||
android:id="@id/contact_linphone"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:layout_gravity="right"
|
||||
|
|
|
@ -22,9 +22,7 @@ package org.linphone.chat;
|
|||
import android.app.Fragment;
|
||||
import android.os.Bundle;
|
||||
import android.text.Editable;
|
||||
import android.text.Layout;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -39,7 +37,7 @@ import android.widget.RelativeLayout;
|
|||
import android.widget.TextView;
|
||||
|
||||
import org.linphone.contacts.ContactAddress;
|
||||
import org.linphone.mediastream.Log;
|
||||
import org.linphone.contacts.SearchContactsListAdapter;
|
||||
import org.linphone.ui.ContactSelectView;
|
||||
import org.linphone.receivers.ContactsUpdatedListener;
|
||||
import org.linphone.activities.LinphoneActivity;
|
||||
|
|
|
@ -65,18 +65,17 @@ import android.view.inputmethod.InputMethodManager;
|
|||
import android.webkit.MimeTypeMap;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ListView;
|
||||
import android.widget.ProgressBar;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import org.linphone.contacts.ContactsManager;
|
||||
import org.linphone.contacts.SearchContactsListAdapter;
|
||||
import org.linphone.receivers.ContactsUpdatedListener;
|
||||
import org.linphone.activities.LinphoneActivity;
|
||||
import org.linphone.contacts.LinphoneContact;
|
||||
|
|
|
@ -57,7 +57,6 @@ public class GroupChatFragment extends Fragment implements ChatRoomListener {
|
|||
private TextView mRoomLabel, mRemoteComposing;
|
||||
private EditText mMessageTextToSend;
|
||||
private LayoutInflater mInflater;
|
||||
private Bitmap defaultContactAvatar;
|
||||
private ListView mChatEventsList;
|
||||
|
||||
private ChatEventsAdapter mMessagesAdapter;
|
||||
|
@ -77,8 +76,6 @@ public class GroupChatFragment extends Fragment implements ChatRoomListener {
|
|||
mRemoteSipAddress = LinphoneManager.getLc().createAddress(mRemoteSipUri);
|
||||
}
|
||||
|
||||
defaultContactAvatar = BitmapFactory.decodeResource(getActivity().getResources(), R.drawable.chat_picture_over);
|
||||
|
||||
mInflater = inflater;
|
||||
View view = inflater.inflate(R.layout.chat, container, false);
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ along with this program; if not, write to the Free Software
|
|||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
package org.linphone.chat;
|
||||
package org.linphone.contacts;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
@ -28,11 +28,10 @@ import android.widget.ListView;
|
|||
import android.widget.ProgressBar;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.linphone.contacts.ContactAddress;
|
||||
import org.linphone.contacts.ContactsManager;
|
||||
import org.linphone.contacts.LinphoneContact;
|
||||
import org.linphone.LinphoneManager;
|
||||
import org.linphone.LinphoneUtils;
|
||||
import org.linphone.R;
|
||||
import org.linphone.activities.LinphoneActivity;
|
||||
import org.linphone.core.Address;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -46,12 +45,14 @@ public class SearchContactsListAdapter extends BaseAdapter {
|
|||
public TextView address;
|
||||
public ImageView linphoneContact;
|
||||
public ImageView isSelect;
|
||||
public ImageView avatar;
|
||||
|
||||
public ViewHolder(View view) {
|
||||
name = (TextView) view.findViewById(R.id.contact_name);
|
||||
address = (TextView) view.findViewById(R.id.contact_address);
|
||||
linphoneContact = (ImageView) view.findViewById(R.id.contact_linphone);
|
||||
isSelect = (ImageView) view.findViewById(R.id.contact_is_select);
|
||||
name = view.findViewById(R.id.contact_name);
|
||||
address = view.findViewById(R.id.contact_address);
|
||||
linphoneContact = view.findViewById(R.id.contact_linphone);
|
||||
isSelect = view.findViewById(R.id.contact_is_select);
|
||||
avatar = view.findViewById(R.id.contact_picture);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -102,7 +103,7 @@ public class SearchContactsListAdapter extends BaseAdapter {
|
|||
|
||||
public void setContactsSelectedList(List<ContactAddress> contactsList) {
|
||||
if (contactsList == null) {
|
||||
contactsSelected = new ArrayList<ContactAddress>();
|
||||
contactsSelected = new ArrayList<>();
|
||||
} else {
|
||||
contactsSelected = contactsList;
|
||||
}
|
||||
|
@ -201,6 +202,12 @@ public class SearchContactsListAdapter extends BaseAdapter {
|
|||
final String a = contact.getAddress();
|
||||
LinphoneContact c = contact.getContact();
|
||||
|
||||
if (c.hasPhoto()) {
|
||||
LinphoneUtils.setThumbnailPictureFromUri(LinphoneActivity.instance(), holder.avatar, c.getThumbnailUri());
|
||||
} else {
|
||||
holder.avatar.setImageBitmap(ContactsManager.getInstance().getDefaultAvatarBitmap());
|
||||
}
|
||||
|
||||
holder.name.setText(c.getFullName());
|
||||
holder.address.setText(a);
|
||||
if (holder.linphoneContact != null) {
|
Loading…
Reference in a new issue