Fixed wait layout of GroupChatInfo fragment + added the same of ChatCreationFragment

This commit is contained in:
Sylvain Berfini 2017-11-03 11:38:11 +01:00
parent 7c747ec700
commit a90a8f9fef
3 changed files with 191 additions and 159 deletions

View file

@ -1,4 +1,9 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
@ -180,3 +185,23 @@
</RelativeLayout> </RelativeLayout>
</LinearLayout> </LinearLayout>
<RelativeLayout
android:id="@+id/waitScreen"
android:clickable="true"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#99c4c4c4">
<ProgressBar
android:indeterminate="true"
android:indeterminateTint="@color/colorA"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true">
</ProgressBar>
</RelativeLayout>
</RelativeLayout>

View file

@ -60,7 +60,7 @@ public class ChatCreationFragment extends Fragment implements View.OnClickListen
private ImageView allContacts, linphoneContacts; private ImageView allContacts, linphoneContacts;
private boolean onlyDisplayLinphoneContacts; private boolean onlyDisplayLinphoneContacts;
private View allContactsSelected, linphoneContactsSelected; private View allContactsSelected, linphoneContactsSelected;
private RelativeLayout searchLayout; private RelativeLayout searchLayout, waitLayout;
private ImageView clearSearchField; private ImageView clearSearchField;
private EditText searchField; private EditText searchField;
private ProgressBar contactsFetchInProgress; private ProgressBar contactsFetchInProgress;
@ -78,6 +78,9 @@ public class ChatCreationFragment extends Fragment implements View.OnClickListen
contactsSelected = new ArrayList<>(); contactsSelected = new ArrayList<>();
} }
waitLayout = view.findViewById(R.id.waitScreen);
waitLayout.setVisibility(View.GONE);
contactsList = view.findViewById(R.id.contactsList); contactsList = view.findViewById(R.id.contactsList);
contactsSelectedLayout = view.findViewById(R.id.contactsSelected); contactsSelectedLayout = view.findViewById(R.id.contactsSelected);
contactsSelectLayout = view.findViewById(R.id.layoutContactsSelected); contactsSelectLayout = view.findViewById(R.id.layoutContactsSelected);
@ -282,6 +285,7 @@ public class ChatCreationFragment extends Fragment implements View.OnClickListen
} else if (id == R.id.next) { } else if (id == R.id.next) {
if (contactsSelected.size() == 1) { if (contactsSelected.size() == 1) {
contactsSelectedLayout.removeAllViews(); contactsSelectedLayout.removeAllViews();
waitLayout.setVisibility(View.VISIBLE);
//LinphoneActivity.instance().displayChat(contactsSelected.get(0).getAddress(), "", ""); //LinphoneActivity.instance().displayChat(contactsSelected.get(0).getAddress(), "", "");
//TODO create group chat room with only two participants ? //TODO create group chat room with only two participants ?
//TODO what subject to set ? //TODO what subject to set ?
@ -290,8 +294,10 @@ 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) {
waitLayout.setVisibility(View.GONE);
LinphoneActivity.instance().goToChat(cr.getConferenceAddress().asStringUriOnly()); LinphoneActivity.instance().goToChat(cr.getConferenceAddress().asStringUriOnly());
} else if (newState == ChatRoom.State.CreationFailed) { } else if (newState == ChatRoom.State.CreationFailed) {
waitLayout.setVisibility(View.GONE);
//TODO display error //TODO display error
Log.e("Group chat room for address " + cr.getConferenceAddress() + " has failed !"); Log.e("Group chat room for address " + cr.getConferenceAddress() + " has failed !");
} }

View file

@ -142,10 +142,11 @@ public class GroupInfoFragment extends Fragment {
chatRoom.setListener(new ChatRoomListenerStub() { chatRoom.setListener(new ChatRoomListenerStub() {
@Override @Override
public void onStateChanged(ChatRoom cr, ChatRoom.State newState) { public void onStateChanged(ChatRoom cr, ChatRoom.State newState) {
mWaitLayout.setVisibility(View.GONE);
if (newState == ChatRoom.State.Created) { if (newState == ChatRoom.State.Created) {
mWaitLayout.setVisibility(View.GONE);
LinphoneActivity.instance().goToChat(cr.getConferenceAddress().asStringUriOnly()); LinphoneActivity.instance().goToChat(cr.getConferenceAddress().asStringUriOnly());
} else if (newState == ChatRoom.State.CreationFailed) { } else if (newState == ChatRoom.State.CreationFailed) {
mWaitLayout.setVisibility(View.GONE);
//TODO display error //TODO display error
Log.e("Group chat room for address " + cr.getConferenceAddress() + " has failed !"); Log.e("Group chat room for address " + cr.getConferenceAddress() + " has failed !");
} }