Hidden room unread count if 0 + fixed group chat icon + some cleanup
This commit is contained in:
parent
884f4d66c6
commit
f020b2e2c4
10 changed files with 121 additions and 125 deletions
|
@ -68,75 +68,75 @@ public class ChatBubbleViewHolder extends RecyclerView.ViewHolder implements Vie
|
|||
|
||||
public ChatBubbleViewHolder(Context context, View view, ClickListener listener) {
|
||||
super(view);
|
||||
this.mContext = context;
|
||||
mContext = context;
|
||||
|
||||
this.eventLayout = view.findViewById(R.id.event);
|
||||
eventLayout = view.findViewById(R.id.event);
|
||||
//eventTime = view.findViewById(R.id.event_date);
|
||||
this.eventMessage = view.findViewById(R.id.event_text);
|
||||
eventMessage = view.findViewById(R.id.event_text);
|
||||
|
||||
this.bubbleLayout = view.findViewById(R.id.bubble);
|
||||
this.background = view.findViewById(R.id.background);
|
||||
this.contactPicture = view.findViewById(R.id.contact_picture);
|
||||
this.contactPictureMask = view.findViewById(R.id.mask);
|
||||
this.contactName = view.findViewById(R.id.contact_header);
|
||||
bubbleLayout = view.findViewById(R.id.bubble);
|
||||
background = view.findViewById(R.id.background);
|
||||
contactPicture = view.findViewById(R.id.contact_picture);
|
||||
contactPictureMask = view.findViewById(R.id.mask);
|
||||
contactName = view.findViewById(R.id.contact_header);
|
||||
|
||||
this.messageStatus = view.findViewById(R.id.status);
|
||||
this.messageSendingInProgress = view.findViewById(R.id.inprogress);
|
||||
this.imdmLayout = view.findViewById(R.id.imdmLayout);
|
||||
this.imdmIcon = view.findViewById(R.id.imdmIcon);
|
||||
this.imdmLabel = view.findViewById(R.id.imdmText);
|
||||
messageStatus = view.findViewById(R.id.status);
|
||||
messageSendingInProgress = view.findViewById(R.id.inprogress);
|
||||
imdmLayout = view.findViewById(R.id.imdmLayout);
|
||||
imdmIcon = view.findViewById(R.id.imdmIcon);
|
||||
imdmLabel = view.findViewById(R.id.imdmText);
|
||||
|
||||
this.messageText = view.findViewById(R.id.message);
|
||||
this.messageImage = view.findViewById(R.id.image);
|
||||
this.separatorLayout = view.findViewById(R.id.separator);
|
||||
messageText = view.findViewById(R.id.message);
|
||||
messageImage = view.findViewById(R.id.image);
|
||||
separatorLayout = view.findViewById(R.id.separator);
|
||||
|
||||
this.fileTransferLayout = view.findViewById(R.id.file_transfer_layout);
|
||||
this.fileTransferProgressBar = view.findViewById(R.id.progress_bar);
|
||||
this.fileTransferAction = view.findViewById(R.id.file_transfer_action);
|
||||
fileTransferLayout = view.findViewById(R.id.file_transfer_layout);
|
||||
fileTransferProgressBar = view.findViewById(R.id.progress_bar);
|
||||
fileTransferAction = view.findViewById(R.id.file_transfer_action);
|
||||
|
||||
this.fileName = view.findViewById(R.id.file_name);
|
||||
this.openFileButton = view.findViewById(R.id.open_file);
|
||||
fileName = view.findViewById(R.id.file_name);
|
||||
openFileButton = view.findViewById(R.id.open_file);
|
||||
|
||||
this.delete = view.findViewById(R.id.delete_message);
|
||||
delete = view.findViewById(R.id.delete_message);
|
||||
|
||||
this.listener = listener;
|
||||
listener = listener;
|
||||
|
||||
view.setOnClickListener(this);
|
||||
}
|
||||
public ChatBubbleViewHolder(View view) {
|
||||
super(view);
|
||||
this.eventLayout = view.findViewById(R.id.event);
|
||||
eventLayout = view.findViewById(R.id.event);
|
||||
//eventTime = view.findViewById(R.id.event_date);
|
||||
this.eventMessage = view.findViewById(R.id.event_text);
|
||||
eventMessage = view.findViewById(R.id.event_text);
|
||||
|
||||
this.bubbleLayout = view.findViewById(R.id.bubble);
|
||||
this.background = view.findViewById(R.id.background);
|
||||
this.contactPicture = view.findViewById(R.id.contact_picture);
|
||||
this.contactPictureMask = view.findViewById(R.id.mask);
|
||||
this.contactName = view.findViewById(R.id.contact_header);
|
||||
bubbleLayout = view.findViewById(R.id.bubble);
|
||||
background = view.findViewById(R.id.background);
|
||||
contactPicture = view.findViewById(R.id.contact_picture);
|
||||
contactPictureMask = view.findViewById(R.id.mask);
|
||||
contactName = view.findViewById(R.id.contact_header);
|
||||
|
||||
this.messageStatus = view.findViewById(R.id.status);
|
||||
this.messageSendingInProgress = view.findViewById(R.id.inprogress);
|
||||
this.imdmLayout = view.findViewById(R.id.imdmLayout);
|
||||
this.imdmIcon = view.findViewById(R.id.imdmIcon);
|
||||
this.imdmLabel = view.findViewById(R.id.imdmText);
|
||||
messageStatus = view.findViewById(R.id.status);
|
||||
messageSendingInProgress = view.findViewById(R.id.inprogress);
|
||||
imdmLayout = view.findViewById(R.id.imdmLayout);
|
||||
imdmIcon = view.findViewById(R.id.imdmIcon);
|
||||
imdmLabel = view.findViewById(R.id.imdmText);
|
||||
|
||||
this.messageText = view.findViewById(R.id.message);
|
||||
this.messageImage = view.findViewById(R.id.image);
|
||||
this.separatorLayout = view.findViewById(R.id.separator);
|
||||
messageText = view.findViewById(R.id.message);
|
||||
messageImage = view.findViewById(R.id.image);
|
||||
separatorLayout = view.findViewById(R.id.separator);
|
||||
|
||||
this.fileTransferLayout = view.findViewById(R.id.file_transfer_layout);
|
||||
this.fileTransferProgressBar = view.findViewById(R.id.progress_bar);
|
||||
this.fileTransferAction = view.findViewById(R.id.file_transfer_action);
|
||||
fileTransferLayout = view.findViewById(R.id.file_transfer_layout);
|
||||
fileTransferProgressBar = view.findViewById(R.id.progress_bar);
|
||||
fileTransferAction = view.findViewById(R.id.file_transfer_action);
|
||||
|
||||
this.fileName = view.findViewById(R.id.file_name);
|
||||
this.openFileButton = view.findViewById(R.id.open_file);
|
||||
fileName = view.findViewById(R.id.file_name);
|
||||
openFileButton = view.findViewById(R.id.open_file);
|
||||
|
||||
this.delete = view.findViewById(R.id.delete_message);
|
||||
delete = view.findViewById(R.id.delete_message);
|
||||
}
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if(listener!=null) {
|
||||
if (listener != null) {
|
||||
listener.onItemClicked(getAdapterPosition());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -130,8 +130,8 @@ public class ChatEventsAdapter extends SelectableAdapter<ChatBubbleViewHolder> {
|
|||
@Override
|
||||
public ChatBubbleViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View v = LayoutInflater.from(parent.getContext())
|
||||
.inflate(this.mItemResource, parent, false);
|
||||
ChatBubbleViewHolder VH = new ChatBubbleViewHolder(this.mContext,v, mClickListener);
|
||||
.inflate(mItemResource, parent, false);
|
||||
ChatBubbleViewHolder VH = new ChatBubbleViewHolder(mContext,v, mClickListener);
|
||||
|
||||
//Allows onLongClick ContextMenu on bubbles
|
||||
mFragment.registerForContextMenu(v);
|
||||
|
@ -141,7 +141,7 @@ public class ChatEventsAdapter extends SelectableAdapter<ChatBubbleViewHolder> {
|
|||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull ChatBubbleViewHolder holder, int position) {
|
||||
final EventLog event = this.mHistory.get(position);
|
||||
final EventLog event = mHistory.get(position);
|
||||
holder.eventLayout.setVisibility(View.GONE);
|
||||
holder.bubbleLayout.setVisibility(View.GONE);
|
||||
holder.delete.setVisibility(isEditionEnabled() ? View.VISIBLE : View.GONE);
|
||||
|
@ -402,7 +402,7 @@ public class ChatEventsAdapter extends SelectableAdapter<ChatBubbleViewHolder> {
|
|||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return this.mHistory.size();
|
||||
return mHistory.size();
|
||||
}
|
||||
|
||||
public void addToHistory(EventLog log) {
|
||||
|
@ -430,7 +430,7 @@ public class ChatEventsAdapter extends SelectableAdapter<ChatBubbleViewHolder> {
|
|||
}
|
||||
|
||||
public int getCount() {
|
||||
return this.mHistory.size();
|
||||
return mHistory.size();
|
||||
}
|
||||
|
||||
public Object getItem(int i) {
|
||||
|
|
|
@ -71,7 +71,7 @@ public class ChatListFragment extends Fragment implements ContactsUpdatedListene
|
|||
super.onCreate(savedInstanceState);
|
||||
mRooms = new ArrayList<>(Arrays.asList(LinphoneManager.getLc().getChatRooms()));
|
||||
|
||||
this.mContext = getActivity().getApplicationContext();
|
||||
mContext = getActivity().getApplicationContext();
|
||||
View view = inflater.inflate(R.layout.chatlist, container, false);
|
||||
|
||||
mChatRoomsList = view.findViewById(R.id.chatList);
|
||||
|
|
|
@ -21,6 +21,7 @@ package org.linphone.chat;
|
|||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
|
@ -38,7 +39,6 @@ import org.linphone.contacts.LinphoneContact;
|
|||
import org.linphone.core.Address;
|
||||
import org.linphone.core.ChatRoom;
|
||||
import org.linphone.core.ChatRoomCapabilities;
|
||||
import org.linphone.core.ChatRoomListenerStub;
|
||||
import org.linphone.ui.SelectableAdapter;
|
||||
import org.linphone.ui.SelectableHelper;
|
||||
|
||||
|
@ -60,43 +60,43 @@ public class ChatRoomsAdapter extends SelectableAdapter<ChatRoomsAdapter.ChatRoo
|
|||
public ImageView contactPicture;
|
||||
public Context mContext;
|
||||
public ChatRoom mRoom;
|
||||
public ClickListener listener;
|
||||
private ClickListener mListener;
|
||||
|
||||
public ChatRoomViewHolder(Context context,View itemView, ClickListener listener) {
|
||||
super(itemView);
|
||||
this.mContext= context;
|
||||
this.lastMessageSenderView = itemView.findViewById(R.id.lastMessageSender);
|
||||
this.lastMessageView = itemView.findViewById(R.id.lastMessage);
|
||||
this.date = itemView.findViewById(R.id.date);
|
||||
this.displayName = itemView.findViewById(R.id.sipUri);
|
||||
this.unreadMessages = itemView.findViewById(R.id.unreadMessages);
|
||||
this.delete = itemView.findViewById(R.id.delete_chatroom);
|
||||
this.contactPicture = itemView.findViewById(R.id.contact_picture);
|
||||
this.listener = listener;
|
||||
mContext = context;
|
||||
lastMessageSenderView = itemView.findViewById(R.id.lastMessageSender);
|
||||
lastMessageView = itemView.findViewById(R.id.lastMessage);
|
||||
date = itemView.findViewById(R.id.date);
|
||||
displayName = itemView.findViewById(R.id.sipUri);
|
||||
unreadMessages = itemView.findViewById(R.id.unreadMessages);
|
||||
delete = itemView.findViewById(R.id.delete_chatroom);
|
||||
contactPicture = itemView.findViewById(R.id.contact_picture);
|
||||
mListener = listener;
|
||||
|
||||
itemView.setOnClickListener(this);
|
||||
itemView.setOnLongClickListener(this);
|
||||
}
|
||||
|
||||
public void bindChatRoom(ChatRoom room) {
|
||||
this.mRoom = room;
|
||||
this.lastMessageSenderView.setText(getSender(mRoom));
|
||||
this.lastMessageView.setText(mRoom.getLastMessageInHistory() != null ? mRoom.getLastMessageInHistory().getTextContent(): "");
|
||||
this.date.setText(mRoom.getLastMessageInHistory()!=null ? LinphoneUtils.timestampToHumanDate(this.mContext, mRoom.getLastUpdateTime(), R.string.messages_list_date_format) : "");
|
||||
this.displayName.setText(getContact(mRoom));
|
||||
this.unreadMessages.setText(String.valueOf(LinphoneManager.getInstance().getUnreadCountForChatRoom(mRoom)));
|
||||
mRoom = room;
|
||||
lastMessageSenderView.setText(getSender(mRoom));
|
||||
lastMessageView.setText(mRoom.getLastMessageInHistory() != null ? mRoom.getLastMessageInHistory().getTextContent(): "");
|
||||
date.setText(mRoom.getLastMessageInHistory() != null ? LinphoneUtils.timestampToHumanDate(mContext, mRoom.getLastUpdateTime(), R.string.messages_list_date_format) : "");
|
||||
displayName.setText(getContact(mRoom));
|
||||
unreadMessages.setText(String.valueOf(LinphoneManager.getInstance().getUnreadCountForChatRoom(mRoom)));
|
||||
getAvatar(mRoom);
|
||||
}
|
||||
|
||||
public void onClick(View v) {
|
||||
if (listener != null) {
|
||||
listener.onItemClicked(getAdapterPosition());
|
||||
if (mListener != null) {
|
||||
mListener.onItemClicked(getAdapterPosition());
|
||||
}
|
||||
}
|
||||
|
||||
public boolean onLongClick(View v) {
|
||||
if (listener != null) {
|
||||
return listener.onItemLongClicked(getAdapterPosition());
|
||||
if (mListener != null) {
|
||||
return mListener.onItemLongClicked(getAdapterPosition());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ public class ChatRoomsAdapter extends SelectableAdapter<ChatRoomsAdapter.ChatRoo
|
|||
if (contact != null) {
|
||||
return (contact.getFullName() + mContext.getString(R.string.separator));
|
||||
}
|
||||
return (LinphoneUtils.getAddressDisplayName(mRoom.getLastMessageInHistory().getFromAddress()) + ":");
|
||||
return (LinphoneUtils.getAddressDisplayName(mRoom.getLastMessageInHistory().getFromAddress()) + mContext.getString(R.string.separator));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -138,12 +138,14 @@ public class ChatRoomsAdapter extends SelectableAdapter<ChatRoomsAdapter.ChatRoo
|
|||
}
|
||||
|
||||
public void getAvatar(ChatRoom mRoom) {
|
||||
mDefaultBitmap = ContactsManager.getInstance().getDefaultAvatarBitmap();
|
||||
LinphoneContact contact = ContactsManager.getInstance().findContactFromAddress(mRoom.getPeerAddress());
|
||||
if (contact != null) {
|
||||
LinphoneUtils.setThumbnailPictureFromUri(LinphoneActivity.instance(), this.contactPicture, ContactsManager.getInstance().findContactFromAddress(mRoom.getPeerAddress()).getThumbnailUri());
|
||||
LinphoneUtils.setThumbnailPictureFromUri(LinphoneActivity.instance(), contactPicture, ContactsManager.getInstance().findContactFromAddress(mRoom.getPeerAddress()).getThumbnailUri());
|
||||
} else {
|
||||
this.contactPicture.setImageBitmap(mDefaultBitmap);
|
||||
if (mRoom.hasCapability(ChatRoomCapabilities.OneToOne.toInt()))
|
||||
contactPicture.setImageBitmap(mDefaultBitmap);
|
||||
else
|
||||
contactPicture.setImageBitmap(mDefaultGroupBitmap);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -156,34 +158,33 @@ public class ChatRoomsAdapter extends SelectableAdapter<ChatRoomsAdapter.ChatRoo
|
|||
private Context mContext;
|
||||
public List<ChatRoom> mRooms;
|
||||
private static Bitmap mDefaultBitmap;
|
||||
//private Bitmap mDefaultGroupBitmap;
|
||||
private ChatRoomListenerStub mListener;
|
||||
private int itemResource;
|
||||
private ChatRoomViewHolder.ClickListener clickListener;
|
||||
private static Bitmap mDefaultGroupBitmap;
|
||||
private int mItemResource;
|
||||
private ChatRoomViewHolder.ClickListener mClickListener;
|
||||
|
||||
public ChatRoomsAdapter(Context context, int itemResource, List<ChatRoom> mRooms, ChatRoomViewHolder.ClickListener clickListener, SelectableHelper helper) {
|
||||
public ChatRoomsAdapter(Context context, int itemResource, List<ChatRoom> rooms, ChatRoomViewHolder.ClickListener clickListener, SelectableHelper helper) {
|
||||
super(helper);
|
||||
this.clickListener = clickListener;
|
||||
this.mRooms = mRooms;
|
||||
this.mContext = context;
|
||||
this.itemResource = itemResource;
|
||||
mClickListener = clickListener;
|
||||
mRooms = rooms;
|
||||
mContext = context;
|
||||
mItemResource = itemResource;
|
||||
mDefaultBitmap = ContactsManager.getInstance().getDefaultAvatarBitmap();
|
||||
//mDefaultGroupBitmap = BitmapFactory.decodeResource(context.getResources(), R.drawable.chat_group_avatar);
|
||||
mDefaultGroupBitmap = BitmapFactory.decodeResource(context.getResources(), R.drawable.chat_group_avatar);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChatRoomViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||
View view = LayoutInflater.from(parent.getContext())
|
||||
.inflate(this.itemResource, parent, false);
|
||||
return new ChatRoomViewHolder(this.mContext, view, clickListener);
|
||||
.inflate(mItemResource, parent, false);
|
||||
return new ChatRoomViewHolder(mContext, view, mClickListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(ChatRoomViewHolder holder, int position) {
|
||||
ChatRoom room = this.mRooms.get(position);
|
||||
holder.delete.setVisibility(this.isEditionEnabled() == true ? View.VISIBLE : View.INVISIBLE);
|
||||
holder.unreadMessages.setVisibility(this.isEditionEnabled() == false ? View.VISIBLE : View.INVISIBLE);
|
||||
holder.delete.setChecked(isSelected(position) ? true : false);
|
||||
ChatRoom room = mRooms.get(position);
|
||||
holder.delete.setVisibility(isEditionEnabled() ? View.VISIBLE : View.INVISIBLE);
|
||||
holder.unreadMessages.setVisibility(isEditionEnabled() ? View.INVISIBLE : (room.getUnreadMessagesCount() > 0 ? View.VISIBLE : View.INVISIBLE));
|
||||
holder.delete.setChecked(isSelected(position));
|
||||
holder.bindChatRoom(room);
|
||||
}
|
||||
|
||||
|
@ -201,9 +202,6 @@ public class ChatRoomsAdapter extends SelectableAdapter<ChatRoomsAdapter.ChatRoo
|
|||
}
|
||||
|
||||
public void clear() {
|
||||
for (ChatRoom room : mRooms) {
|
||||
room.removeListener(mListener);
|
||||
}
|
||||
mRooms.clear();
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
@ -214,7 +212,7 @@ public class ChatRoomsAdapter extends SelectableAdapter<ChatRoomsAdapter.ChatRoo
|
|||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return this.mRooms.size();
|
||||
return mRooms.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -117,7 +117,7 @@ public class GroupChatFragment extends Fragment implements ChatRoomListener, Con
|
|||
mRemoteSipAddress = LinphoneManager.getLc().createAddress(mRemoteSipUri);
|
||||
}
|
||||
|
||||
this.mContext = getActivity().getApplicationContext();
|
||||
mContext = getActivity().getApplicationContext();
|
||||
View view = inflater.inflate(R.layout.chat, container, false);
|
||||
|
||||
|
||||
|
@ -224,7 +224,7 @@ public class GroupChatFragment extends Fragment implements ChatRoomListener, Con
|
|||
addImageToPendingList(fileSharedUri);
|
||||
} else {
|
||||
if (fileSharedUri.startsWith("content://") || fileSharedUri.startsWith("file://")) {
|
||||
fileSharedUri = LinphoneUtils.getFilePath(this.getActivity().getApplicationContext(), Uri.parse(fileSharedUri));
|
||||
fileSharedUri = LinphoneUtils.getFilePath(getActivity().getApplicationContext(), Uri.parse(fileSharedUri));
|
||||
} else if (fileSharedUri.contains("com.android.contacts/contacts/")) {
|
||||
fileSharedUri = LinphoneUtils.getCVSPathFromLookupUri(fileSharedUri).toString();
|
||||
}
|
||||
|
@ -309,7 +309,7 @@ public class GroupChatFragment extends Fragment implements ChatRoomListener, Con
|
|||
addImageToPendingList(fileToUploadPath);
|
||||
} else {
|
||||
if (fileToUploadPath.startsWith("content://") || fileToUploadPath.startsWith("file://")) {
|
||||
fileToUploadPath = LinphoneUtils.getFilePath(this.getActivity().getApplicationContext(), Uri.parse(fileToUploadPath));
|
||||
fileToUploadPath = LinphoneUtils.getFilePath(getActivity().getApplicationContext(), Uri.parse(fileToUploadPath));
|
||||
} else if (fileToUploadPath.contains("com.android.contacts/contacts/")) {
|
||||
fileToUploadPath = LinphoneUtils.getCVSPathFromLookupUri(fileToUploadPath).toString();
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ public class GroupInfoAdapter extends RecyclerView.Adapter<GroupInfoAdapter.View
|
|||
private View.OnClickListener mDeleteListener;
|
||||
private boolean mHideAdminFeatures;
|
||||
private ChatRoom mChatRoom;
|
||||
public ImageView avatar;
|
||||
private ImageView mAavatar;
|
||||
|
||||
public GroupInfoAdapter(List<ContactAddress> items, boolean hideAdminFeatures, boolean isCreation) {
|
||||
mItems = items;
|
||||
|
@ -84,11 +84,11 @@ public class GroupInfoAdapter extends RecyclerView.Adapter<GroupInfoAdapter.View
|
|||
public void onBindViewHolder(@NonNull final ViewHolder holder, int position) {
|
||||
final ContactAddress ca = (ContactAddress)getItem(position);
|
||||
LinphoneContact c = ca.getContact();
|
||||
this.avatar=holder.avatar;
|
||||
mAavatar = holder.avatar;
|
||||
holder.name.setText((c.getFullName() != null) ? c.getFullName() :
|
||||
(ca.getDisplayName() != null) ? ca.getDisplayName() : ca.getUsername());
|
||||
if (c.hasPhoto()) {
|
||||
LinphoneUtils.setThumbnailPictureFromUri(LinphoneActivity.instance(), avatar, c.getThumbnailUri());
|
||||
LinphoneUtils.setThumbnailPictureFromUri(LinphoneActivity.instance(), mAavatar, c.getThumbnailUri());
|
||||
}
|
||||
|
||||
holder.delete.setOnClickListener(new View.OnClickListener() {
|
||||
|
|
|
@ -89,7 +89,7 @@ public class GroupInfoFragment extends Fragment implements ChatRoomListener {
|
|||
if (getArguments() == null || getArguments().isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
this.mContext = getActivity().getApplicationContext();
|
||||
mContext = getActivity().getApplicationContext();
|
||||
|
||||
mParticipants = (ArrayList<ContactAddress>) getArguments().getSerializable("ContactAddress");
|
||||
|
||||
|
|
|
@ -118,10 +118,10 @@ public class ContactAddress implements Serializable {
|
|||
}
|
||||
|
||||
private void init(LinphoneContact c, String a, String pn, boolean isLC) {
|
||||
this.contact = c;
|
||||
this.address = a;
|
||||
this.phoneNumber = pn;
|
||||
this.isLinphoneContact = isLC;
|
||||
contact = c;
|
||||
address = a;
|
||||
phoneNumber = pn;
|
||||
isLinphoneContact = isLC;
|
||||
}
|
||||
|
||||
public ContactAddress(LinphoneContact c, String a, String pn, boolean isLC) {
|
||||
|
|
|
@ -55,7 +55,7 @@ public class ContactsListAdapter extends SelectableAdapter<ContactsListAdapter.V
|
|||
public ImageView contactPicture;
|
||||
public TextView organization;
|
||||
//public ImageView friendStatus;
|
||||
private ClickListener listener;
|
||||
private ClickListener mListener;
|
||||
|
||||
private ViewHolder(View view, ClickListener listener) {
|
||||
super(view);
|
||||
|
@ -68,21 +68,21 @@ public class ContactsListAdapter extends SelectableAdapter<ContactsListAdapter.V
|
|||
contactPicture = (ImageView) view.findViewById(R.id.contact_picture);
|
||||
organization = (TextView) view.findViewById(R.id.contactOrganization);
|
||||
//friendStatus = (ImageView) view.findViewById(R.id.friendStatus);
|
||||
this.listener= listener;
|
||||
mListener = listener;
|
||||
view.setOnClickListener(this);
|
||||
view.setOnLongClickListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (listener != null) {
|
||||
listener.onItemClicked(getAdapterPosition());
|
||||
if (mListener != null) {
|
||||
mListener.onItemClicked(getAdapterPosition());
|
||||
}
|
||||
}
|
||||
|
||||
public boolean onLongClick(View v) {
|
||||
if (listener != null) {
|
||||
return listener.onItemLongClicked(getAdapterPosition());
|
||||
if (mListener != null) {
|
||||
return mListener.onItemLongClicked(getAdapterPosition());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ public class ContactsListAdapter extends SelectableAdapter<ContactsListAdapter.V
|
|||
holder.organization.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
holder.delete.setVisibility(this.isEditionEnabled() ? View.VISIBLE : View.INVISIBLE);
|
||||
holder.delete.setVisibility(isEditionEnabled() ? View.VISIBLE : View.INVISIBLE);
|
||||
holder.delete.setChecked(isSelected(position));
|
||||
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@ public class SearchContactsListAdapter extends RecyclerView.Adapter<SearchContac
|
|||
public ImageView isSelect;
|
||||
public ImageView avatar;
|
||||
|
||||
private ClickListener listener;
|
||||
private ClickListener mListener;
|
||||
|
||||
public ViewHolder(View view, ClickListener listener) {
|
||||
super(view);
|
||||
|
@ -60,28 +60,27 @@ public class SearchContactsListAdapter extends RecyclerView.Adapter<SearchContac
|
|||
linphoneContact = view.findViewById(R.id.contact_linphone);
|
||||
isSelect = view.findViewById(R.id.contact_is_select);
|
||||
avatar = view.findViewById(R.id.contact_picture);
|
||||
this.listener=listener;
|
||||
mListener = listener;
|
||||
view.setOnClickListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (listener != null) {
|
||||
listener.onItemClicked(getAdapterPosition());
|
||||
if (mListener != null) {
|
||||
mListener.onItemClicked(getAdapterPosition());
|
||||
}
|
||||
|
||||
}
|
||||
public interface ClickListener {
|
||||
void onItemClicked(int position);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private List<ContactAddress> contacts;
|
||||
private List<ContactAddress> contactsSelected;
|
||||
private ProgressBar progressBar;
|
||||
private boolean mOnlySipContact = false;
|
||||
private ViewHolder.ClickListener listener;
|
||||
private ViewHolder.ClickListener mListener;
|
||||
|
||||
public List<ContactAddress> getContacts() {
|
||||
return contacts;
|
||||
|
@ -92,11 +91,11 @@ public class SearchContactsListAdapter extends RecyclerView.Adapter<SearchContac
|
|||
}
|
||||
|
||||
public void setListener(ViewHolder.ClickListener listener) {
|
||||
this.listener = listener;
|
||||
mListener = listener;
|
||||
}
|
||||
|
||||
public SearchContactsListAdapter(List<ContactAddress> contactsList, ProgressBar pB, ViewHolder.ClickListener clickListener) {
|
||||
this.listener=clickListener;
|
||||
mListener = clickListener;
|
||||
progressBar = pB;
|
||||
setContactsSelectedList(null);
|
||||
setContactsList(contactsList);
|
||||
|
@ -106,8 +105,7 @@ public class SearchContactsListAdapter extends RecyclerView.Adapter<SearchContac
|
|||
@Override
|
||||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.search_contact_cell, parent, false);
|
||||
return new ViewHolder(v, listener);
|
||||
|
||||
return new ViewHolder(v, mListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -285,7 +283,7 @@ public class SearchContactsListAdapter extends RecyclerView.Adapter<SearchContac
|
|||
|
||||
contacts = result;
|
||||
resultContactsSearch.setAdapter(this);
|
||||
this.notifyDataSetChanged();
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue