Fixed back button on chat room group info during creation process
This commit is contained in:
parent
71efda66ce
commit
eca542ae28
3 changed files with 28 additions and 25 deletions
|
@ -20,6 +20,7 @@
|
||||||
package org.linphone.chat;
|
package org.linphone.chat;
|
||||||
|
|
||||||
import android.app.Fragment;
|
import android.app.Fragment;
|
||||||
|
import android.app.FragmentManager;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
@ -258,7 +259,18 @@ public class ChatActivity extends MainActivity {
|
||||||
ArrayList<ContactAddress> participants,
|
ArrayList<ContactAddress> participants,
|
||||||
String subject,
|
String subject,
|
||||||
boolean encrypted,
|
boolean encrypted,
|
||||||
boolean isGroupChatRoom) {
|
boolean isGroupChatRoom,
|
||||||
|
boolean cleanBackStack) {
|
||||||
|
if (cleanBackStack) {
|
||||||
|
FragmentManager fm = getFragmentManager();
|
||||||
|
while (fm.getBackStackEntryCount() > 0) {
|
||||||
|
fm.popBackStackImmediate();
|
||||||
|
}
|
||||||
|
if (isTablet()) {
|
||||||
|
showEmptyChildFragment();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Bundle extras = new Bundle();
|
Bundle extras = new Bundle();
|
||||||
if (peerAddress != null) {
|
if (peerAddress != null) {
|
||||||
extras.putSerializable("RemoteSipUri", peerAddress.asStringUriOnly());
|
extras.putSerializable("RemoteSipUri", peerAddress.asStringUriOnly());
|
||||||
|
|
|
@ -108,7 +108,7 @@ public class ChatRoomsFragment extends Fragment
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
((ChatActivity) getActivity())
|
((ChatActivity) getActivity())
|
||||||
.showChatRoomCreation(null, null, null, false, false);
|
.showChatRoomCreation(null, null, null, false, false, false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@ public class ChatRoomsFragment extends Fragment
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
((ChatActivity) getActivity())
|
((ChatActivity) getActivity())
|
||||||
.showChatRoomCreation(null, null, null, false, true);
|
.showChatRoomCreation(null, null, null, false, true, false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,6 @@ import static android.content.Context.INPUT_METHOD_SERVICE;
|
||||||
|
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
import android.app.Fragment;
|
import android.app.Fragment;
|
||||||
import android.app.FragmentManager;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
|
@ -146,7 +145,11 @@ public class GroupInfoFragment extends Fragment {
|
||||||
new View.OnClickListener() {
|
new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
((ChatActivity) getActivity()).goBack();
|
if (mIsAlreadyCreatedGroup) {
|
||||||
|
((ChatActivity) getActivity()).goBack();
|
||||||
|
} else {
|
||||||
|
goBackToChatCreationFragment();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -300,26 +303,14 @@ public class GroupInfoFragment extends Fragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void goBackToChatCreationFragment() {
|
private void goBackToChatCreationFragment() {
|
||||||
boolean previousFragmentInBackStackIsChatRoomCreation = false;
|
((ChatActivity) getActivity())
|
||||||
FragmentManager fragmentManager = getActivity().getFragmentManager();
|
.showChatRoomCreation(
|
||||||
int count = fragmentManager.getBackStackEntryCount();
|
mGroupChatRoomAddress,
|
||||||
if (count > 1) {
|
mParticipants,
|
||||||
FragmentManager.BackStackEntry entry = fragmentManager.getBackStackEntryAt(count - 1);
|
mSubject,
|
||||||
if ("Chat room creation".equals(entry.getName())) {
|
mIsEncryptionEnabled,
|
||||||
previousFragmentInBackStackIsChatRoomCreation = true;
|
true,
|
||||||
((ChatActivity) getActivity()).goBack();
|
!mIsAlreadyCreatedGroup);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!previousFragmentInBackStackIsChatRoomCreation) {
|
|
||||||
((ChatActivity) getActivity())
|
|
||||||
.showChatRoomCreation(
|
|
||||||
mGroupChatRoomAddress,
|
|
||||||
mParticipants,
|
|
||||||
mSubject,
|
|
||||||
mIsEncryptionEnabled,
|
|
||||||
true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void refreshParticipantsList() {
|
private void refreshParticipantsList() {
|
||||||
|
|
Loading…
Reference in a new issue