More cleanup
This commit is contained in:
parent
0e9d85e7ae
commit
36594310f5
9 changed files with 72 additions and 151 deletions
|
@ -81,22 +81,21 @@ public class ChatEventsAdapter extends SelectableAdapter<ChatBubbleViewHolder> {
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
private List<EventLog> mHistory;
|
private List<EventLog> mHistory;
|
||||||
private List<LinphoneContact> mParticipants;
|
private List<LinphoneContact> mParticipants;
|
||||||
private int itemResource;
|
private int mItemResource;
|
||||||
private Bitmap mDefaultBitmap;
|
private Bitmap mDefaultBitmap;
|
||||||
private GroupChatFragment mFragment;
|
private GroupChatFragment mFragment;
|
||||||
private ChatMessageListenerStub mListener;
|
private ChatMessageListenerStub mListener;
|
||||||
|
|
||||||
private ChatBubbleViewHolder.ClickListener clickListener;
|
private ChatBubbleViewHolder.ClickListener mClickListener;
|
||||||
|
|
||||||
public ChatEventsAdapter(GroupChatFragment fragment, SelectableHelper helper, int itemResource, EventLog[] history, ArrayList<LinphoneContact> participants, ChatBubbleViewHolder.ClickListener clickListener) {
|
public ChatEventsAdapter(GroupChatFragment fragment, SelectableHelper helper, int itemResource, EventLog[] history, ArrayList<LinphoneContact> participants, ChatBubbleViewHolder.ClickListener clickListener) {
|
||||||
|
|
||||||
super(helper);
|
super(helper);
|
||||||
this.mFragment=fragment;
|
mFragment = fragment;
|
||||||
this.mContext = mFragment.getActivity();
|
mContext = mFragment.getActivity();
|
||||||
this.itemResource = itemResource;
|
mItemResource = itemResource;
|
||||||
mHistory = new ArrayList<>(Arrays.asList(history));
|
mHistory = new ArrayList<>(Arrays.asList(history));
|
||||||
this.mParticipants = participants;
|
mParticipants = participants;
|
||||||
this.clickListener = clickListener;
|
mClickListener = clickListener;
|
||||||
mListener = new ChatMessageListenerStub() {
|
mListener = new ChatMessageListenerStub() {
|
||||||
@Override
|
@Override
|
||||||
public void onFileTransferProgressIndication(ChatMessage message, Content content, int offset, int total) {
|
public void onFileTransferProgressIndication(ChatMessage message, Content content, int offset, int total) {
|
||||||
|
@ -131,8 +130,8 @@ public class ChatEventsAdapter extends SelectableAdapter<ChatBubbleViewHolder> {
|
||||||
@Override
|
@Override
|
||||||
public ChatBubbleViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
public ChatBubbleViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
View v = LayoutInflater.from(parent.getContext())
|
View v = LayoutInflater.from(parent.getContext())
|
||||||
.inflate(this.itemResource, parent, false);
|
.inflate(this.mItemResource, parent, false);
|
||||||
ChatBubbleViewHolder VH = new ChatBubbleViewHolder(this.mContext,v, clickListener);
|
ChatBubbleViewHolder VH = new ChatBubbleViewHolder(this.mContext,v, mClickListener);
|
||||||
|
|
||||||
//Allows onLongClick ContextMenu on bubbles
|
//Allows onLongClick ContextMenu on bubbles
|
||||||
mFragment.registerForContextMenu(v);
|
mFragment.registerForContextMenu(v);
|
||||||
|
@ -157,7 +156,6 @@ public class ChatEventsAdapter extends SelectableAdapter<ChatBubbleViewHolder> {
|
||||||
holder.messageSendingInProgress.setVisibility(View.GONE);
|
holder.messageSendingInProgress.setVisibility(View.GONE);
|
||||||
holder.imdmLayout.setVisibility(View.INVISIBLE);
|
holder.imdmLayout.setVisibility(View.INVISIBLE);
|
||||||
holder.contactPicture.setImageBitmap(ContactsManager.getInstance().getDefaultAvatarBitmap());
|
holder.contactPicture.setImageBitmap(ContactsManager.getInstance().getDefaultAvatarBitmap());
|
||||||
//Apply generic bindings
|
|
||||||
|
|
||||||
if (isEditionEnabled()) {
|
if (isEditionEnabled()) {
|
||||||
holder.delete.setOnCheckedChangeListener(null);
|
holder.delete.setOnCheckedChangeListener(null);
|
||||||
|
@ -165,8 +163,7 @@ public class ChatEventsAdapter extends SelectableAdapter<ChatBubbleViewHolder> {
|
||||||
holder.delete.setTag(position);
|
holder.delete.setTag(position);
|
||||||
}
|
}
|
||||||
|
|
||||||
//If event is Chat Message
|
if (event.getType() == EventLog.Type.ConferenceChatMessage) {
|
||||||
if(event.getType() == EventLog.Type.ConferenceChatMessage) {
|
|
||||||
holder.bubbleLayout.setVisibility(View.VISIBLE);
|
holder.bubbleLayout.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
final ChatMessage message = event.getChatMessage();
|
final ChatMessage message = event.getChatMessage();
|
||||||
|
@ -342,7 +339,6 @@ public class ChatEventsAdapter extends SelectableAdapter<ChatBubbleViewHolder> {
|
||||||
|
|
||||||
holder.bubbleLayout.setLayoutParams(layoutParams);
|
holder.bubbleLayout.setLayoutParams(layoutParams);
|
||||||
} else { // Event is not chat message
|
} else { // Event is not chat message
|
||||||
|
|
||||||
holder.eventLayout.setVisibility(View.VISIBLE);
|
holder.eventLayout.setVisibility(View.VISIBLE);
|
||||||
|
|
||||||
Address address = event.getParticipantAddress();
|
Address address = event.getParticipantAddress();
|
||||||
|
@ -389,9 +385,6 @@ public class ChatEventsAdapter extends SelectableAdapter<ChatBubbleViewHolder> {
|
||||||
//TODO
|
//TODO
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -437,7 +430,6 @@ public class ChatEventsAdapter extends SelectableAdapter<ChatBubbleViewHolder> {
|
||||||
notifyDataSetChanged();
|
notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void loadBitmap(String path, ImageView imageView) {
|
private void loadBitmap(String path, ImageView imageView) {
|
||||||
if (cancelPotentialWork(path, imageView)) {
|
if (cancelPotentialWork(path, imageView)) {
|
||||||
if (LinphoneUtils.isExtensionImage(path)) {
|
if (LinphoneUtils.isExtensionImage(path)) {
|
||||||
|
|
|
@ -69,19 +69,16 @@ public class ChatListFragment extends Fragment implements ContactsUpdatedListene
|
||||||
public View onCreateView(final LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(final LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
|
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
//We get back all ChatRooms from the LinphoneManager and store them
|
|
||||||
mRooms = new ArrayList<>(Arrays.asList(LinphoneManager.getLc().getChatRooms()));
|
mRooms = new ArrayList<>(Arrays.asList(LinphoneManager.getLc().getChatRooms()));
|
||||||
|
|
||||||
this.mContext = getActivity().getApplicationContext();
|
this.mContext = getActivity().getApplicationContext();
|
||||||
View view = inflater.inflate(R.layout.chatlist, container, false);
|
View view = inflater.inflate(R.layout.chatlist, container, false);
|
||||||
|
|
||||||
//Views definition
|
|
||||||
mChatRoomsList = view.findViewById(R.id.chatList);
|
mChatRoomsList = view.findViewById(R.id.chatList);
|
||||||
mWaitLayout = view.findViewById(R.id.waitScreen);
|
mWaitLayout = view.findViewById(R.id.waitScreen);
|
||||||
mNewDiscussionButton = view.findViewById(R.id.new_discussion);
|
mNewDiscussionButton = view.findViewById(R.id.new_discussion);
|
||||||
mBackToCallButton = view.findViewById(R.id.back_in_call);
|
mBackToCallButton = view.findViewById(R.id.back_in_call);
|
||||||
|
|
||||||
//Creation and affectation of adapter to the RecyclerView and SelectionHelper
|
|
||||||
mSelectionHelper = new SelectableHelper(view, this);
|
mSelectionHelper = new SelectableHelper(view, this);
|
||||||
mChatRoomsAdapter = new ChatRoomsAdapter(mContext, R.layout.chatlist_cell, mRooms,this, mSelectionHelper);
|
mChatRoomsAdapter = new ChatRoomsAdapter(mContext, R.layout.chatlist_cell, mRooms,this, mSelectionHelper);
|
||||||
|
|
||||||
|
@ -89,11 +86,9 @@ public class ChatListFragment extends Fragment implements ContactsUpdatedListene
|
||||||
mSelectionHelper.setAdapter(mChatRoomsAdapter);
|
mSelectionHelper.setAdapter(mChatRoomsAdapter);
|
||||||
mSelectionHelper.setDialogMessage(R.string.chat_room_delete_dialog);
|
mSelectionHelper.setDialogMessage(R.string.chat_room_delete_dialog);
|
||||||
|
|
||||||
//Initialize the LayoutManager
|
|
||||||
RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(mContext);
|
RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(mContext);
|
||||||
mChatRoomsList.setLayoutManager(layoutManager);
|
mChatRoomsList.setLayoutManager(layoutManager);
|
||||||
|
|
||||||
//Divider between items
|
|
||||||
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(mChatRoomsList.getContext(),
|
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(mChatRoomsList.getContext(),
|
||||||
((LinearLayoutManager) layoutManager).getOrientation());
|
((LinearLayoutManager) layoutManager).getOrientation());
|
||||||
dividerItemDecoration.setDrawable(getActivity().getApplicationContext().getResources().getDrawable(R.drawable.divider));
|
dividerItemDecoration.setDrawable(getActivity().getApplicationContext().getResources().getDrawable(R.drawable.divider));
|
||||||
|
@ -115,7 +110,6 @@ public class ChatListFragment extends Fragment implements ContactsUpdatedListene
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//Update ChatRoomsList on change
|
|
||||||
mListener = new CoreListenerStub() {
|
mListener = new CoreListenerStub() {
|
||||||
@Override
|
@Override
|
||||||
public void onMessageReceived(Core lc, ChatRoom cr, ChatMessage message) {
|
public void onMessageReceived(Core lc, ChatRoom cr, ChatMessage message) {
|
||||||
|
@ -151,7 +145,6 @@ public class ChatListFragment extends Fragment implements ContactsUpdatedListene
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
//On a click on an item, go to the selected ChatRoom if no SelectionMode chosen, select the item if it does
|
|
||||||
@Override
|
@Override
|
||||||
public void onItemClicked(int position) {
|
public void onItemClicked(int position) {
|
||||||
if (mChatRoomsAdapter.isEditionEnabled()) {
|
if (mChatRoomsAdapter.isEditionEnabled()) {
|
||||||
|
@ -165,7 +158,6 @@ public class ChatListFragment extends Fragment implements ContactsUpdatedListene
|
||||||
@Override
|
@Override
|
||||||
public boolean onItemLongClicked(int position) {
|
public boolean onItemLongClicked(int position) {
|
||||||
if (!mChatRoomsAdapter.isEditionEnabled()) {
|
if (!mChatRoomsAdapter.isEditionEnabled()) {
|
||||||
//Start selection mode
|
|
||||||
mSelectionHelper.enterEditionMode();
|
mSelectionHelper.enterEditionMode();
|
||||||
}
|
}
|
||||||
mChatRoomsAdapter.toggleSelection(position);
|
mChatRoomsAdapter.toggleSelection(position);
|
||||||
|
@ -250,7 +242,6 @@ public class ChatListFragment extends Fragment implements ContactsUpdatedListene
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onContactsUpdated() {
|
public void onContactsUpdated() {
|
||||||
if (!LinphoneActivity.isInstanciated() || LinphoneActivity.instance().getCurrentFragment() != CHAT_LIST)
|
if (!LinphoneActivity.isInstanciated() || LinphoneActivity.instance().getCurrentFragment() != CHAT_LIST)
|
||||||
|
|
|
@ -48,11 +48,9 @@ import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
public class ChatRoomsAdapter extends SelectableAdapter<ChatRoomsAdapter.ChatRoomViewHolder> {
|
public class ChatRoomsAdapter extends SelectableAdapter<ChatRoomsAdapter.ChatRoomViewHolder> {
|
||||||
|
|
||||||
public static class ChatRoomViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener, View.OnLongClickListener{
|
public static class ChatRoomViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener, View.OnLongClickListener{
|
||||||
|
|
||||||
public TextView lastMessageSenderView;
|
public TextView lastMessageSenderView;
|
||||||
public TextView lastMessageView;
|
public TextView lastMessageView;
|
||||||
public TextView date;
|
public TextView date;
|
||||||
|
@ -79,9 +77,8 @@ public class ChatRoomsAdapter extends SelectableAdapter<ChatRoomsAdapter.ChatRoo
|
||||||
itemView.setOnClickListener(this);
|
itemView.setOnClickListener(this);
|
||||||
itemView.setOnLongClickListener(this);
|
itemView.setOnLongClickListener(this);
|
||||||
}
|
}
|
||||||
public void bindChatRoom(ChatRoom room) {
|
|
||||||
|
|
||||||
//Bind the data to the ViewHolder
|
public void bindChatRoom(ChatRoom room) {
|
||||||
this.mRoom = room;
|
this.mRoom = room;
|
||||||
this.lastMessageSenderView.setText(getSender(mRoom));
|
this.lastMessageSenderView.setText(getSender(mRoom));
|
||||||
this.lastMessageView.setText(mRoom.getLastMessageInHistory() != null ? mRoom.getLastMessageInHistory().getTextContent(): "");
|
this.lastMessageView.setText(mRoom.getLastMessageInHistory() != null ? mRoom.getLastMessageInHistory().getTextContent(): "");
|
||||||
|
@ -91,7 +88,6 @@ public class ChatRoomsAdapter extends SelectableAdapter<ChatRoomsAdapter.ChatRoo
|
||||||
getAvatar(mRoom);
|
getAvatar(mRoom);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Handle the onClick/onLongClick event for the ViewHolder
|
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
listener.onItemClicked(getAdapterPosition());
|
listener.onItemClicked(getAdapterPosition());
|
||||||
|
@ -105,23 +101,18 @@ public class ChatRoomsAdapter extends SelectableAdapter<ChatRoomsAdapter.ChatRoo
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Functions to get messages datas
|
|
||||||
|
|
||||||
public String getSender(ChatRoom mRoom){
|
public String getSender(ChatRoom mRoom){
|
||||||
if (mRoom.getLastMessageInHistory() != null) {
|
if (mRoom.getLastMessageInHistory() != null) {
|
||||||
LinphoneContact contact = ContactsManager.getInstance().findContactFromAddress(mRoom.getLastMessageInHistory().getFromAddress());
|
LinphoneContact contact = ContactsManager.getInstance().findContactFromAddress(mRoom.getLastMessageInHistory().getFromAddress());
|
||||||
if (contact != null) {
|
if (contact != null) {
|
||||||
return (contact.getFullName() + mContext.getString(R.string.separator));
|
return (contact.getFullName() + mContext.getString(R.string.separator));
|
||||||
} else {
|
|
||||||
return (LinphoneUtils.getAddressDisplayName(mRoom.getLastMessageInHistory().getFromAddress()) + ":");
|
|
||||||
}
|
}
|
||||||
}else{
|
return (LinphoneUtils.getAddressDisplayName(mRoom.getLastMessageInHistory().getFromAddress()) + ":");
|
||||||
return "" ;
|
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getContact(ChatRoom mRoom) {
|
public String getContact(ChatRoom mRoom) {
|
||||||
|
|
||||||
Address contactAddress = mRoom.getPeerAddress();
|
Address contactAddress = mRoom.getPeerAddress();
|
||||||
if (mRoom.hasCapability(ChatRoomCapabilities.OneToOne.toInt()) && mRoom.getParticipants().length > 0) {
|
if (mRoom.hasCapability(ChatRoomCapabilities.OneToOne.toInt()) && mRoom.getParticipants().length > 0) {
|
||||||
contactAddress = mRoom.getParticipants()[0].getAddress();
|
contactAddress = mRoom.getParticipants()[0].getAddress();
|
||||||
|
@ -133,20 +124,17 @@ public class ChatRoomsAdapter extends SelectableAdapter<ChatRoomsAdapter.ChatRoo
|
||||||
contact = ContactsManager.getInstance().findContactFromAddress(mRoom.getParticipants()[0].getAddress());
|
contact = ContactsManager.getInstance().findContactFromAddress(mRoom.getParticipants()[0].getAddress());
|
||||||
if (contact != null) {
|
if (contact != null) {
|
||||||
return (contact.getFullName());
|
return (contact.getFullName());
|
||||||
} else {
|
|
||||||
return (LinphoneUtils.getAddressDisplayName(mRoom.getParticipants()[0].getAddress()));
|
|
||||||
}
|
}
|
||||||
|
return (LinphoneUtils.getAddressDisplayName(mRoom.getParticipants()[0].getAddress()));
|
||||||
} else {
|
} else {
|
||||||
contact = ContactsManager.getInstance().findContactFromAddress(contactAddress);
|
contact = ContactsManager.getInstance().findContactFromAddress(contactAddress);
|
||||||
if (contact != null) {
|
if (contact != null) {
|
||||||
return (contact.getFullName());
|
return (contact.getFullName());
|
||||||
} else {
|
|
||||||
return (LinphoneUtils.getAddressDisplayName(contactAddress));
|
|
||||||
}
|
}
|
||||||
|
return (LinphoneUtils.getAddressDisplayName(contactAddress));
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
return (mRoom.getSubject());
|
|
||||||
}
|
}
|
||||||
|
return (mRoom.getSubject());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getAvatar(ChatRoom mRoom) {
|
public void getAvatar(ChatRoom mRoom) {
|
||||||
|
@ -159,20 +147,11 @@ public class ChatRoomsAdapter extends SelectableAdapter<ChatRoomsAdapter.ChatRoo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public interface ClickListener {
|
public interface ClickListener {
|
||||||
void onItemClicked(int position);
|
void onItemClicked(int position);
|
||||||
boolean onItemLongClicked(int position);
|
boolean onItemLongClicked(int position);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} //Holder ending
|
|
||||||
|
|
||||||
//Adapter beginning
|
|
||||||
|
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
public List<ChatRoom> mRooms;
|
public List<ChatRoom> mRooms;
|
||||||
|
@ -183,7 +162,6 @@ public class ChatRoomsAdapter extends SelectableAdapter<ChatRoomsAdapter.ChatRoo
|
||||||
private ChatRoomViewHolder.ClickListener clickListener;
|
private ChatRoomViewHolder.ClickListener clickListener;
|
||||||
|
|
||||||
public ChatRoomsAdapter(Context context, int itemResource, List<ChatRoom> mRooms, ChatRoomViewHolder.ClickListener clickListener, SelectableHelper helper) {
|
public ChatRoomsAdapter(Context context, int itemResource, List<ChatRoom> mRooms, ChatRoomViewHolder.ClickListener clickListener, SelectableHelper helper) {
|
||||||
|
|
||||||
super(helper);
|
super(helper);
|
||||||
this.clickListener = clickListener;
|
this.clickListener = clickListener;
|
||||||
this.mRooms = mRooms;
|
this.mRooms = mRooms;
|
||||||
|
@ -193,30 +171,19 @@ public class ChatRoomsAdapter extends SelectableAdapter<ChatRoomsAdapter.ChatRoo
|
||||||
//mDefaultGroupBitmap = BitmapFactory.decodeResource(context.getResources(), R.drawable.chat_group_avatar);
|
//mDefaultGroupBitmap = BitmapFactory.decodeResource(context.getResources(), R.drawable.chat_group_avatar);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ChatRoomViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
public ChatRoomViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
|
||||||
|
|
||||||
// Inflate the view and return the new ViewHolder
|
|
||||||
View view = LayoutInflater.from(parent.getContext())
|
View view = LayoutInflater.from(parent.getContext())
|
||||||
.inflate(this.itemResource, parent, false);
|
.inflate(this.itemResource, parent, false);
|
||||||
|
|
||||||
return new ChatRoomViewHolder(this.mContext, view, clickListener);
|
return new ChatRoomViewHolder(this.mContext, view, clickListener);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBindViewHolder(ChatRoomViewHolder holder, int position) {
|
public void onBindViewHolder(ChatRoomViewHolder holder, int position) {
|
||||||
//Bind datas to the ViewHolder
|
|
||||||
ChatRoom room = this.mRooms.get(position);
|
ChatRoom room = this.mRooms.get(position);
|
||||||
//Shows checkboxes when ActionMode enabled
|
|
||||||
holder.delete.setVisibility(this.isEditionEnabled() == true ? View.VISIBLE : View.INVISIBLE);
|
holder.delete.setVisibility(this.isEditionEnabled() == true ? View.VISIBLE : View.INVISIBLE);
|
||||||
holder.unreadMessages.setVisibility(this.isEditionEnabled() == false ? View.VISIBLE : View.INVISIBLE);
|
holder.unreadMessages.setVisibility(this.isEditionEnabled() == false ? View.VISIBLE : View.INVISIBLE);
|
||||||
//Set checkbox checked if item selected
|
|
||||||
holder.delete.setChecked(isSelected(position) ? true : false);
|
holder.delete.setChecked(isSelected(position) ? true : false);
|
||||||
//Bind the chatroom object to the holder
|
|
||||||
holder.bindChatRoom(room);
|
holder.bindChatRoom(room);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -241,12 +208,10 @@ public class ChatRoomsAdapter extends SelectableAdapter<ChatRoomsAdapter.ChatRoo
|
||||||
notifyDataSetChanged();
|
notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adapter's methods
|
* Adapter's methods
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getItemCount() {
|
public int getItemCount() {
|
||||||
return this.mRooms.size();
|
return this.mRooms.size();
|
||||||
|
@ -260,6 +225,5 @@ public class ChatRoomsAdapter extends SelectableAdapter<ChatRoomsAdapter.ChatRoo
|
||||||
@Override
|
@Override
|
||||||
public long getItemId(int position) {
|
public long getItemId(int position) {
|
||||||
return position;
|
return position;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -212,9 +212,6 @@ public class GroupChatFragment extends Fragment implements ChatRoomListener, Con
|
||||||
|
|
||||||
mRemoteComposing = view.findViewById(R.id.remote_composing);
|
mRemoteComposing = view.findViewById(R.id.remote_composing);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
mChatEventsList = view.findViewById(R.id.chat_message_list);
|
mChatEventsList = view.findViewById(R.id.chat_message_list);
|
||||||
mSelectionHelper = new SelectableHelper(view, this);
|
mSelectionHelper = new SelectableHelper(view, this);
|
||||||
layoutManager = new LinearLayoutManager(mContext);
|
layoutManager = new LinearLayoutManager(mContext);
|
||||||
|
@ -381,8 +378,6 @@ public class GroupChatFragment extends Fragment implements ChatRoomListener, Con
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onContextItemSelected(MenuItem item) {
|
public boolean onContextItemSelected(MenuItem item) {
|
||||||
|
|
||||||
|
@ -576,12 +571,6 @@ public class GroupChatFragment extends Fragment implements ChatRoomListener, Con
|
||||||
return mRemoteSipUri;
|
return mRemoteSipUri;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
*if isEditionEnabled() true, select the message
|
|
||||||
* */
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onItemClicked(int position) {
|
public void onItemClicked(int position) {
|
||||||
if (mEventsAdapter.isEditionEnabled()) {
|
if (mEventsAdapter.isEditionEnabled()) {
|
||||||
|
@ -589,7 +578,6 @@ public class GroupChatFragment extends Fragment implements ChatRoomListener, Con
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* File transfer related
|
* File transfer related
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -62,21 +62,15 @@ public class GroupInfoAdapter extends RecyclerView.Adapter<GroupInfoAdapter.View
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private List<ContactAddress> mItems;
|
private List<ContactAddress> mItems;
|
||||||
private View.OnClickListener mDeleteListener;
|
private View.OnClickListener mDeleteListener;
|
||||||
private boolean mHideAdminFeatures;
|
private boolean mHideAdminFeatures;
|
||||||
private ChatRoom mChatRoom;
|
private ChatRoom mChatRoom;
|
||||||
public ImageView avatar;
|
public ImageView avatar;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public GroupInfoAdapter(List<ContactAddress> items, boolean hideAdminFeatures, boolean isCreation) {
|
public GroupInfoAdapter(List<ContactAddress> items, boolean hideAdminFeatures, boolean isCreation) {
|
||||||
mItems = items;
|
mItems = items;
|
||||||
mHideAdminFeatures = hideAdminFeatures || isCreation;
|
mHideAdminFeatures = hideAdminFeatures || isCreation;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
|
@ -84,7 +78,6 @@ public class GroupInfoAdapter extends RecyclerView.Adapter<GroupInfoAdapter.View
|
||||||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.chat_infos_cell, parent, false);
|
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.chat_infos_cell, parent, false);
|
||||||
return new ViewHolder(v);
|
return new ViewHolder(v);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -157,8 +150,6 @@ public class GroupInfoAdapter extends RecyclerView.Adapter<GroupInfoAdapter.View
|
||||||
mChatRoom = room;
|
mChatRoom = room;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public int getCount() {
|
public int getCount() {
|
||||||
return mItems.size();
|
return mItems.size();
|
||||||
}
|
}
|
||||||
|
@ -167,8 +158,6 @@ public class GroupInfoAdapter extends RecyclerView.Adapter<GroupInfoAdapter.View
|
||||||
return mItems.get(i);
|
return mItems.get(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long getItemId(int i) {
|
public long getItemId(int i) {
|
||||||
return i;
|
return i;
|
||||||
|
|
|
@ -137,8 +137,6 @@ public class GroupInfoFragment extends Fragment implements ChatRoomListener {
|
||||||
mParticipantsList.addItemDecoration(dividerItemDecoration);
|
mParticipantsList.addItemDecoration(dividerItemDecoration);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
String fileSharedUri = getArguments().getString("fileSharedUri");
|
String fileSharedUri = getArguments().getString("fileSharedUri");
|
||||||
String messageDraft = getArguments().getString("messageDraft");
|
String messageDraft = getArguments().getString("messageDraft");
|
||||||
|
|
||||||
|
|
|
@ -93,26 +93,26 @@ public class ContactsListAdapter extends SelectableAdapter<ContactsListAdapter.V
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<LinphoneContact> contacts;
|
private List<LinphoneContact> mContacts;
|
||||||
String[] sections;
|
private String[] mSections;
|
||||||
ArrayList<String> sectionsList;
|
private ArrayList<String> mSectionsList;
|
||||||
Map<String, Integer> map = new LinkedHashMap<String, Integer>();
|
private Map<String, Integer> mMap = new LinkedHashMap<String, Integer>();
|
||||||
private ViewHolder.ClickListener clickListener;
|
private ViewHolder.ClickListener mClickListener;
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
private boolean isSearchMode;
|
private boolean mIsSearchMode;
|
||||||
|
|
||||||
ContactsListAdapter(Context context, List<LinphoneContact> contactsList, ViewHolder.ClickListener clickListener, SelectableHelper helper) {
|
ContactsListAdapter(Context context, List<LinphoneContact> contactsList, ViewHolder.ClickListener clickListener, SelectableHelper helper) {
|
||||||
super(helper);
|
super(helper);
|
||||||
this.mContext=context;
|
mContext = context;
|
||||||
updateDataSet(contactsList);
|
updateDataSet(contactsList);
|
||||||
this.clickListener = clickListener;
|
mClickListener = clickListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.contact_cell, parent, false);
|
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.contact_cell, parent, false);
|
||||||
return new ViewHolder(v, clickListener);
|
return new ViewHolder(v, mClickListener);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,13 +122,13 @@ public class ContactsListAdapter extends SelectableAdapter<ContactsListAdapter.V
|
||||||
|
|
||||||
holder.name.setText(contact.getFullName());
|
holder.name.setText(contact.getFullName());
|
||||||
|
|
||||||
if (!isSearchMode) {
|
if (!mIsSearchMode) {
|
||||||
String fullName = contact.getFullName();
|
String fullName = contact.getFullName();
|
||||||
if (fullName != null && !fullName.isEmpty()) {
|
if (fullName != null && !fullName.isEmpty()) {
|
||||||
holder.separatorText.setText(String.valueOf(fullName.charAt(0)));
|
holder.separatorText.setText(String.valueOf(fullName.charAt(0)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
holder.separator.setVisibility(isSearchMode || (!isSearchMode && getPositionForSection(getSectionForPosition(position)) != position ) ? View.GONE:View.VISIBLE);
|
holder.separator.setVisibility(mIsSearchMode || (!mIsSearchMode && getPositionForSection(getSectionForPosition(position)) != position ) ? View.GONE:View.VISIBLE);
|
||||||
holder.linphoneFriend.setVisibility(contact.isInFriendList() ? View.VISIBLE:View.GONE);
|
holder.linphoneFriend.setVisibility(contact.isInFriendList() ? View.VISIBLE:View.GONE);
|
||||||
|
|
||||||
holder.contactPicture.setImageBitmap(ContactsManager.getInstance().getDefaultAvatarBitmap());
|
holder.contactPicture.setImageBitmap(ContactsManager.getInstance().getDefaultAvatarBitmap());
|
||||||
|
@ -151,28 +151,28 @@ public class ContactsListAdapter extends SelectableAdapter<ContactsListAdapter.V
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public int getItemCount() {
|
public int getItemCount() {
|
||||||
return contacts.size();
|
return mContacts.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object getItem(int position) {
|
public Object getItem(int position) {
|
||||||
if (position >= getItemCount()) return null;
|
if (position >= getItemCount()) return null;
|
||||||
return contacts.get(position);
|
return mContacts.get(position);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSearchMode(boolean set){
|
public void setmIsSearchMode(boolean set){
|
||||||
isSearchMode = set;
|
mIsSearchMode = set;
|
||||||
}
|
}
|
||||||
public long getItemId(int position) {
|
public long getItemId(int position) {
|
||||||
return position;
|
return position;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateDataSet(List<LinphoneContact> contactsList) {
|
public void updateDataSet(List<LinphoneContact> contactsList) {
|
||||||
contacts = contactsList;
|
mContacts = contactsList;
|
||||||
|
|
||||||
map = new LinkedHashMap<String, Integer>();
|
mMap = new LinkedHashMap<String, Integer>();
|
||||||
String prevLetter = null;
|
String prevLetter = null;
|
||||||
for (int i = 0; i < contacts.size(); i++) {
|
for (int i = 0; i < mContacts.size(); i++) {
|
||||||
LinphoneContact contact = contacts.get(i);
|
LinphoneContact contact = mContacts.get(i);
|
||||||
String fullName = contact.getFullName();
|
String fullName = contact.getFullName();
|
||||||
if (fullName == null || fullName.isEmpty()) {
|
if (fullName == null || fullName.isEmpty()) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -180,40 +180,40 @@ public class ContactsListAdapter extends SelectableAdapter<ContactsListAdapter.V
|
||||||
String firstLetter = fullName.substring(0, 1).toUpperCase(Locale.getDefault());
|
String firstLetter = fullName.substring(0, 1).toUpperCase(Locale.getDefault());
|
||||||
if (!firstLetter.equals(prevLetter)) {
|
if (!firstLetter.equals(prevLetter)) {
|
||||||
prevLetter = firstLetter;
|
prevLetter = firstLetter;
|
||||||
map.put(firstLetter, i);
|
mMap.put(firstLetter, i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sectionsList = new ArrayList<String>(map.keySet());
|
mSectionsList = new ArrayList<String>(mMap.keySet());
|
||||||
sections = new String[sectionsList.size()];
|
mSections = new String[mSectionsList.size()];
|
||||||
sectionsList.toArray(sections);
|
mSectionsList.toArray(mSections);
|
||||||
|
|
||||||
notifyDataSetChanged();
|
notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object[] getSections() {
|
public Object[] getSections() {
|
||||||
return sections;
|
return mSections;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getPositionForSection(int sectionIndex) {
|
public int getPositionForSection(int sectionIndex) {
|
||||||
if (sectionIndex >= sections.length || sectionIndex < 0) {
|
if (sectionIndex >= mSections.length || sectionIndex < 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
return map.get(sections[sectionIndex]);
|
return mMap.get(mSections[sectionIndex]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getSectionForPosition(int position) {
|
public int getSectionForPosition(int position) {
|
||||||
if (position >= contacts.size() || position < 0) {
|
if (position >= mContacts.size() || position < 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
LinphoneContact contact = contacts.get(position);
|
LinphoneContact contact = mContacts.get(position);
|
||||||
String fullName = contact.getFullName();
|
String fullName = contact.getFullName();
|
||||||
if (fullName == null || fullName.isEmpty()) {
|
if (fullName == null || fullName.isEmpty()) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
String letter = fullName.substring(0, 1).toUpperCase(Locale.getDefault());
|
String letter = fullName.substring(0, 1).toUpperCase(Locale.getDefault());
|
||||||
return sectionsList.indexOf(letter);
|
return mSectionsList.indexOf(letter);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -188,7 +188,7 @@ public class ContactsListFragment extends Fragment implements OnItemClickListene
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
changeContactsToggle();
|
changeContactsToggle();
|
||||||
mContactAdapter.setSearchMode(true);
|
mContactAdapter.setmIsSearchMode(true);
|
||||||
|
|
||||||
List<LinphoneContact> listContact;
|
List<LinphoneContact> listContact;
|
||||||
|
|
||||||
|
|
|
@ -53,15 +53,15 @@ import java.util.List;
|
||||||
public class HistoryListFragment extends Fragment implements OnClickListener, OnItemClickListener, CallHistoryAdapter.ViewHolder.ClickListener ,ContactsUpdatedListener,SelectableHelper.DeleteListener{
|
public class HistoryListFragment extends Fragment implements OnClickListener, OnItemClickListener, CallHistoryAdapter.ViewHolder.ClickListener ,ContactsUpdatedListener,SelectableHelper.DeleteListener{
|
||||||
private RecyclerView historyList;
|
private RecyclerView historyList;
|
||||||
private TextView noCallHistory, noMissedCallHistory;
|
private TextView noCallHistory, noMissedCallHistory;
|
||||||
private ImageView missedCalls, allCalls, edit, selectAll, deselectAll, delete, cancel;
|
private ImageView missedCalls, allCalls, edit;
|
||||||
private View allCallsSelected, missedCallsSelected;
|
private View allCallsSelected, missedCallsSelected;
|
||||||
private LinearLayout editList, topBar;
|
private boolean mOnlyDisplayMissedCalls, mIsEditMode;
|
||||||
private boolean onlyDisplayMissedCalls, isEditMode;
|
|
||||||
private List<CallLog> mLogs;
|
private List<CallLog> mLogs;
|
||||||
private CallHistoryAdapter mhistoryAdapter;
|
private CallHistoryAdapter mHistoryAdapter;
|
||||||
private LinearLayoutManager layoutManager;
|
private LinearLayoutManager mLayoutManager;
|
||||||
private Context mContext;
|
private Context mContext;
|
||||||
private SelectableHelper mSelectionHelper;
|
private SelectableHelper mSelectionHelper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
|
@ -74,11 +74,11 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
|
||||||
|
|
||||||
historyList = (RecyclerView) view.findViewById(R.id.history_list);
|
historyList = (RecyclerView) view.findViewById(R.id.history_list);
|
||||||
|
|
||||||
layoutManager = new LinearLayoutManager(mContext);
|
mLayoutManager = new LinearLayoutManager(mContext);
|
||||||
historyList.setLayoutManager(layoutManager);
|
historyList.setLayoutManager(mLayoutManager);
|
||||||
//Divider between items
|
//Divider between items
|
||||||
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(historyList.getContext(),
|
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(historyList.getContext(),
|
||||||
layoutManager.getOrientation());
|
mLayoutManager.getOrientation());
|
||||||
dividerItemDecoration.setDrawable(mContext.getResources().getDrawable(R.drawable.divider));
|
dividerItemDecoration.setDrawable(mContext.getResources().getDrawable(R.drawable.divider));
|
||||||
historyList.addItemDecoration(dividerItemDecoration);
|
historyList.addItemDecoration(dividerItemDecoration);
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
|
||||||
missedCallsSelected = view.findViewById(R.id.missed_calls_select);
|
missedCallsSelected = view.findViewById(R.id.missed_calls_select);
|
||||||
|
|
||||||
allCalls.setEnabled(false);
|
allCalls.setEnabled(false);
|
||||||
onlyDisplayMissedCalls = false;
|
mOnlyDisplayMissedCalls = false;
|
||||||
|
|
||||||
edit = (ImageView) view.findViewById(R.id.edit);
|
edit = (ImageView) view.findViewById(R.id.edit);
|
||||||
|
|
||||||
|
@ -104,7 +104,6 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
|
||||||
mLogs = Arrays.asList(LinphoneManager.getLc().getCallLogs());
|
mLogs = Arrays.asList(LinphoneManager.getLc().getCallLogs());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void displayFirstLog(){
|
public void displayFirstLog(){
|
||||||
if (mLogs != null && mLogs.size() > 0) {
|
if (mLogs != null && mLogs.size() > 0) {
|
||||||
CallLog log = mLogs.get(0);
|
CallLog log = mLogs.get(0);
|
||||||
|
@ -121,7 +120,7 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
|
||||||
}
|
}
|
||||||
|
|
||||||
private void removeNotMissedCallsFromLogs() {
|
private void removeNotMissedCallsFromLogs() {
|
||||||
if (onlyDisplayMissedCalls) {
|
if (mOnlyDisplayMissedCalls) {
|
||||||
List<CallLog> missedCalls = new ArrayList<CallLog>();
|
List<CallLog> missedCalls = new ArrayList<CallLog>();
|
||||||
for (CallLog log : mLogs) {
|
for (CallLog log : mLogs) {
|
||||||
if (log.getStatus() == Call.Status.Missed) {
|
if (log.getStatus() == Call.Status.Missed) {
|
||||||
|
@ -135,7 +134,7 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
|
||||||
private boolean hideHistoryListAndDisplayMessageIfEmpty() {
|
private boolean hideHistoryListAndDisplayMessageIfEmpty() {
|
||||||
removeNotMissedCallsFromLogs();
|
removeNotMissedCallsFromLogs();
|
||||||
if (mLogs.isEmpty()) {
|
if (mLogs.isEmpty()) {
|
||||||
if (onlyDisplayMissedCalls) {
|
if (mOnlyDisplayMissedCalls) {
|
||||||
noMissedCallHistory.setVisibility(View.VISIBLE);
|
noMissedCallHistory.setVisibility(View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
noCallHistory.setVisibility(View.VISIBLE);
|
noCallHistory.setVisibility(View.VISIBLE);
|
||||||
|
@ -165,9 +164,9 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
|
||||||
|
|
||||||
mLogs = Arrays.asList(LinphoneManager.getLc().getCallLogs());
|
mLogs = Arrays.asList(LinphoneManager.getLc().getCallLogs());
|
||||||
if (!hideHistoryListAndDisplayMessageIfEmpty()) {
|
if (!hideHistoryListAndDisplayMessageIfEmpty()) {
|
||||||
mhistoryAdapter= new CallHistoryAdapter(getActivity().getApplicationContext(), mLogs, this, mSelectionHelper);
|
mHistoryAdapter = new CallHistoryAdapter(getActivity().getApplicationContext(), mLogs, this, mSelectionHelper);
|
||||||
historyList.setAdapter(mhistoryAdapter);
|
historyList.setAdapter(mHistoryAdapter);
|
||||||
mSelectionHelper.setAdapter(mhistoryAdapter);
|
mSelectionHelper.setAdapter(mHistoryAdapter);
|
||||||
mSelectionHelper.setDialogMessage(R.string.chat_room_delete_dialog);
|
mSelectionHelper.setDialogMessage(R.string.chat_room_delete_dialog);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -197,7 +196,7 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
|
||||||
allCallsSelected.setVisibility(View.VISIBLE);
|
allCallsSelected.setVisibility(View.VISIBLE);
|
||||||
missedCallsSelected.setVisibility(View.INVISIBLE);
|
missedCallsSelected.setVisibility(View.INVISIBLE);
|
||||||
missedCalls.setEnabled(true);
|
missedCalls.setEnabled(true);
|
||||||
onlyDisplayMissedCalls = false;
|
mOnlyDisplayMissedCalls = false;
|
||||||
refresh();
|
refresh();
|
||||||
}
|
}
|
||||||
if (id == R.id.missed_calls) {
|
if (id == R.id.missed_calls) {
|
||||||
|
@ -205,13 +204,13 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
|
||||||
allCallsSelected.setVisibility(View.INVISIBLE);
|
allCallsSelected.setVisibility(View.INVISIBLE);
|
||||||
missedCallsSelected.setVisibility(View.VISIBLE);
|
missedCallsSelected.setVisibility(View.VISIBLE);
|
||||||
missedCalls.setEnabled(false);
|
missedCalls.setEnabled(false);
|
||||||
onlyDisplayMissedCalls = true;
|
mOnlyDisplayMissedCalls = true;
|
||||||
}
|
}
|
||||||
if (!hideHistoryListAndDisplayMessageIfEmpty()) {
|
if (!hideHistoryListAndDisplayMessageIfEmpty()) {
|
||||||
// historyList.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE);
|
// historyList.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE);
|
||||||
mhistoryAdapter = new CallHistoryAdapter(mContext, mLogs, this ,mSelectionHelper);
|
mHistoryAdapter = new CallHistoryAdapter(mContext, mLogs, this ,mSelectionHelper);
|
||||||
historyList.setAdapter(mhistoryAdapter);
|
historyList.setAdapter(mHistoryAdapter);
|
||||||
mSelectionHelper.setAdapter(mhistoryAdapter);
|
mSelectionHelper.setAdapter(mHistoryAdapter);
|
||||||
mSelectionHelper.setDialogMessage(R.string.chat_room_delete_dialog);
|
mSelectionHelper.setDialogMessage(R.string.chat_room_delete_dialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -219,7 +218,7 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onItemClick(AdapterView<?> adapter, View view, int position, long id) {
|
public void onItemClick(AdapterView<?> adapter, View view, int position, long id) {
|
||||||
if (mhistoryAdapter.isEditionEnabled()) {
|
if (mHistoryAdapter.isEditionEnabled()) {
|
||||||
CallLog log = mLogs.get(position);
|
CallLog log = mLogs.get(position);
|
||||||
LinphoneManager.getLc().removeCallLog(log);
|
LinphoneManager.getLc().removeCallLog(log);
|
||||||
mLogs = Arrays.asList(LinphoneManager.getLc().getCallLogs());
|
mLogs = Arrays.asList(LinphoneManager.getLc().getCallLogs());
|
||||||
|
@ -228,7 +227,7 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDeleteSelection(Object[] objectsToDelete) {
|
public void onDeleteSelection(Object[] objectsToDelete) {
|
||||||
int size = mhistoryAdapter.getSelectedItemCount();
|
int size = mHistoryAdapter.getSelectedItemCount();
|
||||||
for(int i=0; i<size; i++) {
|
for(int i=0; i<size; i++) {
|
||||||
CallLog log = (CallLog) objectsToDelete[i];
|
CallLog log = (CallLog) objectsToDelete[i];
|
||||||
LinphoneManager.getLc().removeCallLog(log);
|
LinphoneManager.getLc().removeCallLog(log);
|
||||||
|
@ -238,8 +237,8 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onItemClicked(int position) {
|
public void onItemClicked(int position) {
|
||||||
if (mhistoryAdapter.isEditionEnabled()) {
|
if (mHistoryAdapter.isEditionEnabled()) {
|
||||||
mhistoryAdapter.toggleSelection(position);
|
mHistoryAdapter.toggleSelection(position);
|
||||||
} else {
|
} else {
|
||||||
if (LinphoneActivity.isInstanciated()) {
|
if (LinphoneActivity.isInstanciated()) {
|
||||||
CallLog log = mLogs.get(position);
|
CallLog log = mLogs.get(position);
|
||||||
|
@ -256,10 +255,10 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onItemLongClicked(int position) {
|
public boolean onItemLongClicked(int position) {
|
||||||
if (!mhistoryAdapter.isEditionEnabled()) {
|
if (!mHistoryAdapter.isEditionEnabled()) {
|
||||||
mSelectionHelper.enterEditionMode();
|
mSelectionHelper.enterEditionMode();
|
||||||
}
|
}
|
||||||
mhistoryAdapter.toggleSelection(position);
|
mHistoryAdapter.toggleSelection(position);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue