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,182 +1,207 @@
<?xml version="1.0" encoding="utf-8"?> <?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_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent">
android:orientation="vertical"
android:background="@color/colorH" >
<LinearLayout <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/top_bar" android:layout_width="match_parent"
android:orientation="horizontal" android:layout_height="match_parent"
android:background="@color/colorF" android:orientation="vertical"
android:layout_width="match_parent" android:background="@color/colorH" >
android:layout_height="60dp">
<ImageView <LinearLayout
android:id="@+id/back" android:id="@+id/top_bar"
android:layout_width="0dp" android:orientation="horizontal"
android:layout_height="match_parent" android:background="@color/colorF"
android:layout_gravity="left" android:layout_width="match_parent"
android:layout_weight="0.2" android:layout_height="60dp">
android:background="@drawable/toolbar_button"
android:contentDescription="@string/content_description_back"
android:padding="18dp"
android:src="@drawable/back"/>
<RelativeLayout <ImageView
android:layout_width="0dp" android:id="@+id/back"
android:layout_height="match_parent" android:layout_width="0dp"
android:layout_weight="0.2"> android:layout_height="match_parent"
android:layout_gravity="left"
android:layout_weight="0.2"
android:background="@drawable/toolbar_button"
android:contentDescription="@string/content_description_back"
android:padding="18dp"
android:src="@drawable/back"/>
<ImageView <RelativeLayout
android:id="@+id/all_contacts" android:layout_width="0dp"
android:layout_width="match_parent" android:layout_height="match_parent"
android:layout_height="match_parent" android:layout_weight="0.2">
android:background="@drawable/toolbar_button"
android:contentDescription="@string/content_description_all_contacts"
android:padding="15dp"
android:src="@drawable/contacts_all"/>
<View <ImageView
android:id="@+id/all_contacts_select" android:id="@+id/all_contacts"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="5dp" android:layout_height="match_parent"
android:layout_alignParentBottom="true" android:background="@drawable/toolbar_button"
android:background="@color/colorA"/> android:contentDescription="@string/content_description_all_contacts"
</RelativeLayout> android:padding="15dp"
android:src="@drawable/contacts_all"/>
<RelativeLayout <View
android:layout_width="0dp" android:id="@+id/all_contacts_select"
android:layout_height="match_parent" android:layout_width="match_parent"
android:layout_weight="0.2"> android:layout_height="5dp"
android:layout_alignParentBottom="true"
android:background="@color/colorA"/>
</RelativeLayout>
<ImageView <RelativeLayout
android:id="@+id/linphone_contacts" android:layout_width="0dp"
android:layout_width="match_parent" android:layout_height="match_parent"
android:layout_height="match_parent" android:layout_weight="0.2">
android:background="@drawable/toolbar_button"
android:contentDescription="@string/content_description_linphone_contacts"
android:gravity="center"
android:padding="15dp"
android:src="@drawable/contacts_sip"/>
<View <ImageView
android:id="@+id/linphone_contacts_select" android:id="@+id/linphone_contacts"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="5dp" android:layout_height="match_parent"
android:layout_alignParentBottom="true" android:background="@drawable/toolbar_button"
android:background="@color/colorA" android:contentDescription="@string/content_description_linphone_contacts"
android:visibility="gone"/> android:gravity="center"
</RelativeLayout> android:padding="15dp"
android:src="@drawable/contacts_sip"/>
<ImageView <View
android:id="@+id/next" android:id="@+id/linphone_contacts_select"
android:src="@drawable/chat_room_creation_next" android:layout_width="match_parent"
android:layout_width="0dp" android:layout_height="5dp"
android:layout_height="match_parent" android:layout_alignParentBottom="true"
android:layout_weight="0.2" android:background="@color/colorA"
android:background="@drawable/toolbar_button" android:visibility="gone"/>
android:contentDescription="@string/content_description_valid" </RelativeLayout>
android:padding="18dp"
android:layout_gravity="right"/>
</LinearLayout> <ImageView
android:id="@+id/next"
android:src="@drawable/chat_room_creation_next"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="0.2"
android:background="@drawable/toolbar_button"
android:contentDescription="@string/content_description_valid"
android:padding="18dp"
android:layout_gravity="right"/>
<RelativeLayout </LinearLayout>
android:id="@+id/layoutSearchField"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="10dp">
<EditText <RelativeLayout
android:id="@+id/searchField" android:id="@+id/layoutSearchField"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="40dp" android:layout_height="wrap_content"
android:background="@drawable/resizable_textfield" android:layout_margin="10dp">
android:hint="@string/chat_room_creation_filter_hint"
android:contentDescription="@string/content_description_search_contact"
android:gravity="center"
android:inputType="textPersonName"
android:paddingRight="5dp"
android:textColor="@android:color/black"
android:textCursorDrawable="@null"/>
<ImageView <EditText
android:id="@+id/clearSearchField" android:id="@+id/searchField"
android:layout_width="30dp" android:layout_width="match_parent"
android:layout_height="30dp" android:layout_height="40dp"
android:layout_alignParentRight="true" android:background="@drawable/resizable_textfield"
android:layout_centerVertical="true" android:hint="@string/chat_room_creation_filter_hint"
android:paddingLeft="5dp" android:contentDescription="@string/content_description_search_contact"
android:paddingRight="5dp" android:gravity="center"
android:src="@drawable/clean_field"/> android:inputType="textPersonName"
android:paddingRight="5dp"
android:textColor="@android:color/black"
android:textCursorDrawable="@null"/>
</RelativeLayout> <ImageView
android:id="@+id/clearSearchField"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:src="@drawable/clean_field"/>
<HorizontalScrollView </RelativeLayout>
android:id="@+id/layoutContactsSelected"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_marginTop="5dp"
android:background="@drawable/resizable_textfield"
android:lines="1"
android:fadeScrollbars="false">
<LinearLayout <HorizontalScrollView
android:id="@+id/contactsSelected" android:id="@+id/layoutContactsSelected"
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="50dp"
android:lines="1" android:layout_marginTop="5dp"
android:orientation="horizontal" android:background="@drawable/resizable_textfield"
android:paddingLeft="10dp" android:lines="1"
android:paddingRight="10dp" android:fadeScrollbars="false">
android:scrollIndicators="bottom"/>
</HorizontalScrollView>
<RelativeLayout <LinearLayout
android:layout_below="@+id/layoutContactsSelected" android:id="@+id/contactsSelected"
android:layout_width="match_parent" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:id="@+id/relativeLayout"> android:lines="1"
android:orientation="horizontal"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:scrollIndicators="bottom"/>
</HorizontalScrollView>
<ListView <RelativeLayout
android:id="@+id/contactsList" android:layout_below="@+id/layoutContactsSelected"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:divider="@color/colorE" android:id="@+id/relativeLayout">
android:dividerHeight="1dp"
android:fastScrollAlwaysVisible="true"
android:fastScrollEnabled="true"/>
<ProgressBar <ListView
android:id="@+id/contactsFetchInProgress" android:id="@+id/contactsList"
style="?android:attr/progressBarStyle" android:layout_width="match_parent"
android:layout_centerHorizontal="true" android:layout_height="match_parent"
android:layout_centerVertical="true" android:divider="@color/colorE"
android:visibility="gone" android:dividerHeight="1dp"
android:layout_width="wrap_content" android:fastScrollAlwaysVisible="true"
android:layout_height="wrap_content"/> android:fastScrollEnabled="true"/>
<TextView <ProgressBar
android:id="@+id/noSipContact" android:id="@+id/contactsFetchInProgress"
android:text="@string/no_sip_contact" style="?android:attr/progressBarStyle"
style="@style/font6" android:layout_centerHorizontal="true"
android:visibility="gone" android:layout_centerVertical="true"
android:layout_width="match_parent" android:visibility="gone"
android:layout_height="wrap_content" android:layout_width="wrap_content"
android:gravity="center" android:layout_height="wrap_content"/>
android:layout_centerVertical="true"/>
<TextView <TextView
android:id="@+id/noContact" android:id="@+id/noSipContact"
android:text="@string/no_contact" android:text="@string/no_sip_contact"
android:visibility="gone" style="@style/font6"
style="@style/font6" android:visibility="gone"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center" android:gravity="center"
android:layout_centerVertical="true"/> android:layout_centerVertical="true"/>
</RelativeLayout> <TextView
android:id="@+id/noContact"
android:text="@string/no_contact"
android:visibility="gone"
style="@style/font6"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_centerVertical="true"/>
</LinearLayout> </RelativeLayout>
</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 !");
} }