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
|
@Override
|
||||||
public void onStateChanged(ChatRoom cr, ChatRoom.State newState) {
|
public void onStateChanged(ChatRoom cr, ChatRoom.State newState) {
|
||||||
if (newState == ChatRoom.State.Created) {
|
if (newState == ChatRoom.State.Created) {
|
||||||
|
cr.setListener(null);
|
||||||
mWaitLayout.setVisibility(View.GONE);
|
mWaitLayout.setVisibility(View.GONE);
|
||||||
LinphoneActivity.instance().goToChat(cr.getPeerAddress().asStringUriOnly());
|
LinphoneActivity.instance().goToChat(cr.getPeerAddress().asStringUriOnly());
|
||||||
} else if (newState == ChatRoom.State.CreationFailed) {
|
} else if (newState == ChatRoom.State.CreationFailed) {
|
||||||
|
cr.setListener(null);
|
||||||
mWaitLayout.setVisibility(View.GONE);
|
mWaitLayout.setVisibility(View.GONE);
|
||||||
LinphoneActivity.instance().displayChatRoomError();
|
LinphoneActivity.instance().displayChatRoomError();
|
||||||
Log.e("Group chat room for address " + cr.getPeerAddress() + " has failed !");
|
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();
|
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.setListener(mListener);
|
||||||
chatRoom.setUserData(holder);
|
chatRoom.setUserData(holder);
|
||||||
}
|
}
|
||||||
|
|
|
@ -177,9 +177,11 @@ public class GroupInfoFragment extends Fragment implements ChatRoomListener {
|
||||||
@Override
|
@Override
|
||||||
public void onStateChanged(ChatRoom cr, ChatRoom.State newState) {
|
public void onStateChanged(ChatRoom cr, ChatRoom.State newState) {
|
||||||
if (newState == ChatRoom.State.Created) {
|
if (newState == ChatRoom.State.Created) {
|
||||||
|
cr.setListener(null);
|
||||||
mWaitLayout.setVisibility(View.GONE);
|
mWaitLayout.setVisibility(View.GONE);
|
||||||
LinphoneActivity.instance().goToChat(cr.getPeerAddress().asStringUriOnly());
|
LinphoneActivity.instance().goToChat(cr.getPeerAddress().asStringUriOnly());
|
||||||
} else if (newState == ChatRoom.State.CreationFailed) {
|
} else if (newState == ChatRoom.State.CreationFailed) {
|
||||||
|
cr.setListener(null);
|
||||||
mWaitLayout.setVisibility(View.GONE);
|
mWaitLayout.setVisibility(View.GONE);
|
||||||
LinphoneActivity.instance().displayChatRoomError();
|
LinphoneActivity.instance().displayChatRoomError();
|
||||||
Log.e("Group chat room for address " + cr.getPeerAddress() + " has failed !");
|
Log.e("Group chat room for address " + cr.getPeerAddress() + " has failed !");
|
||||||
|
@ -268,7 +270,15 @@ public class GroupInfoFragment extends Fragment implements ChatRoomListener {
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void refreshParticipantsList() {
|
@Override
|
||||||
|
public void onDestroy() {
|
||||||
|
if (mChatRoom != null) {
|
||||||
|
mChatRoom.setListener(null);
|
||||||
|
}
|
||||||
|
super.onDestroy();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void refreshParticipantsList() {
|
||||||
if (mChatRoom == null) return;
|
if (mChatRoom == null) return;
|
||||||
mParticipants = new ArrayList<>();
|
mParticipants = new ArrayList<>();
|
||||||
for (Participant p : mChatRoom.getParticipants()) {
|
for (Participant p : mChatRoom.getParticipants()) {
|
||||||
|
|
Loading…
Reference in a new issue