More cleanup

This commit is contained in:
Sylvain Berfini 2018-09-03 11:26:23 +02:00
parent 0e9d85e7ae
commit 36594310f5
9 changed files with 72 additions and 151 deletions

View file

@ -81,22 +81,21 @@ public class ChatEventsAdapter extends SelectableAdapter<ChatBubbleViewHolder> {
private Context mContext;
private List<EventLog> mHistory;
private List<LinphoneContact> mParticipants;
private int itemResource;
private int mItemResource;
private Bitmap mDefaultBitmap;
private GroupChatFragment mFragment;
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) {
super(helper);
this.mFragment=fragment;
this.mContext = mFragment.getActivity();
this.itemResource = itemResource;
mFragment = fragment;
mContext = mFragment.getActivity();
mItemResource = itemResource;
mHistory = new ArrayList<>(Arrays.asList(history));
this.mParticipants = participants;
this.clickListener = clickListener;
mParticipants = participants;
mClickListener = clickListener;
mListener = new ChatMessageListenerStub() {
@Override
public void onFileTransferProgressIndication(ChatMessage message, Content content, int offset, int total) {
@ -131,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.itemResource, parent, false);
ChatBubbleViewHolder VH = new ChatBubbleViewHolder(this.mContext,v, clickListener);
.inflate(this.mItemResource, parent, false);
ChatBubbleViewHolder VH = new ChatBubbleViewHolder(this.mContext,v, mClickListener);
//Allows onLongClick ContextMenu on bubbles
mFragment.registerForContextMenu(v);
@ -157,7 +156,6 @@ public class ChatEventsAdapter extends SelectableAdapter<ChatBubbleViewHolder> {
holder.messageSendingInProgress.setVisibility(View.GONE);
holder.imdmLayout.setVisibility(View.INVISIBLE);
holder.contactPicture.setImageBitmap(ContactsManager.getInstance().getDefaultAvatarBitmap());
//Apply generic bindings
if (isEditionEnabled()) {
holder.delete.setOnCheckedChangeListener(null);
@ -165,8 +163,7 @@ public class ChatEventsAdapter extends SelectableAdapter<ChatBubbleViewHolder> {
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);
final ChatMessage message = event.getChatMessage();
@ -342,7 +339,6 @@ public class ChatEventsAdapter extends SelectableAdapter<ChatBubbleViewHolder> {
holder.bubbleLayout.setLayoutParams(layoutParams);
} else { // Event is not chat message
holder.eventLayout.setVisibility(View.VISIBLE);
Address address = event.getParticipantAddress();
@ -389,9 +385,6 @@ public class ChatEventsAdapter extends SelectableAdapter<ChatBubbleViewHolder> {
//TODO
break;
}
}
}
@ -437,7 +430,6 @@ public class ChatEventsAdapter extends SelectableAdapter<ChatBubbleViewHolder> {
notifyDataSetChanged();
}
private void loadBitmap(String path, ImageView imageView) {
if (cancelPotentialWork(path, imageView)) {
if (LinphoneUtils.isExtensionImage(path)) {

View file

@ -69,19 +69,16 @@ public class ChatListFragment extends Fragment implements ContactsUpdatedListene
public View onCreateView(final LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//We get back all ChatRooms from the LinphoneManager and store them
mRooms = new ArrayList<>(Arrays.asList(LinphoneManager.getLc().getChatRooms()));
this.mContext = getActivity().getApplicationContext();
View view = inflater.inflate(R.layout.chatlist, container, false);
//Views definition
mChatRoomsList = view.findViewById(R.id.chatList);
mWaitLayout = view.findViewById(R.id.waitScreen);
mNewDiscussionButton = view.findViewById(R.id.new_discussion);
mBackToCallButton = view.findViewById(R.id.back_in_call);
//Creation and affectation of adapter to the RecyclerView and SelectionHelper
mSelectionHelper = new SelectableHelper(view, this);
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.setDialogMessage(R.string.chat_room_delete_dialog);
//Initialize the LayoutManager
RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(mContext);
mChatRoomsList.setLayoutManager(layoutManager);
//Divider between items
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(mChatRoomsList.getContext(),
((LinearLayoutManager) layoutManager).getOrientation());
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() {
@Override
public void onMessageReceived(Core lc, ChatRoom cr, ChatMessage message) {
@ -151,7 +145,6 @@ public class ChatListFragment extends Fragment implements ContactsUpdatedListene
return view;
}
//On a click on an item, go to the selected ChatRoom if no SelectionMode chosen, select the item if it does
@Override
public void onItemClicked(int position) {
if (mChatRoomsAdapter.isEditionEnabled()) {
@ -165,7 +158,6 @@ public class ChatListFragment extends Fragment implements ContactsUpdatedListene
@Override
public boolean onItemLongClicked(int position) {
if (!mChatRoomsAdapter.isEditionEnabled()) {
//Start selection mode
mSelectionHelper.enterEditionMode();
}
mChatRoomsAdapter.toggleSelection(position);
@ -250,7 +242,6 @@ public class ChatListFragment extends Fragment implements ContactsUpdatedListene
}
}
@Override
public void onContactsUpdated() {
if (!LinphoneActivity.isInstanciated() || LinphoneActivity.instance().getCurrentFragment() != CHAT_LIST)

View file

@ -48,11 +48,9 @@ import java.util.Collections;
import java.util.Comparator;
import java.util.List;
public class ChatRoomsAdapter extends SelectableAdapter<ChatRoomsAdapter.ChatRoomViewHolder> {
public static class ChatRoomViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener, View.OnLongClickListener{
public TextView lastMessageSenderView;
public TextView lastMessageView;
public TextView date;
@ -79,9 +77,8 @@ public class ChatRoomsAdapter extends SelectableAdapter<ChatRoomsAdapter.ChatRoo
itemView.setOnClickListener(this);
itemView.setOnLongClickListener(this);
}
public void bindChatRoom(ChatRoom room) {
//Bind the data to the ViewHolder
public void bindChatRoom(ChatRoom room) {
this.mRoom = room;
this.lastMessageSenderView.setText(getSender(mRoom));
this.lastMessageView.setText(mRoom.getLastMessageInHistory() != null ? mRoom.getLastMessageInHistory().getTextContent(): "");
@ -91,7 +88,6 @@ public class ChatRoomsAdapter extends SelectableAdapter<ChatRoomsAdapter.ChatRoo
getAvatar(mRoom);
}
//Handle the onClick/onLongClick event for the ViewHolder
public void onClick(View v) {
if (listener != null) {
listener.onItemClicked(getAdapterPosition());
@ -105,23 +101,18 @@ public class ChatRoomsAdapter extends SelectableAdapter<ChatRoomsAdapter.ChatRoo
return false;
}
//Functions to get messages datas
public String getSender(ChatRoom mRoom){
if (mRoom.getLastMessageInHistory() != null) {
LinphoneContact contact = ContactsManager.getInstance().findContactFromAddress(mRoom.getLastMessageInHistory().getFromAddress());
if (contact != null) {
return (contact.getFullName() + mContext.getString(R.string.separator));
} else {
return (LinphoneUtils.getAddressDisplayName(mRoom.getLastMessageInHistory().getFromAddress()) + ":");
}
}else{
return "" ;
return (LinphoneUtils.getAddressDisplayName(mRoom.getLastMessageInHistory().getFromAddress()) + ":");
}
return null;
}
public String getContact(ChatRoom mRoom) {
Address contactAddress = mRoom.getPeerAddress();
if (mRoom.hasCapability(ChatRoomCapabilities.OneToOne.toInt()) && mRoom.getParticipants().length > 0) {
contactAddress = mRoom.getParticipants()[0].getAddress();
@ -133,20 +124,17 @@ public class ChatRoomsAdapter extends SelectableAdapter<ChatRoomsAdapter.ChatRoo
contact = ContactsManager.getInstance().findContactFromAddress(mRoom.getParticipants()[0].getAddress());
if (contact != null) {
return (contact.getFullName());
} else {
return (LinphoneUtils.getAddressDisplayName(mRoom.getParticipants()[0].getAddress()));
}
return (LinphoneUtils.getAddressDisplayName(mRoom.getParticipants()[0].getAddress()));
} else {
contact = ContactsManager.getInstance().findContactFromAddress(contactAddress);
if (contact != null) {
return (contact.getFullName());
} else {
return (LinphoneUtils.getAddressDisplayName(contactAddress));
}
return (LinphoneUtils.getAddressDisplayName(contactAddress));
}
} else {
return (mRoom.getSubject());
}
return (mRoom.getSubject());
}
public void getAvatar(ChatRoom mRoom) {
@ -159,20 +147,11 @@ public class ChatRoomsAdapter extends SelectableAdapter<ChatRoomsAdapter.ChatRoo
}
}
public interface ClickListener {
void onItemClicked(int position);
boolean onItemLongClicked(int position);
}
} //Holder ending
//Adapter beginning
}
private Context mContext;
public List<ChatRoom> mRooms;
@ -183,7 +162,6 @@ public class ChatRoomsAdapter extends SelectableAdapter<ChatRoomsAdapter.ChatRoo
private ChatRoomViewHolder.ClickListener clickListener;
public ChatRoomsAdapter(Context context, int itemResource, List<ChatRoom> mRooms, ChatRoomViewHolder.ClickListener clickListener, SelectableHelper helper) {
super(helper);
this.clickListener = clickListener;
this.mRooms = mRooms;
@ -193,30 +171,19 @@ public class ChatRoomsAdapter extends SelectableAdapter<ChatRoomsAdapter.ChatRoo
//mDefaultGroupBitmap = BitmapFactory.decodeResource(context.getResources(), R.drawable.chat_group_avatar);
}
@Override
public ChatRoomViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
// Inflate the view and return the new ViewHolder
View view = LayoutInflater.from(parent.getContext())
.inflate(this.itemResource, parent, false);
return new ChatRoomViewHolder(this.mContext, view, clickListener);
}
@Override
public void onBindViewHolder(ChatRoomViewHolder holder, int position) {
//Bind datas to the ViewHolder
ChatRoom room = this.mRooms.get(position);
//Shows checkboxes when ActionMode enabled
holder.delete.setVisibility(this.isEditionEnabled() == true ? 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);
//Bind the chatroom object to the holder
holder.bindChatRoom(room);
}
@ -241,12 +208,10 @@ public class ChatRoomsAdapter extends SelectableAdapter<ChatRoomsAdapter.ChatRoo
notifyDataSetChanged();
}
/**
* Adapter's methods
*/
@Override
public int getItemCount() {
return this.mRooms.size();
@ -260,6 +225,5 @@ public class ChatRoomsAdapter extends SelectableAdapter<ChatRoomsAdapter.ChatRoo
@Override
public long getItemId(int position) {
return position;
}
}

View file

@ -212,9 +212,6 @@ public class GroupChatFragment extends Fragment implements ChatRoomListener, Con
mRemoteComposing = view.findViewById(R.id.remote_composing);
mChatEventsList = view.findViewById(R.id.chat_message_list);
mSelectionHelper = new SelectableHelper(view, this);
layoutManager = new LinearLayoutManager(mContext);
@ -381,8 +378,6 @@ public class GroupChatFragment extends Fragment implements ChatRoomListener, Con
}
}
@Override
public boolean onContextItemSelected(MenuItem item) {
@ -576,12 +571,6 @@ public class GroupChatFragment extends Fragment implements ChatRoomListener, Con
return mRemoteSipUri;
}
/*
*if isEditionEnabled() true, select the message
* */
@Override
public void onItemClicked(int position) {
if (mEventsAdapter.isEditionEnabled()) {
@ -589,7 +578,6 @@ public class GroupChatFragment extends Fragment implements ChatRoomListener, Con
}
}
/**
* File transfer related
*/

View file

@ -62,21 +62,15 @@ public class GroupInfoAdapter extends RecyclerView.Adapter<GroupInfoAdapter.View
}
private List<ContactAddress> mItems;
private View.OnClickListener mDeleteListener;
private boolean mHideAdminFeatures;
private ChatRoom mChatRoom;
public ImageView avatar;
public GroupInfoAdapter(List<ContactAddress> items, boolean hideAdminFeatures, boolean isCreation) {
mItems = items;
mHideAdminFeatures = hideAdminFeatures || isCreation;
}
@NonNull
@ -84,7 +78,6 @@ public class GroupInfoAdapter extends RecyclerView.Adapter<GroupInfoAdapter.View
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
View v = LayoutInflater.from(parent.getContext()).inflate(R.layout.chat_infos_cell, parent, false);
return new ViewHolder(v);
}
@Override
@ -157,8 +150,6 @@ public class GroupInfoAdapter extends RecyclerView.Adapter<GroupInfoAdapter.View
mChatRoom = room;
}
public int getCount() {
return mItems.size();
}
@ -167,8 +158,6 @@ public class GroupInfoAdapter extends RecyclerView.Adapter<GroupInfoAdapter.View
return mItems.get(i);
}
@Override
public long getItemId(int i) {
return i;

View file

@ -137,8 +137,6 @@ public class GroupInfoFragment extends Fragment implements ChatRoomListener {
mParticipantsList.addItemDecoration(dividerItemDecoration);
String fileSharedUri = getArguments().getString("fileSharedUri");
String messageDraft = getArguments().getString("messageDraft");

View file

@ -93,26 +93,26 @@ public class ContactsListAdapter extends SelectableAdapter<ContactsListAdapter.V
}
}
private List<LinphoneContact> contacts;
String[] sections;
ArrayList<String> sectionsList;
Map<String, Integer> map = new LinkedHashMap<String, Integer>();
private ViewHolder.ClickListener clickListener;
private List<LinphoneContact> mContacts;
private String[] mSections;
private ArrayList<String> mSectionsList;
private Map<String, Integer> mMap = new LinkedHashMap<String, Integer>();
private ViewHolder.ClickListener mClickListener;
private Context mContext;
private boolean isSearchMode;
private boolean mIsSearchMode;
ContactsListAdapter(Context context, List<LinphoneContact> contactsList, ViewHolder.ClickListener clickListener, SelectableHelper helper) {
super(helper);
this.mContext=context;
mContext = context;
updateDataSet(contactsList);
this.clickListener = clickListener;
mClickListener = clickListener;
}
@NonNull
@Override
public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
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());
if (!isSearchMode) {
if (!mIsSearchMode) {
String fullName = contact.getFullName();
if (fullName != null && !fullName.isEmpty()) {
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.contactPicture.setImageBitmap(ContactsManager.getInstance().getDefaultAvatarBitmap());
@ -151,28 +151,28 @@ public class ContactsListAdapter extends SelectableAdapter<ContactsListAdapter.V
}
@Override
public int getItemCount() {
return contacts.size();
return mContacts.size();
}
public Object getItem(int position) {
if (position >= getItemCount()) return null;
return contacts.get(position);
return mContacts.get(position);
}
public void setSearchMode(boolean set){
isSearchMode = set;
public void setmIsSearchMode(boolean set){
mIsSearchMode = set;
}
public long getItemId(int position) {
return position;
}
public void updateDataSet(List<LinphoneContact> contactsList) {
contacts = contactsList;
mContacts = contactsList;
map = new LinkedHashMap<String, Integer>();
mMap = new LinkedHashMap<String, Integer>();
String prevLetter = null;
for (int i = 0; i < contacts.size(); i++) {
LinphoneContact contact = contacts.get(i);
for (int i = 0; i < mContacts.size(); i++) {
LinphoneContact contact = mContacts.get(i);
String fullName = contact.getFullName();
if (fullName == null || fullName.isEmpty()) {
continue;
@ -180,40 +180,40 @@ public class ContactsListAdapter extends SelectableAdapter<ContactsListAdapter.V
String firstLetter = fullName.substring(0, 1).toUpperCase(Locale.getDefault());
if (!firstLetter.equals(prevLetter)) {
prevLetter = firstLetter;
map.put(firstLetter, i);
mMap.put(firstLetter, i);
}
}
sectionsList = new ArrayList<String>(map.keySet());
sections = new String[sectionsList.size()];
sectionsList.toArray(sections);
mSectionsList = new ArrayList<String>(mMap.keySet());
mSections = new String[mSectionsList.size()];
mSectionsList.toArray(mSections);
notifyDataSetChanged();
}
@Override
public Object[] getSections() {
return sections;
return mSections;
}
@Override
public int getPositionForSection(int sectionIndex) {
if (sectionIndex >= sections.length || sectionIndex < 0) {
if (sectionIndex >= mSections.length || sectionIndex < 0) {
return 0;
}
return map.get(sections[sectionIndex]);
return mMap.get(mSections[sectionIndex]);
}
@Override
public int getSectionForPosition(int position) {
if (position >= contacts.size() || position < 0) {
if (position >= mContacts.size() || position < 0) {
return 0;
}
LinphoneContact contact = contacts.get(position);
LinphoneContact contact = mContacts.get(position);
String fullName = contact.getFullName();
if (fullName == null || fullName.isEmpty()) {
return 0;
}
String letter = fullName.substring(0, 1).toUpperCase(Locale.getDefault());
return sectionsList.indexOf(letter);
return mSectionsList.indexOf(letter);
}
}

View file

@ -188,7 +188,7 @@ public class ContactsListFragment extends Fragment implements OnItemClickListene
return;
}
changeContactsToggle();
mContactAdapter.setSearchMode(true);
mContactAdapter.setmIsSearchMode(true);
List<LinphoneContact> listContact;

View file

@ -53,15 +53,15 @@ import java.util.List;
public class HistoryListFragment extends Fragment implements OnClickListener, OnItemClickListener, CallHistoryAdapter.ViewHolder.ClickListener ,ContactsUpdatedListener,SelectableHelper.DeleteListener{
private RecyclerView historyList;
private TextView noCallHistory, noMissedCallHistory;
private ImageView missedCalls, allCalls, edit, selectAll, deselectAll, delete, cancel;
private ImageView missedCalls, allCalls, edit;
private View allCallsSelected, missedCallsSelected;
private LinearLayout editList, topBar;
private boolean onlyDisplayMissedCalls, isEditMode;
private boolean mOnlyDisplayMissedCalls, mIsEditMode;
private List<CallLog> mLogs;
private CallHistoryAdapter mhistoryAdapter;
private LinearLayoutManager layoutManager;
private CallHistoryAdapter mHistoryAdapter;
private LinearLayoutManager mLayoutManager;
private Context mContext;
private SelectableHelper mSelectionHelper;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
@ -74,11 +74,11 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
historyList = (RecyclerView) view.findViewById(R.id.history_list);
layoutManager = new LinearLayoutManager(mContext);
historyList.setLayoutManager(layoutManager);
mLayoutManager = new LinearLayoutManager(mContext);
historyList.setLayoutManager(mLayoutManager);
//Divider between items
DividerItemDecoration dividerItemDecoration = new DividerItemDecoration(historyList.getContext(),
layoutManager.getOrientation());
mLayoutManager.getOrientation());
dividerItemDecoration.setDrawable(mContext.getResources().getDrawable(R.drawable.divider));
historyList.addItemDecoration(dividerItemDecoration);
@ -93,7 +93,7 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
missedCallsSelected = view.findViewById(R.id.missed_calls_select);
allCalls.setEnabled(false);
onlyDisplayMissedCalls = false;
mOnlyDisplayMissedCalls = false;
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());
}
public void displayFirstLog(){
if (mLogs != null && mLogs.size() > 0) {
CallLog log = mLogs.get(0);
@ -121,7 +120,7 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
}
private void removeNotMissedCallsFromLogs() {
if (onlyDisplayMissedCalls) {
if (mOnlyDisplayMissedCalls) {
List<CallLog> missedCalls = new ArrayList<CallLog>();
for (CallLog log : mLogs) {
if (log.getStatus() == Call.Status.Missed) {
@ -135,7 +134,7 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
private boolean hideHistoryListAndDisplayMessageIfEmpty() {
removeNotMissedCallsFromLogs();
if (mLogs.isEmpty()) {
if (onlyDisplayMissedCalls) {
if (mOnlyDisplayMissedCalls) {
noMissedCallHistory.setVisibility(View.VISIBLE);
} else {
noCallHistory.setVisibility(View.VISIBLE);
@ -165,9 +164,9 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
mLogs = Arrays.asList(LinphoneManager.getLc().getCallLogs());
if (!hideHistoryListAndDisplayMessageIfEmpty()) {
mhistoryAdapter= new CallHistoryAdapter(getActivity().getApplicationContext(), mLogs, this, mSelectionHelper);
historyList.setAdapter(mhistoryAdapter);
mSelectionHelper.setAdapter(mhistoryAdapter);
mHistoryAdapter = new CallHistoryAdapter(getActivity().getApplicationContext(), mLogs, this, mSelectionHelper);
historyList.setAdapter(mHistoryAdapter);
mSelectionHelper.setAdapter(mHistoryAdapter);
mSelectionHelper.setDialogMessage(R.string.chat_room_delete_dialog);
}
}
@ -197,7 +196,7 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
allCallsSelected.setVisibility(View.VISIBLE);
missedCallsSelected.setVisibility(View.INVISIBLE);
missedCalls.setEnabled(true);
onlyDisplayMissedCalls = false;
mOnlyDisplayMissedCalls = false;
refresh();
}
if (id == R.id.missed_calls) {
@ -205,13 +204,13 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
allCallsSelected.setVisibility(View.INVISIBLE);
missedCallsSelected.setVisibility(View.VISIBLE);
missedCalls.setEnabled(false);
onlyDisplayMissedCalls = true;
mOnlyDisplayMissedCalls = true;
}
if (!hideHistoryListAndDisplayMessageIfEmpty()) {
// historyList.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE);
mhistoryAdapter = new CallHistoryAdapter(mContext, mLogs, this ,mSelectionHelper);
historyList.setAdapter(mhistoryAdapter);
mSelectionHelper.setAdapter(mhistoryAdapter);
mHistoryAdapter = new CallHistoryAdapter(mContext, mLogs, this ,mSelectionHelper);
historyList.setAdapter(mHistoryAdapter);
mSelectionHelper.setAdapter(mHistoryAdapter);
mSelectionHelper.setDialogMessage(R.string.chat_room_delete_dialog);
}
@ -219,7 +218,7 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
@Override
public void onItemClick(AdapterView<?> adapter, View view, int position, long id) {
if (mhistoryAdapter.isEditionEnabled()) {
if (mHistoryAdapter.isEditionEnabled()) {
CallLog log = mLogs.get(position);
LinphoneManager.getLc().removeCallLog(log);
mLogs = Arrays.asList(LinphoneManager.getLc().getCallLogs());
@ -228,7 +227,7 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
@Override
public void onDeleteSelection(Object[] objectsToDelete) {
int size = mhistoryAdapter.getSelectedItemCount();
int size = mHistoryAdapter.getSelectedItemCount();
for(int i=0; i<size; i++) {
CallLog log = (CallLog) objectsToDelete[i];
LinphoneManager.getLc().removeCallLog(log);
@ -238,8 +237,8 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
@Override
public void onItemClicked(int position) {
if (mhistoryAdapter.isEditionEnabled()) {
mhistoryAdapter.toggleSelection(position);
if (mHistoryAdapter.isEditionEnabled()) {
mHistoryAdapter.toggleSelection(position);
} else {
if (LinphoneActivity.isInstanciated()) {
CallLog log = mLogs.get(position);
@ -256,10 +255,10 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
@Override
public boolean onItemLongClicked(int position) {
if (!mhistoryAdapter.isEditionEnabled()) {
if (!mHistoryAdapter.isEditionEnabled()) {
mSelectionHelper.enterEditionMode();
}
mhistoryAdapter.toggleSelection(position);
mHistoryAdapter.toggleSelection(position);
return true;
}
}