Switched back to use of canHandleParticipants instead of nbParticipants + added waiting view

This commit is contained in:
Sylvain Berfini 2017-10-30 10:57:14 +01:00
parent 2342c5bcec
commit 78811ad68f
5 changed files with 155 additions and 121 deletions

View file

@ -1,5 +1,9 @@
<?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
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
@ -128,4 +132,25 @@
</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>

View file

@ -8,6 +8,7 @@
<ProgressBar
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:indeterminateTint="@color/colorA"
android:layout_marginBottom="20dp"/>
</LinearLayout>

View file

@ -449,7 +449,7 @@ public class ChatListFragment extends Fragment implements OnClickListener, OnIte
holder.displayName.setSelected(true); // For animation
if (chatRoom.getNbParticipants() > 1) {
if (chatRoom.canHandleParticipants()) {
holder.displayName.setText(chatRoom.getSubject());
holder.contactPicture.setImageResource(R.drawable.chat_group_avatar);
} else {

View file

@ -68,6 +68,7 @@ import org.linphone.core.EventLog;
import org.linphone.core.Friend;
import org.linphone.core.FriendList;
import org.linphone.core.Participant;
import org.linphone.mediastream.Log;
import org.linphone.receivers.ContactsUpdatedListener;
import java.io.File;
@ -373,7 +374,7 @@ public class GroupChatFragment extends Fragment implements ChatRoomListener, Con
private void getContactsForParticipants() {
mParticipants = new ArrayList<>();
if (mChatRoom.getNbParticipants() > 1) {
if (mChatRoom.canHandleParticipants()) {
int index = 0;
StringBuilder participantsLabel = new StringBuilder();
for (Participant p : mChatRoom.getParticipants()) {
@ -429,7 +430,7 @@ public class GroupChatFragment extends Fragment implements ChatRoomListener, Con
mBackToCallButton.setVisibility(View.VISIBLE);
} else {
mBackToCallButton.setVisibility(View.GONE);
if (mChatRoom.getNbParticipants() > 1) {
if (mChatRoom.canHandleParticipants()) {
mCallButton.setVisibility(View.GONE);
mGroupInfosButton.setVisibility(View.VISIBLE);
mRoomLabel.setText(mChatRoom.getSubject());
@ -637,7 +638,7 @@ public class GroupChatFragment extends Fragment implements ChatRoomListener, Con
@Override
public void onIsComposingReceived(ChatRoom cr, Address remoteAddr, boolean isComposing) {
if (cr.getNbParticipants() > 1) {
if (cr.canHandleParticipants()) {
ArrayList<String> composing = new ArrayList<>();
for (Address a : cr.getComposingAddresses()) {
boolean found = false;

View file

@ -30,6 +30,7 @@ import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.RelativeLayout;
import org.linphone.LinphoneManager;
import org.linphone.R;
@ -48,6 +49,7 @@ public class GroupInfoFragment extends Fragment {
private LayoutInflater mInflater;
private ListView mParticipantsList;
private LinearLayout mLeaveGroupButton;
private RelativeLayout mWaitLayout;
private GroupInfoAdapter mAdapter;
private boolean mIsAlreadyCreatedGroup;
private boolean mIsEditionEnabled;
@ -130,10 +132,12 @@ public class GroupInfoFragment extends Fragment {
@Override
public void onClick(View view) {
if (!mIsAlreadyCreatedGroup) {
mWaitLayout.setVisibility(View.VISIBLE);
ChatRoom chatRoom = LinphoneManager.getLc().createClientGroupChatRoom(mSubjectField.getText().toString());
chatRoom.setListener(new ChatRoomListenerStub() {
@Override
public void onStateChanged(ChatRoom cr, ChatRoom.State newState) {
mWaitLayout.setVisibility(View.GONE);
if (newState == ChatRoom.State.Created) {
LinphoneActivity.instance().goToChat(cr.getConferenceAddress().asStringUriOnly());
} else if (newState == ChatRoom.State.CreationFailed) {
@ -163,6 +167,9 @@ public class GroupInfoFragment extends Fragment {
mAddParticipantsButton.setVisibility(View.GONE);
}
mWaitLayout = view.findViewById(R.id.waitScreen);
mWaitLayout.setVisibility(View.GONE);
return view;
}
}