Display both text and file transfer in same bubble and send text with file transfer if exists
This commit is contained in:
parent
08926bc996
commit
6bcdcab8b4
2 changed files with 11 additions and 7 deletions
|
@ -296,8 +296,13 @@ public class ChatEventsAdapter extends BaseAdapter implements ChatMessageListene
|
||||||
}
|
}
|
||||||
holder.contactName.setText(LinphoneUtils.timestampToHumanDate(mContext, message.getTime(), R.string.messages_date_format) + " - " + displayName);
|
holder.contactName.setText(LinphoneUtils.timestampToHumanDate(mContext, message.getTime(), R.string.messages_date_format) + " - " + displayName);
|
||||||
|
|
||||||
Spanned text = null;
|
if (message.hasTextContent()) {
|
||||||
String msg = message.getText();
|
String msg = message.getTextContent();
|
||||||
|
Spanned text = LinphoneUtils.getTextWithHttpLinks(msg);
|
||||||
|
holder.messageText.setText(text);
|
||||||
|
holder.messageText.setMovementMethod(LinkMovementMethod.getInstance());
|
||||||
|
holder.messageText.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
String externalBodyUrl = message.getExternalBodyUrl();
|
String externalBodyUrl = message.getExternalBodyUrl();
|
||||||
Content fileTransferContent = message.getFileTransferInformation();
|
Content fileTransferContent = message.getFileTransferInformation();
|
||||||
|
@ -348,11 +353,6 @@ public class ChatEventsAdapter extends BaseAdapter implements ChatMessageListene
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else if (msg != null) { // This is a else for now, the day we'll be able to send both file and text this won't be anymore
|
|
||||||
text = LinphoneUtils.getTextWithHttpLinks(msg);
|
|
||||||
holder.messageText.setText(text);
|
|
||||||
holder.messageText.setMovementMethod(LinkMovementMethod.getInstance());
|
|
||||||
holder.messageText.setVisibility(View.VISIBLE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
holder.bubbleLayout.setLayoutParams(layoutParams);
|
holder.bubbleLayout.setLayoutParams(layoutParams);
|
||||||
|
|
|
@ -601,6 +601,10 @@ public class GroupChatFragment extends Fragment implements ChatRoomListener, Con
|
||||||
msg = mChatRoom.createFileTransferMessage(content);
|
msg = mChatRoom.createFileTransferMessage(content);
|
||||||
msg.setFileTransferFilepath(filePath); // Let the file body handler take care of the upload
|
msg.setFileTransferFilepath(filePath); // Let the file body handler take care of the upload
|
||||||
msg.setAppdata(filePath);
|
msg.setAppdata(filePath);
|
||||||
|
|
||||||
|
if (text != null && text.length() > 0) {
|
||||||
|
msg.addTextContent(text);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
msg = mChatRoom.createMessage(text);
|
msg = mChatRoom.createMessage(text);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue