aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations/ui/adapter
diff options
context:
space:
mode:
authorChristian S <christian@pix-art.de>2015-07-14 09:13:08 +0200
committerChristian S <christian@pix-art.de>2015-07-14 09:13:08 +0200
commit169b4ba97f576cb2cbd8477ea0d3d6ed40276658 (patch)
tree74a60f38a1b170962a04fdceaa7e3726b766c291 /src/main/java/eu/siacs/conversations/ui/adapter
parentc0016b6fa7b778700c21e15baff58b03b1b1f8d6 (diff)
parentffffca10f0c3e399fbbcde200ea4758acc5ba03f (diff)
Merge branch 'development' of https://github.com/siacs/Conversations into siacs-development
Diffstat (limited to 'src/main/java/eu/siacs/conversations/ui/adapter')
-rw-r--r--src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java6
-rw-r--r--src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java28
2 files changed, 18 insertions, 16 deletions
diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java
index 5cbc73ecd..bfe44326e 100644
--- a/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java
+++ b/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java
@@ -21,7 +21,7 @@ import java.util.concurrent.RejectedExecutionException;
import eu.siacs.conversations.R;
import eu.siacs.conversations.entities.Conversation;
-import eu.siacs.conversations.entities.Downloadable;
+import eu.siacs.conversations.entities.Transferable;
import eu.siacs.conversations.entities.Message;
import eu.siacs.conversations.ui.ConversationActivity;
import eu.siacs.conversations.ui.XmppActivity;
@@ -69,8 +69,8 @@ public class ConversationAdapter extends ArrayAdapter<Conversation> {
}
if (message.getFileParams().width > 0
- && (message.getDownloadable() == null
- || message.getDownloadable().getStatus() != Downloadable.STATUS_DELETED)) {
+ && (message.getTransferable() == null
+ || message.getTransferable().getStatus() != Transferable.STATUS_DELETED)) {
mLastMessage.setVisibility(View.GONE);
imagePreview.setVisibility(View.VISIBLE);
activity.loadBitmap(message, imagePreview);
diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java
index 2337c66b8..112818362 100644
--- a/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java
+++ b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java
@@ -29,7 +29,7 @@ import eu.siacs.conversations.R;
import eu.siacs.conversations.entities.Account;
import eu.siacs.conversations.entities.Contact;
import eu.siacs.conversations.entities.Conversation;
-import eu.siacs.conversations.entities.Downloadable;
+import eu.siacs.conversations.entities.Transferable;
import eu.siacs.conversations.entities.DownloadableFile;
import eu.siacs.conversations.entities.Message;
import eu.siacs.conversations.entities.Message.FileParams;
@@ -99,14 +99,14 @@ public class MessageAdapter extends ArrayAdapter<Message> {
}
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.getDownloadable() != null) {
+ if (message.getType() == Message.TYPE_IMAGE || message.getType() == Message.TYPE_FILE || message.getTransferable() != null) {
FileParams params = message.getFileParams();
if (params.size > (1.5 * 1024 * 1024)) {
filesize = params.size / (1024 * 1024)+ " MiB";
} else if (params.size > 0) {
filesize = params.size / 1024 + " KiB";
}
- if (message.getDownloadable() != null && message.getDownloadable().getStatus() == Downloadable.STATUS_FAILED) {
+ if (message.getTransferable() != null && message.getTransferable().getStatus() == Transferable.STATUS_FAILED) {
error = true;
}
}
@@ -115,7 +115,7 @@ public class MessageAdapter extends ArrayAdapter<Message> {
info = getContext().getString(R.string.waiting);
break;
case Message.STATUS_UNSEND:
- Downloadable d = message.getDownloadable();
+ Transferable d = message.getTransferable();
if (d!=null) {
info = getContext().getString(R.string.sending_file,d.getProgress());
} else {
@@ -160,7 +160,7 @@ public class MessageAdapter extends ArrayAdapter<Message> {
message.getMergedTimeSent());
if (message.getStatus() <= Message.STATUS_RECEIVED) {
if ((filesize != null) && (info != null)) {
- viewHolder.time.setText(filesize + " \u00B7 " + info);
+ viewHolder.time.setText(formatedTime + " \u00B7 " + filesize +" \u00B7 " + info);
} else if ((filesize == null) && (info != null)) {
viewHolder.time.setText(formatedTime + " \u00B7 " + info);
} else if ((filesize != null) && (info == null)) {
@@ -482,11 +482,11 @@ public class MessageAdapter extends ArrayAdapter<Message> {
}
});
- final Downloadable downloadable = message.getDownloadable();
- if (downloadable != null && downloadable.getStatus() != Downloadable.STATUS_UPLOADING) {
- if (downloadable.getStatus() == Downloadable.STATUS_OFFER) {
+ final Transferable transferable = message.getTransferable();
+ if (transferable != null && transferable.getStatus() != Transferable.STATUS_UPLOADING) {
+ if (transferable.getStatus() == Transferable.STATUS_OFFER) {
displayDownloadableMessage(viewHolder,message,activity.getString(R.string.download_x_file, UIHelper.getFileDescriptionString(activity, message)));
- } else if (downloadable.getStatus() == Downloadable.STATUS_OFFER_CHECK_FILESIZE) {
+ } else if (transferable.getStatus() == Transferable.STATUS_OFFER_CHECK_FILESIZE) {
displayDownloadableMessage(viewHolder, message, activity.getString(R.string.check_x_filesize, UIHelper.getFileDescriptionString(activity, message)));
} else {
displayInfoMessage(viewHolder, UIHelper.getMessagePreview(activity, message).first);
@@ -536,12 +536,14 @@ public class MessageAdapter extends ArrayAdapter<Message> {
}
public void startDownloadable(Message message) {
- Downloadable downloadable = message.getDownloadable();
- if (downloadable != null) {
- if (!downloadable.start()) {
+ Transferable transferable = message.getTransferable();
+ if (transferable != null) {
+ if (!transferable.start()) {
Toast.makeText(activity, R.string.not_connected_try_again,
Toast.LENGTH_SHORT).show();
}
+ } else if (message.treatAsDownloadable() != Message.Decision.NEVER) {
+ activity.xmppConnectionService.getHttpConnectionManager().createNewDownloadConnection(message);
}
}
@@ -592,4 +594,4 @@ public class MessageAdapter extends ArrayAdapter<Message> {
protected ImageView contact_picture;
protected TextView status_message;
}
-} \ No newline at end of file
+}