mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 19:38:08 +00:00
Fix file sharing
This commit is contained in:
parent
b715605602
commit
5583484f3a
3 changed files with 36 additions and 34 deletions
|
|
@ -917,7 +917,8 @@ public class LinphoneManager implements CoreListener, SensorEventListener, Accou
|
|||
Log.i("[Doze Mode]: unregister");
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
try {
|
||||
mServiceContext.unregisterReceiver(mDozeReceiver);
|
||||
if(dozeModeEnabled)
|
||||
mServiceContext.unregisterReceiver(mDozeReceiver);
|
||||
} catch (IllegalArgumentException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -181,7 +181,6 @@ public class ChatEventsAdapter extends ListSelectionAdapter {
|
|||
|
||||
holder.eventLayout.setVisibility(View.GONE);
|
||||
holder.bubbleLayout.setVisibility(View.GONE);
|
||||
holder.separatorLayout.setVisibility(i == 0 ? View.GONE : View.VISIBLE); // Hide separator if first item in list
|
||||
holder.delete.setVisibility(isEditionEnabled() ? View.VISIBLE : View.GONE);
|
||||
holder.messageText.setVisibility(View.GONE);
|
||||
holder.messageImage.setVisibility(View.GONE);
|
||||
|
|
@ -211,13 +210,13 @@ public class ChatEventsAdapter extends ListSelectionAdapter {
|
|||
EventLog previousEvent = (EventLog)getItem(i-1);
|
||||
if (previousEvent.getType() == EventLog.Type.ConferenceChatMessage) {
|
||||
ChatMessage previousMessage = previousEvent.getChatMessage();
|
||||
if (previousMessage.getFromAddress().weakEqual(message.getFromAddress())) {
|
||||
/*if (previousMessage.getFromAddress().weakEqual(message.getFromAddress())) {
|
||||
holder.separatorLayout.setVisibility(View.GONE);
|
||||
}
|
||||
} else {
|
||||
}*/
|
||||
}/* else {
|
||||
// No separator if previous event is not a message
|
||||
holder.separatorLayout.setVisibility(View.GONE);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
holder.messageId = message.getMessageId();
|
||||
|
|
@ -281,7 +280,7 @@ public class ChatEventsAdapter extends ListSelectionAdapter {
|
|||
//Compatibility.setTextAppearance(holder.contactName, mContext, R.style.font3);
|
||||
holder.contactName.setVisibility(View.GONE);
|
||||
Compatibility.setTextAppearance(holder.fileTransferAction, mContext, R.style.font15);
|
||||
holder.fileTransferAction.setBackgroundResource(R.drawable.resizable_confirm_delete_button);
|
||||
//holder.fileTransferAction.setBackgroundResource(R.drawable.resizable_confirm_delete_button);
|
||||
holder.contactPictureMask.setImageResource(R.drawable.avatar_chat_mask_outgoing);
|
||||
} else {
|
||||
for (LinphoneContact c : mParticipants) {
|
||||
|
|
@ -303,7 +302,7 @@ public class ChatEventsAdapter extends ListSelectionAdapter {
|
|||
//Compatibility.setTextAppearance(holder.contactName, mContext, R.style.font9);
|
||||
holder.contactName.setVisibility(View.VISIBLE);
|
||||
Compatibility.setTextAppearance(holder.fileTransferAction, mContext, R.style.font8);
|
||||
holder.fileTransferAction.setBackgroundResource(R.drawable.resizable_assistant_button);
|
||||
//holder.fileTransferAction.setBackgroundResource(R.drawable.resizable_assistant_button);
|
||||
holder.contactPictureMask.setImageResource(R.drawable.avatar_chat_mask);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -685,35 +685,37 @@ public class GroupChatFragment extends Fragment implements ChatRoomListener, Con
|
|||
*/
|
||||
|
||||
private void sendMessage() {
|
||||
ChatMessage msg;
|
||||
String text = mMessageTextToSend.getText().toString();
|
||||
boolean textSend = false;
|
||||
String text = mMessageTextToSend.getText().toString();
|
||||
ChatMessage msg = null;
|
||||
|
||||
if (mFilesUploadLayout.getChildCount() > 0) {
|
||||
for (int i = 0 ; i < mFilesUploadLayout.getChildCount() ; i++) {
|
||||
String filePath = (String) mFilesUploadLayout.getChildAt(i).getTag();
|
||||
String fileName = filePath.substring(filePath.lastIndexOf("/") + 1);
|
||||
String extension = LinphoneUtils.getExtensionFromFileName(fileName);
|
||||
Content content = Factory.instance().createContent();
|
||||
if (LinphoneUtils.isExtensionImage(fileName)) {
|
||||
content.setType("image");
|
||||
} else {
|
||||
content.setType("file");
|
||||
}
|
||||
content.setSubtype(extension);
|
||||
content.setName(fileName);
|
||||
content.setFilePath(filePath);
|
||||
msg = mChatRoom.createFileTransferMessage(content);
|
||||
|
||||
if (!textSend && text != null && text.length() > 0) {
|
||||
msg.addTextContent(text);
|
||||
textSend = true;
|
||||
}
|
||||
// Set listener not required here anymore, message will be added to messages list and adapter will set the listener
|
||||
msg.send();
|
||||
for (int i = 0 ; i < mFilesUploadLayout.getChildCount() ; i++) {
|
||||
String filePath = (String) mFilesUploadLayout.getChildAt(i).getTag();
|
||||
String fileName = filePath.substring(filePath.lastIndexOf("/") + 1);
|
||||
String extension = LinphoneUtils.getExtensionFromFileName(fileName);
|
||||
Content content = Factory.instance().createContent();
|
||||
if (LinphoneUtils.isExtensionImage(fileName)) {
|
||||
content.setType("image");
|
||||
} else {
|
||||
content.setType("file");
|
||||
}
|
||||
} else {
|
||||
msg = mChatRoom.createMessage(text);
|
||||
content.setSubtype(extension);
|
||||
content.setName(fileName);
|
||||
content.setFilePath(filePath);
|
||||
|
||||
msg = mChatRoom.createEmptyMessage();
|
||||
msg.addFileContent(content);
|
||||
|
||||
if (text != null && text.length() > 0 && !textSend) {
|
||||
msg.addTextContent(text);
|
||||
textSend = true;
|
||||
}
|
||||
msg.send();
|
||||
msg = null;
|
||||
}
|
||||
|
||||
if (msg == null && text != null && text.length() > 0 && !textSend) {
|
||||
msg.addTextContent(text);
|
||||
// Set listener not required here anymore, message will be added to messages list and adapter will set the listener
|
||||
msg.send();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue