Switched back to use of canHandleParticipants instead of nbParticipants + added waiting view
This commit is contained in:
parent
2342c5bcec
commit
78811ad68f
5 changed files with 155 additions and 121 deletions
|
@ -1,131 +1,156 @@
|
||||||
<?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
|
||||||
android:id="@+id/top_bar"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:background="@color/colorF"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="60dp">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/back"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
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"/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:text="@string/chat_room_infos_title"
|
|
||||||
style="@style/font6"
|
|
||||||
android:ellipsize="end"
|
|
||||||
android:maxLines="1"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_weight="0.4"
|
|
||||||
android:gravity="center"/>
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/confirm"
|
|
||||||
android:src="@drawable/chat_room_creation_confirm"
|
|
||||||
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"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<RelativeLayout
|
|
||||||
android:id="@+id/layoutSubjectField"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_margin="10dp">
|
|
||||||
|
|
||||||
<EditText
|
|
||||||
android:id="@+id/subjectField"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="40dp"
|
|
||||||
android:background="@drawable/resizable_textfield"
|
|
||||||
android:contentDescription="@string/content_description_conversation_subject"
|
|
||||||
android:hint="@string/conversation_subject_hint"
|
|
||||||
android:gravity="center"
|
|
||||||
android:inputType="textEmailSubject"
|
|
||||||
android:paddingRight="5dp"
|
|
||||||
android:textColor="@android:color/black"
|
|
||||||
android:textCursorDrawable="@null"/>
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
<RelativeLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:background="@color/colorG"
|
|
||||||
android:paddingTop="8dp"
|
|
||||||
android:paddingBottom="8dp">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:gravity="center"
|
|
||||||
android:textStyle="bold"
|
|
||||||
android:textSize="15sp"
|
|
||||||
android:textColor="@color/colorB"
|
|
||||||
android:text="@string/chat_room_participants" />
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/addParticipants"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_alignParentRight="true"
|
|
||||||
android:layout_centerVertical="true"
|
|
||||||
android:paddingRight="10dp"
|
|
||||||
android:src="@drawable/chat_group_add"/>
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
<ListView
|
|
||||||
android:id="@+id/chat_room_participants"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_weight="1"
|
android:orientation="vertical"
|
||||||
android:divider="@color/colorE"
|
android:background="@color/colorH" >
|
||||||
android:dividerHeight="1dp">
|
|
||||||
|
|
||||||
</ListView>
|
<LinearLayout
|
||||||
|
android:id="@+id/top_bar"
|
||||||
|
android:orientation="horizontal"
|
||||||
|
android:background="@color/colorF"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="60dp">
|
||||||
|
|
||||||
<LinearLayout
|
<ImageView
|
||||||
android:id="@+id/leaveGroupLayout"
|
android:id="@+id/back"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="match_parent"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="left"
|
||||||
android:paddingTop="8dp"
|
android:layout_weight="0.2"
|
||||||
android:paddingBottom="8dp"
|
android:background="@drawable/toolbar_button"
|
||||||
android:layout_marginTop="10dp"
|
android:contentDescription="@string/content_description_back"
|
||||||
android:layout_marginBottom="10dp"
|
android:padding="18dp"
|
||||||
android:paddingLeft="20dp"
|
android:src="@drawable/back"/>
|
||||||
android:paddingRight="20dp"
|
|
||||||
android:background="@color/colorA">
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
android:text="@string/chat_room_infos_title"
|
||||||
|
style="@style/font6"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="0.4"
|
||||||
|
android:gravity="center"/>
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/confirm"
|
||||||
|
android:src="@drawable/chat_room_creation_confirm"
|
||||||
|
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"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/layoutSubjectField"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_margin="10dp">
|
||||||
|
|
||||||
|
<EditText
|
||||||
|
android:id="@+id/subjectField"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:background="@drawable/resizable_textfield"
|
||||||
|
android:contentDescription="@string/content_description_conversation_subject"
|
||||||
|
android:hint="@string/conversation_subject_hint"
|
||||||
|
android:gravity="center"
|
||||||
|
android:inputType="textEmailSubject"
|
||||||
|
android:paddingRight="5dp"
|
||||||
|
android:textColor="@android:color/black"
|
||||||
|
android:textCursorDrawable="@null"/>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:background="@color/colorG"
|
||||||
|
android:paddingTop="8dp"
|
||||||
|
android:paddingBottom="8dp">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:textStyle="bold"
|
||||||
|
android:textSize="15sp"
|
||||||
|
android:textColor="@color/colorB"
|
||||||
|
android:text="@string/chat_room_participants" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/addParticipants"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:paddingRight="10dp"
|
||||||
|
android:src="@drawable/chat_group_add"/>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
<ListView
|
||||||
|
android:id="@+id/chat_room_participants"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:divider="@color/colorE"
|
||||||
|
android:dividerHeight="1dp">
|
||||||
|
|
||||||
|
</ListView>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/leaveGroupLayout"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center"
|
android:layout_gravity="center"
|
||||||
android:textSize="15sp"
|
android:paddingTop="8dp"
|
||||||
android:textAllCaps="true"
|
android:paddingBottom="8dp"
|
||||||
android:textColor="@color/colorG"
|
android:layout_marginTop="10dp"
|
||||||
android:text="@string/chat_room_leave_group"/>
|
android:layout_marginBottom="10dp"
|
||||||
|
android:paddingLeft="20dp"
|
||||||
|
android:paddingRight="20dp"
|
||||||
|
android:background="@color/colorA">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:textSize="15sp"
|
||||||
|
android:textAllCaps="true"
|
||||||
|
android:textColor="@color/colorG"
|
||||||
|
android:text="@string/chat_room_leave_group"/>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</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>
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
<ProgressBar
|
<ProgressBar
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
android:indeterminateTint="@color/colorA"
|
||||||
android:layout_marginBottom="20dp"/>
|
android:layout_marginBottom="20dp"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
|
@ -449,7 +449,7 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
|
||||||
|
|
||||||
holder.displayName.setSelected(true); // For animation
|
holder.displayName.setSelected(true); // For animation
|
||||||
|
|
||||||
if (chatRoom.getNbParticipants() > 1) {
|
if (chatRoom.canHandleParticipants()) {
|
||||||
holder.displayName.setText(chatRoom.getSubject());
|
holder.displayName.setText(chatRoom.getSubject());
|
||||||
holder.contactPicture.setImageResource(R.drawable.chat_group_avatar);
|
holder.contactPicture.setImageResource(R.drawable.chat_group_avatar);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -68,6 +68,7 @@ import org.linphone.core.EventLog;
|
||||||
import org.linphone.core.Friend;
|
import org.linphone.core.Friend;
|
||||||
import org.linphone.core.FriendList;
|
import org.linphone.core.FriendList;
|
||||||
import org.linphone.core.Participant;
|
import org.linphone.core.Participant;
|
||||||
|
import org.linphone.mediastream.Log;
|
||||||
import org.linphone.receivers.ContactsUpdatedListener;
|
import org.linphone.receivers.ContactsUpdatedListener;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -373,7 +374,7 @@ public class GroupChatFragment extends Fragment implements ChatRoomListener, Con
|
||||||
|
|
||||||
private void getContactsForParticipants() {
|
private void getContactsForParticipants() {
|
||||||
mParticipants = new ArrayList<>();
|
mParticipants = new ArrayList<>();
|
||||||
if (mChatRoom.getNbParticipants() > 1) {
|
if (mChatRoom.canHandleParticipants()) {
|
||||||
int index = 0;
|
int index = 0;
|
||||||
StringBuilder participantsLabel = new StringBuilder();
|
StringBuilder participantsLabel = new StringBuilder();
|
||||||
for (Participant p : mChatRoom.getParticipants()) {
|
for (Participant p : mChatRoom.getParticipants()) {
|
||||||
|
@ -429,7 +430,7 @@ public class GroupChatFragment extends Fragment implements ChatRoomListener, Con
|
||||||
mBackToCallButton.setVisibility(View.VISIBLE);
|
mBackToCallButton.setVisibility(View.VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
mBackToCallButton.setVisibility(View.GONE);
|
mBackToCallButton.setVisibility(View.GONE);
|
||||||
if (mChatRoom.getNbParticipants() > 1) {
|
if (mChatRoom.canHandleParticipants()) {
|
||||||
mCallButton.setVisibility(View.GONE);
|
mCallButton.setVisibility(View.GONE);
|
||||||
mGroupInfosButton.setVisibility(View.VISIBLE);
|
mGroupInfosButton.setVisibility(View.VISIBLE);
|
||||||
mRoomLabel.setText(mChatRoom.getSubject());
|
mRoomLabel.setText(mChatRoom.getSubject());
|
||||||
|
@ -637,7 +638,7 @@ public class GroupChatFragment extends Fragment implements ChatRoomListener, Con
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onIsComposingReceived(ChatRoom cr, Address remoteAddr, boolean isComposing) {
|
public void onIsComposingReceived(ChatRoom cr, Address remoteAddr, boolean isComposing) {
|
||||||
if (cr.getNbParticipants() > 1) {
|
if (cr.canHandleParticipants()) {
|
||||||
ArrayList<String> composing = new ArrayList<>();
|
ArrayList<String> composing = new ArrayList<>();
|
||||||
for (Address a : cr.getComposingAddresses()) {
|
for (Address a : cr.getComposingAddresses()) {
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
|
|
|
@ -30,6 +30,7 @@ import android.widget.EditText;
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
|
import android.widget.RelativeLayout;
|
||||||
|
|
||||||
import org.linphone.LinphoneManager;
|
import org.linphone.LinphoneManager;
|
||||||
import org.linphone.R;
|
import org.linphone.R;
|
||||||
|
@ -48,6 +49,7 @@ public class GroupInfoFragment extends Fragment {
|
||||||
private LayoutInflater mInflater;
|
private LayoutInflater mInflater;
|
||||||
private ListView mParticipantsList;
|
private ListView mParticipantsList;
|
||||||
private LinearLayout mLeaveGroupButton;
|
private LinearLayout mLeaveGroupButton;
|
||||||
|
private RelativeLayout mWaitLayout;
|
||||||
private GroupInfoAdapter mAdapter;
|
private GroupInfoAdapter mAdapter;
|
||||||
private boolean mIsAlreadyCreatedGroup;
|
private boolean mIsAlreadyCreatedGroup;
|
||||||
private boolean mIsEditionEnabled;
|
private boolean mIsEditionEnabled;
|
||||||
|
@ -130,10 +132,12 @@ public class GroupInfoFragment extends Fragment {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
if (!mIsAlreadyCreatedGroup) {
|
if (!mIsAlreadyCreatedGroup) {
|
||||||
|
mWaitLayout.setVisibility(View.VISIBLE);
|
||||||
ChatRoom chatRoom = LinphoneManager.getLc().createClientGroupChatRoom(mSubjectField.getText().toString());
|
ChatRoom chatRoom = LinphoneManager.getLc().createClientGroupChatRoom(mSubjectField.getText().toString());
|
||||||
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) {
|
||||||
LinphoneActivity.instance().goToChat(cr.getConferenceAddress().asStringUriOnly());
|
LinphoneActivity.instance().goToChat(cr.getConferenceAddress().asStringUriOnly());
|
||||||
} else if (newState == ChatRoom.State.CreationFailed) {
|
} else if (newState == ChatRoom.State.CreationFailed) {
|
||||||
|
@ -163,6 +167,9 @@ public class GroupInfoFragment extends Fragment {
|
||||||
mAddParticipantsButton.setVisibility(View.GONE);
|
mAddParticipantsButton.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mWaitLayout = view.findViewById(R.id.waitScreen);
|
||||||
|
mWaitLayout.setVisibility(View.GONE);
|
||||||
|
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue