diff --git a/src/org/linphone/ChatListFragment.java b/src/org/linphone/ChatListFragment.java index c303e0554..64abbcea1 100644 --- a/src/org/linphone/ChatListFragment.java +++ b/src/org/linphone/ChatListFragment.java @@ -19,6 +19,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ import java.util.List; +import org.linphone.HistoryListFragment.CallHistoryAdapter; import org.linphone.core.LinphoneAddress; import org.linphone.core.LinphoneChatMessage; import org.linphone.core.LinphoneChatRoom; @@ -55,7 +56,7 @@ import android.widget.TextView; /** * @author Sylvain Berfini */ -public class ChatListFragment extends Fragment implements OnClickListener, OnItemClickListener { +public class ChatListFragment extends Fragment implements OnClickListener, OnItemClickListener, ContactsUpdatedListener { private LayoutInflater mInflater; private List mConversations; private ListView chatList; @@ -193,6 +194,7 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte @Override public void onResume() { super.onResume(); + ContactsManager.addContactsListener(this); if (LinphoneManager.getLc().getCallsNb() > 0) { backInCall.setVisibility(View.VISIBLE); @@ -219,9 +221,15 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte if (lc != null) { lc.removeListener(mListener); } + ContactsManager.removeContactsListener(this); super.onPause(); } + @Override + public void onContactsUpdated() { + hideAndDisplayMessageIfNoChat(); + } + @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); diff --git a/src/org/linphone/HistoryListFragment.java b/src/org/linphone/HistoryListFragment.java index 9609af2a9..cb4e95dc3 100644 --- a/src/org/linphone/HistoryListFragment.java +++ b/src/org/linphone/HistoryListFragment.java @@ -52,7 +52,7 @@ import android.widget.TextView; /** * @author Sylvain Berfini */ -public class HistoryListFragment extends Fragment implements OnClickListener, OnItemClickListener { +public class HistoryListFragment extends Fragment implements OnClickListener, OnItemClickListener, ContactsUpdatedListener { private ListView historyList; private LayoutInflater mInflater; private TextView noCallHistory, noMissedCallHistory; @@ -198,6 +198,7 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On @Override public void onResume() { super.onResume(); + ContactsManager.addContactsListener(this); if (LinphoneActivity.isInstanciated()) { LinphoneActivity.instance().selectMenu(FragmentsAvailable.HISTORY_LIST); @@ -211,6 +212,17 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On historyList.setAdapter(new CallHistoryAdapter(getActivity().getApplicationContext())); } } + + @Override + public void onPause() { + ContactsManager.removeContactsListener(this); + super.onPause(); + } + + @Override + public void onContactsUpdated() { + historyList.setAdapter(new CallHistoryAdapter(getActivity().getApplicationContext())); + } @Override public void onClick(View v) { @@ -327,18 +339,20 @@ public class HistoryListFragment extends Fragment implements OnClickListener, On topBar.setVisibility(View.VISIBLE); refresh(); - if (!hideHistoryListAndDisplayMessageIfEmpty()){ + if (!hideHistoryListAndDisplayMessageIfEmpty()) { historyList.setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE); historyList.setAdapter(new CallHistoryAdapter(getActivity().getApplicationContext())); } - if(getResources().getBoolean(R.bool.isTablet)){ + if (getResources().getBoolean(R.bool.isTablet)) { displayFirstLog(); } } class CallHistoryAdapter extends BaseAdapter { CallHistoryAdapter(Context aContext) { + } + public int getCount() { return mLogs.size(); } diff --git a/src/org/linphone/LinphoneContact.java b/src/org/linphone/LinphoneContact.java index a4850dd0e..dddec55f6 100644 --- a/src/org/linphone/LinphoneContact.java +++ b/src/org/linphone/LinphoneContact.java @@ -400,7 +400,11 @@ public class LinphoneContact implements Serializable, Comparable