Auto reload of history views when a call ends
This commit is contained in:
parent
2217070995
commit
71efda66ce
2 changed files with 39 additions and 0 deletions
|
@ -37,12 +37,14 @@ import org.linphone.contacts.ContactsManager;
|
|||
import org.linphone.contacts.LinphoneContact;
|
||||
import org.linphone.contacts.views.ContactAvatar;
|
||||
import org.linphone.core.Address;
|
||||
import org.linphone.core.Call;
|
||||
import org.linphone.core.CallLog;
|
||||
import org.linphone.core.ChatRoom;
|
||||
import org.linphone.core.ChatRoomBackend;
|
||||
import org.linphone.core.ChatRoomListenerStub;
|
||||
import org.linphone.core.ChatRoomParams;
|
||||
import org.linphone.core.Core;
|
||||
import org.linphone.core.CoreListenerStub;
|
||||
import org.linphone.core.Factory;
|
||||
import org.linphone.core.FriendCapability;
|
||||
import org.linphone.core.ProxyConfig;
|
||||
|
@ -60,6 +62,7 @@ public class HistoryDetailFragment extends Fragment {
|
|||
private ChatRoom mChatRoom;
|
||||
private ChatRoomListenerStub mChatRoomCreationListener;
|
||||
private ListView mLogsList;
|
||||
private CoreListenerStub mListener;
|
||||
|
||||
@Override
|
||||
public View onCreateView(
|
||||
|
@ -167,14 +170,34 @@ public class HistoryDetailFragment extends Fragment {
|
|||
mLogsList = view.findViewById(R.id.logs_list);
|
||||
displayHistory();
|
||||
|
||||
mListener =
|
||||
new CoreListenerStub() {
|
||||
@Override
|
||||
public void onCallStateChanged(
|
||||
Core core, Call call, Call.State state, String message) {
|
||||
if (state == Call.State.End || state == Call.State.Error) {
|
||||
displayHistory();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
||||
LinphoneManager.getCore().addListener(mListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
if (mChatRoom != null) {
|
||||
mChatRoom.removeListener(mChatRoomCreationListener);
|
||||
}
|
||||
LinphoneManager.getCore().removeListener(mListener);
|
||||
|
||||
super.onPause();
|
||||
}
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@ import org.linphone.core.Address;
|
|||
import org.linphone.core.Call;
|
||||
import org.linphone.core.CallLog;
|
||||
import org.linphone.core.Core;
|
||||
import org.linphone.core.CoreListenerStub;
|
||||
import org.linphone.utils.SelectableHelper;
|
||||
|
||||
public class HistoryFragment extends Fragment
|
||||
|
@ -62,6 +63,7 @@ public class HistoryFragment extends Fragment
|
|||
private List<CallLog> mLogs;
|
||||
private HistoryAdapter mHistoryAdapter;
|
||||
private SelectableHelper mSelectionHelper;
|
||||
private CoreListenerStub mListener;
|
||||
|
||||
@Override
|
||||
public View onCreateView(
|
||||
|
@ -96,14 +98,27 @@ public class HistoryFragment extends Fragment
|
|||
mAllCalls.setEnabled(false);
|
||||
mOnlyDisplayMissedCalls = false;
|
||||
|
||||
mListener =
|
||||
new CoreListenerStub() {
|
||||
@Override
|
||||
public void onCallStateChanged(
|
||||
Core core, Call call, Call.State state, String message) {
|
||||
if (state == Call.State.End || state == Call.State.Error) {
|
||||
reloadData();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
|
||||
ContactsManager.getInstance().addContactsListener(this);
|
||||
LinphoneContext.instance().addCoreStartedListener(this);
|
||||
LinphoneManager.getCore().addListener(mListener);
|
||||
|
||||
reloadData();
|
||||
}
|
||||
|
@ -112,6 +127,7 @@ public class HistoryFragment extends Fragment
|
|||
public void onPause() {
|
||||
ContactsManager.getInstance().removeContactsListener(this);
|
||||
LinphoneContext.instance().removeCoreStartedListener(this);
|
||||
LinphoneManager.getCore().removeListener(mListener);
|
||||
|
||||
super.onPause();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue