This should fix the ConcurrentModificationException in contacts list

This commit is contained in:
Sylvain Berfini 2017-01-16 10:21:32 +01:00
parent d2e8900480
commit ccfbf6d5e1
4 changed files with 22 additions and 15 deletions

View file

@ -228,8 +228,10 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
@Override
public void onContactsUpdated() {
ChatListAdapter adapter = (ChatListAdapter)chatList.getAdapter();
if (adapter != null) {
adapter.notifyDataSetChanged();
}
}
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {

View file

@ -411,6 +411,7 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O
@Override
public void onContactsUpdated() {
ContactsListAdapter adapter = (ContactsListAdapter)contactsList.getAdapter();
if (adapter != null) {
contactsList.setFastScrollEnabled(false);
if (onlyDisplayLinphoneContacts) {
adapter.updateDataSet(ContactsManager.getInstance().getSIPContacts());
@ -420,6 +421,7 @@ public class ContactsListFragment extends Fragment implements OnClickListener, O
contactsList.setFastScrollEnabled(true);
contactsFetchInProgress.setVisibility(View.GONE);
}
}
public void invalidate() {
if (searchField != null && searchField.getText().toString().length() > 0) {

View file

@ -136,7 +136,6 @@ public class ContactsManager extends ContentObserver {
}
public synchronized List<LinphoneContact> getSIPContacts() {
setContacts(contacts);
return sipContacts;
}
@ -411,13 +410,15 @@ public class ContactsManager extends ContentObserver {
return contacts;
}
protected synchronized void onProgressUpdate(List<LinphoneContact>... result) {
protected void onProgressUpdate(List<LinphoneContact>... result) {
synchronized (ContactsManager.this) {
setContacts(result[0]);
contactsCache.clear();
for (ContactsUpdatedListener listener : contactsUpdatedListeners) {
listener.onContactsUpdated();
}
}
}
protected void onPostExecute(List<LinphoneContact> result) {
for (ContactsUpdatedListener listener : contactsUpdatedListeners) {

View file

@ -222,8 +222,10 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On
@Override
public void onContactsUpdated() {
CallHistoryAdapter adapter = (CallHistoryAdapter)historyList.getAdapter();
if (adapter != null) {
adapter.notifyDataSetChanged();
}
}
@Override
public void onClick(View v) {