fixed some rare crashes caused by race conditions
This commit is contained in:
parent
30d5c08c35
commit
5c920a9362
|
@ -1773,7 +1773,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
|
||||||
if (scrollState != null) {
|
if (scrollState != null) {
|
||||||
outState.putParcelable(STATE_SCROLL_POSITION, scrollState);
|
outState.putParcelable(STATE_SCROLL_POSITION, scrollState);
|
||||||
}
|
}
|
||||||
final ArrayList<Attachment> attachments = mediaPreviewAdapter.getAttachments();
|
final ArrayList<Attachment> attachments = mediaPreviewAdapter == null ? new ArrayList<>() : mediaPreviewAdapter.getAttachments();
|
||||||
if (attachments.size() > 0) {
|
if (attachments.size() > 0) {
|
||||||
outState.putParcelableArrayList(STATE_MEDIA_PREVIEWS, attachments);
|
outState.putParcelableArrayList(STATE_MEDIA_PREVIEWS, attachments);
|
||||||
}
|
}
|
||||||
|
|
|
@ -214,9 +214,10 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
|
||||||
viewHolder.edit_indicator.setVisibility(View.GONE);
|
viewHolder.edit_indicator.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
final Transferable transferable = message.getTransferable();
|
||||||
boolean multiReceived = message.getConversation().getMode() == Conversation.MODE_MULTI
|
boolean multiReceived = message.getConversation().getMode() == Conversation.MODE_MULTI
|
||||||
&& message.getMergedStatus() <= Message.STATUS_RECEIVED;
|
&& message.getMergedStatus() <= Message.STATUS_RECEIVED;
|
||||||
if (message.getType() == Message.TYPE_IMAGE || message.getType() == Message.TYPE_FILE || message.getTransferable() != null) {
|
if (message.getType() == Message.TYPE_IMAGE || message.getType() == Message.TYPE_FILE || transferable != null) {
|
||||||
FileParams params = message.getFileParams();
|
FileParams params = message.getFileParams();
|
||||||
if (params.size > (1.5 * 1024 * 1024)) {
|
if (params.size > (1.5 * 1024 * 1024)) {
|
||||||
filesize = Math.round(params.size * 1f / (1024 * 1024)) + " MiB";
|
filesize = Math.round(params.size * 1f / (1024 * 1024)) + " MiB";
|
||||||
|
@ -225,7 +226,7 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
|
||||||
} else if (params.size > 0) {
|
} else if (params.size > 0) {
|
||||||
filesize = params.size + " B";
|
filesize = params.size + " B";
|
||||||
}
|
}
|
||||||
if (message.getTransferable() != null && message.getTransferable().getStatus() == Transferable.STATUS_FAILED) {
|
if (transferable != null && transferable.getStatus() == Transferable.STATUS_FAILED) {
|
||||||
error = true;
|
error = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -234,9 +235,8 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
|
||||||
info = getContext().getString(R.string.waiting);
|
info = getContext().getString(R.string.waiting);
|
||||||
break;
|
break;
|
||||||
case Message.STATUS_UNSEND:
|
case Message.STATUS_UNSEND:
|
||||||
Transferable d = message.getTransferable();
|
if (transferable != null) {
|
||||||
if (d != null) {
|
info = getContext().getString(R.string.sending_file, transferable.getProgress());
|
||||||
info = getContext().getString(R.string.sending_file, d.getProgress());
|
|
||||||
} else {
|
} else {
|
||||||
info = getContext().getString(R.string.sending);
|
info = getContext().getString(R.string.sending);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue