UI fixes & improvements
This commit is contained in:
parent
9473655068
commit
b4acb1b794
3 changed files with 26 additions and 57 deletions
|
@ -136,16 +136,17 @@ public final class LinphoneUtils {
|
|||
return getAddressDisplayName(lAddress);
|
||||
}
|
||||
|
||||
public static String getAddressDisplayName(Address address){
|
||||
if(address.getDisplayName() != null) {
|
||||
return address.getDisplayName();
|
||||
} else {
|
||||
if(address.getUsername() != null){
|
||||
return address.getUsername();
|
||||
} else {
|
||||
return address.asStringUriOnly();
|
||||
public static String getAddressDisplayName(Address address) {
|
||||
if (address == null) return null;
|
||||
|
||||
String displayName = address.getDisplayName();
|
||||
if (displayName == null || displayName.isEmpty()) {
|
||||
displayName = address.getUsername();
|
||||
}
|
||||
if (displayName == null || displayName.isEmpty()) {
|
||||
displayName = address.asStringUriOnly();
|
||||
}
|
||||
return displayName;
|
||||
}
|
||||
|
||||
public static String getUsernameFromAddress(String address) {
|
||||
|
|
|
@ -157,10 +157,7 @@ public class ChatEventsAdapter extends BaseAdapter implements ChatMessageListene
|
|||
String displayName;
|
||||
|
||||
if (message.isOutgoing()) {
|
||||
displayName = remoteSender.getDisplayName();
|
||||
if (displayName == null || displayName.isEmpty()) {
|
||||
displayName = remoteSender.getUsername();
|
||||
}
|
||||
displayName = LinphoneUtils.getAddressDisplayName(remoteSender);
|
||||
|
||||
if (status == ChatMessage.State.InProgress) {
|
||||
holder.messageSendingInProgress.setVisibility(View.VISIBLE);
|
||||
|
@ -207,10 +204,7 @@ public class ChatEventsAdapter extends BaseAdapter implements ChatMessageListene
|
|||
if (contact.getFullName() != null) {
|
||||
displayName = contact.getFullName();
|
||||
} else {
|
||||
displayName = remoteSender.getDisplayName();
|
||||
if (displayName == null || displayName.isEmpty()) {
|
||||
displayName = remoteSender.getUsername();
|
||||
}
|
||||
displayName = LinphoneUtils.getAddressDisplayName(remoteSender);
|
||||
}
|
||||
|
||||
holder.contactPicture.setImageBitmap(ContactsManager.getInstance().getDefaultAvatarBitmap());
|
||||
|
@ -218,11 +212,7 @@ public class ChatEventsAdapter extends BaseAdapter implements ChatMessageListene
|
|||
LinphoneUtils.setThumbnailPictureFromUri(LinphoneActivity.instance(), holder.contactPicture, contact.getThumbnailUri());
|
||||
}
|
||||
} else {
|
||||
displayName = remoteSender.getDisplayName();
|
||||
if (displayName == null || displayName.isEmpty()) {
|
||||
displayName = remoteSender.getUsername();
|
||||
}
|
||||
|
||||
displayName = LinphoneUtils.getAddressDisplayName(remoteSender);
|
||||
holder.contactPicture.setImageBitmap(ContactsManager.getInstance().getDefaultAvatarBitmap());
|
||||
}
|
||||
|
||||
|
@ -312,14 +302,10 @@ public class ChatEventsAdapter extends BaseAdapter implements ChatMessageListene
|
|||
if (contact != null) {
|
||||
displayName = contact.getFullName();
|
||||
} else {
|
||||
displayName = address.getDisplayName();
|
||||
if (displayName == null || displayName.isEmpty()) {
|
||||
displayName = address.getUsername();
|
||||
}
|
||||
displayName = LinphoneUtils.getAddressDisplayName(address);
|
||||
}
|
||||
}
|
||||
|
||||
//TODO
|
||||
switch (event.getType()) {
|
||||
case ConferenceCreated:
|
||||
holder.eventMessage.setText(mContext.getString(R.string.conference_created));
|
||||
|
|
|
@ -146,13 +146,9 @@ public class GroupChatFragment extends Fragment implements ChatRoomListener, Con
|
|||
LinphoneContact c = ContactsManager.getInstance().findContactFromAddress(a);
|
||||
if (c == null) {
|
||||
c = new LinphoneContact();
|
||||
String displayName = a.getDisplayName();
|
||||
if (displayName == null || displayName.isEmpty()) {
|
||||
c.setFullName(a.getUsername());
|
||||
} else {
|
||||
String displayName = LinphoneUtils.getAddressDisplayName(a);
|
||||
c.setFullName(displayName);
|
||||
}
|
||||
}
|
||||
ContactAddress ca = new ContactAddress(c, a.asString(), c.isFriend());
|
||||
participants.add(ca);
|
||||
}
|
||||
|
@ -307,7 +303,6 @@ public class GroupChatFragment extends Fragment implements ChatRoomListener, Con
|
|||
} else if (fileToUploadPath.contains("com.android.contacts/contacts/")) {
|
||||
fileToUploadPath = getCVSPathFromLookupUri(fileToUploadPath).toString();
|
||||
}
|
||||
Log.e("FILE PATH IS " + fileToUploadPath);
|
||||
addFileToPendingList(fileToUploadPath);
|
||||
}
|
||||
} else {
|
||||
|
@ -389,16 +384,13 @@ public class GroupChatFragment extends Fragment implements ChatRoomListener, Con
|
|||
mParticipants.add(c);
|
||||
participantsLabel.append(c.getFullName());
|
||||
} else {
|
||||
String displayName = p.getAddress().getDisplayName();
|
||||
if (displayName != null && !displayName.isEmpty()) {
|
||||
String displayName = LinphoneUtils.getAddressDisplayName(p.getAddress());
|
||||
participantsLabel.append(displayName);
|
||||
} else {
|
||||
participantsLabel.append(p.getAddress().getUsername());
|
||||
}
|
||||
}
|
||||
index++;
|
||||
if (index != mChatRoom.getNbParticipants()) participantsLabel.append(";");
|
||||
if (index != mChatRoom.getNbParticipants()) participantsLabel.append(", ");
|
||||
}
|
||||
mParticipantsLabel.setText(participantsLabel.toString());
|
||||
} else {
|
||||
LinphoneContact c = ContactsManager.getInstance().findContactFromAddress(mRemoteSipAddress);
|
||||
if (c != null) {
|
||||
|
@ -441,6 +433,7 @@ public class GroupChatFragment extends Fragment implements ChatRoomListener, Con
|
|||
mGroupInfosButton.setVisibility(View.VISIBLE);
|
||||
mRoomLabel.setText(mChatRoom.getSubject());
|
||||
mParticipantsLabel.setVisibility(View.VISIBLE);
|
||||
|
||||
} else {
|
||||
mCallButton.setVisibility(View.VISIBLE);
|
||||
mGroupInfosButton.setVisibility(View.GONE);
|
||||
|
@ -448,12 +441,8 @@ public class GroupChatFragment extends Fragment implements ChatRoomListener, Con
|
|||
|
||||
if (mParticipants.size() == 0) {
|
||||
// Contact not found
|
||||
String displayName = mRemoteSipAddress.getDisplayName();
|
||||
if (displayName == null || displayName.isEmpty()) {
|
||||
mRoomLabel.setText(mRemoteSipAddress.getUsername());
|
||||
} else {
|
||||
String displayName = LinphoneUtils.getAddressDisplayName(mRemoteSipAddress);
|
||||
mRoomLabel.setText(displayName);
|
||||
}
|
||||
} else {
|
||||
mRoomLabel.setText(mParticipants.get(0).getFullName());
|
||||
}
|
||||
|
@ -699,12 +688,8 @@ public class GroupChatFragment extends Fragment implements ChatRoomListener, Con
|
|||
}
|
||||
}
|
||||
if (!found) {
|
||||
String displayName = a.getDisplayName();
|
||||
if (displayName != null && !displayName.isEmpty()) {
|
||||
String displayName = LinphoneUtils.getAddressDisplayName(a);
|
||||
composing.add(displayName);
|
||||
} else {
|
||||
composing.add(a.getUsername());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -732,10 +717,7 @@ public class GroupChatFragment extends Fragment implements ChatRoomListener, Con
|
|||
if (mParticipants.size() > 0) {
|
||||
displayName = mParticipants.get(0).getFullName();
|
||||
} else {
|
||||
displayName = remoteAddr.getDisplayName();
|
||||
if (displayName == null || displayName.isEmpty()) {
|
||||
displayName = remoteAddr.getUsername();
|
||||
}
|
||||
displayName = LinphoneUtils.getAddressDisplayName(remoteAddr);
|
||||
}
|
||||
mRemoteComposing.setText(getString(R.string.remote_composing_single).replace("%s", displayName));
|
||||
mRemoteComposing.setVisibility(View.VISIBLE);
|
||||
|
|
Loading…
Reference in a new issue