Fixed multiple composing in UI
This commit is contained in:
parent
a099768150
commit
37de3507f4
1 changed files with 27 additions and 43 deletions
|
@ -618,20 +618,6 @@ 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.canHandleParticipants() || (cr.getNbParticipants() == 1 && getString(R.string.dummy_group_chat_subject).equals(cr.getSubject()))) {
|
|
||||||
if (isComposing) {
|
|
||||||
String displayName;
|
|
||||||
if (mParticipants.size() > 0) {
|
|
||||||
displayName = mParticipants.get(0).getFullName();
|
|
||||||
} else {
|
|
||||||
displayName = LinphoneUtils.getAddressDisplayName(remoteAddr);
|
|
||||||
}
|
|
||||||
mRemoteComposing.setText(getString(R.string.remote_composing_single).replace("%s", displayName));
|
|
||||||
mRemoteComposing.setVisibility(View.VISIBLE);
|
|
||||||
} else {
|
|
||||||
mRemoteComposing.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
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;
|
||||||
|
@ -648,10 +634,12 @@ public class GroupChatFragment extends Fragment implements ChatRoomListener, Con
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (composing.size() == 1) {
|
|
||||||
mRemoteComposing.setText(getString(R.string.remote_composing_single).replace("%s", composing.get(0)));
|
|
||||||
mRemoteComposing.setVisibility(View.VISIBLE);
|
mRemoteComposing.setVisibility(View.VISIBLE);
|
||||||
} else if (composing.size() > 2) {
|
if (composing.size() == 0) {
|
||||||
|
mRemoteComposing.setVisibility(View.GONE);
|
||||||
|
} else if (composing.size() == 1) {
|
||||||
|
mRemoteComposing.setText(getString(R.string.remote_composing_single).replace("%s", composing.get(0)));
|
||||||
|
} else {
|
||||||
StringBuilder remotes = new StringBuilder();
|
StringBuilder remotes = new StringBuilder();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for (String remote : composing) {
|
for (String remote : composing) {
|
||||||
|
@ -662,10 +650,6 @@ public class GroupChatFragment extends Fragment implements ChatRoomListener, Con
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mRemoteComposing.setText(getString(R.string.remote_composing_multiple).replace("%s", remotes.toString()));
|
mRemoteComposing.setText(getString(R.string.remote_composing_multiple).replace("%s", remotes.toString()));
|
||||||
mRemoteComposing.setVisibility(View.VISIBLE);
|
|
||||||
} else {
|
|
||||||
mRemoteComposing.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue