aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/ui/adapter
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2018-12-27 20:39:14 +0100
committerChristian Schneppe <christian@pix-art.de>2018-12-27 20:39:14 +0100
commit7a3e2db6c90ffd7a5fa1b5e91d84df2e7367fa6d (patch)
tree51580cfe051a9311c3bb8037e62af02e6b746088 /src/main/java/de/pixart/messenger/ui/adapter
parent9e10915d8b546a0eb7482401364c91a58ce57a3d (diff)
fixed some rare crashes caused by race conditions
Diffstat (limited to 'src/main/java/de/pixart/messenger/ui/adapter')
-rw-r--r--src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java b/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java
index 95ccda7d2..fd9074771 100644
--- a/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java
+++ b/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java
@@ -237,9 +237,10 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
viewHolder.edit_indicator.setVisibility(View.GONE);
}
}
+ final Transferable transferable = message.getTransferable();
boolean multiReceived = message.getConversation().getMode() == Conversation.MODE_MULTI
&& 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();
if (params.size > (1 * 1024 * 1024)) {
filesize = Math.round(params.size * 1f / (1024 * 1024)) + " MiB";
@@ -248,7 +249,7 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
} else if (params.size > 0){
filesize = params.size + " B";
}
- if (message.getTransferable() != null && message.getTransferable().getStatus() == Transferable.STATUS_FAILED) {
+ if (transferable != null && transferable.getStatus() == Transferable.STATUS_FAILED) {
error = true;
}
}
@@ -257,9 +258,8 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
info = getContext().getString(R.string.waiting);
break;
case Message.STATUS_UNSEND:
- Transferable d = message.getTransferable();
- if (d != null) {
- info = getContext().getString(R.string.sending_file, d.getProgress());
+ if (transferable != null) {
+ info = getContext().getString(R.string.sending_file, transferable.getProgress());
} else {
info = getContext().getString(R.string.sending);
}