Fixes & improvements over listeners
This commit is contained in:
parent
f8a577d6ae
commit
3639bd67d7
3 changed files with 14 additions and 2 deletions
|
@ -305,9 +305,11 @@ public class ChatCreationFragment extends Fragment implements View.OnClickListen
|
|||
@Override
|
||||
public void onStateChanged(ChatRoom cr, ChatRoom.State newState) {
|
||||
if (newState == ChatRoom.State.Created) {
|
||||
cr.setListener(null);
|
||||
mWaitLayout.setVisibility(View.GONE);
|
||||
LinphoneActivity.instance().goToChat(cr.getPeerAddress().asStringUriOnly());
|
||||
} else if (newState == ChatRoom.State.CreationFailed) {
|
||||
cr.setListener(null);
|
||||
mWaitLayout.setVisibility(View.GONE);
|
||||
LinphoneActivity.instance().displayChatRoomError();
|
||||
Log.e("Group chat room for address " + cr.getPeerAddress() + " has failed !");
|
||||
|
|
|
@ -157,7 +157,7 @@ public class ChatRoomsAdapter extends ListSelectionAdapter {
|
|||
contactAddress = chatRoom.getParticipants()[0].getAddress();
|
||||
}
|
||||
|
||||
if (!chatRoom.hasCapability(ChatRoomCapabilities.OneToOne.toInt())) {
|
||||
if (chatRoom.hasCapability(ChatRoomCapabilities.Conference.toInt()) && chatRoom.getState() == ChatRoom.State.Created) { // Only set for state Created otherwise it will conflict with removal listener
|
||||
chatRoom.setListener(mListener);
|
||||
chatRoom.setUserData(holder);
|
||||
}
|
||||
|
|
|
@ -177,9 +177,11 @@ public class GroupInfoFragment extends Fragment implements ChatRoomListener {
|
|||
@Override
|
||||
public void onStateChanged(ChatRoom cr, ChatRoom.State newState) {
|
||||
if (newState == ChatRoom.State.Created) {
|
||||
cr.setListener(null);
|
||||
mWaitLayout.setVisibility(View.GONE);
|
||||
LinphoneActivity.instance().goToChat(cr.getPeerAddress().asStringUriOnly());
|
||||
} else if (newState == ChatRoom.State.CreationFailed) {
|
||||
cr.setListener(null);
|
||||
mWaitLayout.setVisibility(View.GONE);
|
||||
LinphoneActivity.instance().displayChatRoomError();
|
||||
Log.e("Group chat room for address " + cr.getPeerAddress() + " has failed !");
|
||||
|
@ -268,6 +270,14 @@ public class GroupInfoFragment extends Fragment implements ChatRoomListener {
|
|||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
if (mChatRoom != null) {
|
||||
mChatRoom.setListener(null);
|
||||
}
|
||||
super.onDestroy();
|
||||
}
|
||||
|
||||
private void refreshParticipantsList() {
|
||||
if (mChatRoom == null) return;
|
||||
mParticipants = new ArrayList<>();
|
||||
|
|
Loading…
Reference in a new issue