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,5 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
<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"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
@ -179,4 +184,24 @@
</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 boolean onlyDisplayLinphoneContacts;
private View allContactsSelected, linphoneContactsSelected;
private RelativeLayout searchLayout;
private RelativeLayout searchLayout, waitLayout;
private ImageView clearSearchField;
private EditText searchField;
private ProgressBar contactsFetchInProgress;
@ -78,6 +78,9 @@ public class ChatCreationFragment extends Fragment implements View.OnClickListen
contactsSelected = new ArrayList<>();
}
waitLayout = view.findViewById(R.id.waitScreen);
waitLayout.setVisibility(View.GONE);
contactsList = view.findViewById(R.id.contactsList);
contactsSelectedLayout = view.findViewById(R.id.contactsSelected);
contactsSelectLayout = view.findViewById(R.id.layoutContactsSelected);
@ -282,6 +285,7 @@ public class ChatCreationFragment extends Fragment implements View.OnClickListen
} else if (id == R.id.next) {
if (contactsSelected.size() == 1) {
contactsSelectedLayout.removeAllViews();
waitLayout.setVisibility(View.VISIBLE);
//LinphoneActivity.instance().displayChat(contactsSelected.get(0).getAddress(), "", "");
//TODO create group chat room with only two participants ?
//TODO what subject to set ?
@ -290,8 +294,10 @@ public class ChatCreationFragment extends Fragment implements View.OnClickListen
@Override
public void onStateChanged(ChatRoom cr, ChatRoom.State newState) {
if (newState == ChatRoom.State.Created) {
waitLayout.setVisibility(View.GONE);
LinphoneActivity.instance().goToChat(cr.getConferenceAddress().asStringUriOnly());
} else if (newState == ChatRoom.State.CreationFailed) {
waitLayout.setVisibility(View.GONE);
//TODO display error
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() {
@Override
public void onStateChanged(ChatRoom cr, ChatRoom.State newState) {
mWaitLayout.setVisibility(View.GONE);
if (newState == ChatRoom.State.Created) {
mWaitLayout.setVisibility(View.GONE);
LinphoneActivity.instance().goToChat(cr.getConferenceAddress().asStringUriOnly());
} else if (newState == ChatRoom.State.CreationFailed) {
mWaitLayout.setVisibility(View.GONE);
//TODO display error
Log.e("Group chat room for address " + cr.getConferenceAddress() + " has failed !");
}