aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
authorChristian Schneppe <christian@pix-art.de>2019-01-25 21:41:28 +0100
committerChristian Schneppe <christian@pix-art.de>2019-01-25 21:41:28 +0100
commit2bca57e773d773c56bd9788be12759ad4976815a (patch)
tree78b9d51cdea8d9cb071e7de69e544e246ded1656 /src/main/java
parent3ca7e0c55a99e098c6035929b889829be3b352ef (diff)
fix display of deleted files
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/de/pixart/messenger/entities/Conversation.java8
-rw-r--r--src/main/java/de/pixart/messenger/entities/Message.java8
-rw-r--r--src/main/java/de/pixart/messenger/http/HttpDownloadConnection.java2
-rw-r--r--src/main/java/de/pixart/messenger/persistance/FileBackend.java2
-rw-r--r--src/main/java/de/pixart/messenger/services/NotificationService.java2
-rw-r--r--src/main/java/de/pixart/messenger/ui/ConversationFragment.java6
-rw-r--r--src/main/java/de/pixart/messenger/ui/adapter/ConversationAdapter.java2
-rw-r--r--src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java2
-rw-r--r--src/main/java/de/pixart/messenger/utils/UIHelper.java2
9 files changed, 17 insertions, 17 deletions
diff --git a/src/main/java/de/pixart/messenger/entities/Conversation.java b/src/main/java/de/pixart/messenger/entities/Conversation.java
index 8c8b22231..73e2786dc 100644
--- a/src/main/java/de/pixart/messenger/entities/Conversation.java
+++ b/src/main/java/de/pixart/messenger/entities/Conversation.java
@@ -212,7 +212,7 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
synchronized (this.messages) {
for (final Message m : this.messages) {
if (m.isFileOrImage() && m.getEncryption() != Message.ENCRYPTION_PGP) {
- if (m.getStatus() == Message.STATUS_SEND_FAILED && !m.isDeleted() && m.needsUploading()) {
+ if (m.getStatus() == Message.STATUS_SEND_FAILED && !m.isFileDeleted() && m.needsUploading()) {
results.add(m);
}
}
@@ -227,7 +227,7 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
final ArrayList<Message> results = new ArrayList<>();
synchronized (this.messages) {
for (final Message m : this.messages) {
- if (m.isDeleted()) {
+ if (m.isFileDeleted()) {
results.add(m);
}
}
@@ -255,7 +255,7 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
synchronized (this.messages) {
for(Message message : this.messages) {
if (uuids.contains(message.getUuid())) {
- message.setDeleted(true);
+ message.setFileDeleted(true);
deleted = true;
}
}
@@ -1117,7 +1117,7 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
for (int i = this.messages.size() - 1; i >= 0; --i) {
Message message = this.messages.get(i);
if ((message.getType() == Message.TYPE_IMAGE || message.getType() == Message.TYPE_FILE) && message.getEncryption() != Message.ENCRYPTION_PGP) {
- if (message.getStatus() == Message.STATUS_SEND_FAILED && !message.isDeleted() && message.needsUploading()){
+ if (message.getStatus() == Message.STATUS_SEND_FAILED && !message.isFileDeleted() && message.needsUploading()){
++count;
}
}
diff --git a/src/main/java/de/pixart/messenger/entities/Message.java b/src/main/java/de/pixart/messenger/entities/Message.java
index 8037a022a..c5843d840 100644
--- a/src/main/java/de/pixart/messenger/entities/Message.java
+++ b/src/main/java/de/pixart/messenger/entities/Message.java
@@ -396,12 +396,12 @@ public class Message extends AbstractEntity {
return this.deleted;
}
- public boolean isDeleted() {
- return this.deleted;
+ public boolean isFileDeleted() {
+ return this.file_deleted;
}
- public void setDeleted(boolean deleted) {
- this.deleted = deleted;
+ public void setFileDeleted(boolean file_deleted) {
+ this.file_deleted = file_deleted;
}
public void markRead() {
diff --git a/src/main/java/de/pixart/messenger/http/HttpDownloadConnection.java b/src/main/java/de/pixart/messenger/http/HttpDownloadConnection.java
index b625067e3..102a11626 100644
--- a/src/main/java/de/pixart/messenger/http/HttpDownloadConnection.java
+++ b/src/main/java/de/pixart/messenger/http/HttpDownloadConnection.java
@@ -139,7 +139,7 @@ public class HttpDownloadConnection implements Transferable {
mHttpConnectionManager.finishConnection(this);
message.setTransferable(null);
if (message.isFileOrImage()) {
- message.setDeleted(true);
+ message.setFileDeleted(true);
}
mHttpConnectionManager.updateConversationUi(true);
}
diff --git a/src/main/java/de/pixart/messenger/persistance/FileBackend.java b/src/main/java/de/pixart/messenger/persistance/FileBackend.java
index 1dca582b0..2a809f5bb 100644
--- a/src/main/java/de/pixart/messenger/persistance/FileBackend.java
+++ b/src/main/java/de/pixart/messenger/persistance/FileBackend.java
@@ -1050,7 +1050,7 @@ public class FileBackend {
body.append("|0|0|0|").append(getAPK(file, mXmppConnectionService.getApplicationContext()));
}
message.setBody(body.toString());
- message.setDeleted(false);
+ message.setFileDeleted(false);
}
public int getMediaRuntime(Uri uri) {
diff --git a/src/main/java/de/pixart/messenger/services/NotificationService.java b/src/main/java/de/pixart/messenger/services/NotificationService.java
index 7608976a5..dd40adf53 100644
--- a/src/main/java/de/pixart/messenger/services/NotificationService.java
+++ b/src/main/java/de/pixart/messenger/services/NotificationService.java
@@ -737,7 +737,7 @@ public class NotificationService {
private static boolean isImageMessage(Message message) {
return message.getType() != Message.TYPE_TEXT
&& message.getTransferable() == null
- && !message.isDeleted()
+ && !message.isFileDeleted()
&& message.getEncryption() != Message.ENCRYPTION_PGP
&& message.getFileParams().height > 0;
}
diff --git a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
index d09abc6f2..075692101 100644
--- a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
+++ b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
@@ -1277,7 +1277,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
return;
}
- final boolean deleted = m.isDeleted();
+ final boolean deleted = m.isFileDeleted();
final boolean encrypted = m.getEncryption() == Message.ENCRYPTION_DECRYPTION_FAILED
|| m.getEncryption() == Message.ENCRYPTION_PGP;
final boolean receiving = m.getStatus() == Message.STATUS_RECEIVED && (t instanceof JingleConnection || t instanceof HttpDownloadConnection);
@@ -1876,7 +1876,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
builder.setMessage(R.string.delete_file_dialog_msg);
builder.setPositiveButton(R.string.confirm, (dialog, which) -> {
if (activity.xmppConnectionService.getFileBackend().deleteFile(message)) {
- message.setDeleted(true);
+ message.setFileDeleted(true);
activity.xmppConnectionService.updateMessage(message, false);
activity.onConversationsListItemUpdated();
refresh();
@@ -1911,7 +1911,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
} else {
Toast.makeText(activity, R.string.file_deleted, Toast.LENGTH_SHORT).show();
//TODO check if we have storage permission
- message.setDeleted(true);
+ message.setFileDeleted(true);
activity.xmppConnectionService.updateMessage(message, false);
activity.onConversationsListItemUpdated();
refresh();
diff --git a/src/main/java/de/pixart/messenger/ui/adapter/ConversationAdapter.java b/src/main/java/de/pixart/messenger/ui/adapter/ConversationAdapter.java
index f2ae272f9..a60631523 100644
--- a/src/main/java/de/pixart/messenger/ui/adapter/ConversationAdapter.java
+++ b/src/main/java/de/pixart/messenger/ui/adapter/ConversationAdapter.java
@@ -139,7 +139,7 @@ public class ConversationAdapter extends RecyclerView.Adapter<ConversationAdapte
viewHolder.lastMessage.setTypeface(null, Typeface.NORMAL);
viewHolder.sender.setTypeface(null, Typeface.ITALIC);
} else {
- final boolean fileAvailable = !message.isDeleted();
+ final boolean fileAvailable = !message.isFileDeleted();
final boolean showPreviewText;
if (fileAvailable && (message.isFileOrImage() || message.treatAsDownloadable() || message.isGeoUri())) {
final int imageResource;
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 04373fb6c..e9ea940f1 100644
--- a/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java
+++ b/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java
@@ -962,7 +962,7 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
});
final Transferable transferable = message.getTransferable();
- if (message.isDeleted() || (transferable != null && transferable.getStatus() != Transferable.STATUS_UPLOADING)) {
+ if (message.isFileDeleted() || (transferable != null && transferable.getStatus() != Transferable.STATUS_UPLOADING)) {
if (transferable != null && transferable.getStatus() == Transferable.STATUS_OFFER) {
displayDownloadableMessage(viewHolder, message, activity.getString(R.string.download_x_file, UIHelper.getFileDescriptionString(activity, message)));
} else if (transferable != null && transferable.getStatus() == Transferable.STATUS_OFFER_CHECK_FILESIZE) {
diff --git a/src/main/java/de/pixart/messenger/utils/UIHelper.java b/src/main/java/de/pixart/messenger/utils/UIHelper.java
index 6ac5ae39d..d7a3ca2e0 100644
--- a/src/main/java/de/pixart/messenger/utils/UIHelper.java
+++ b/src/main/java/de/pixart/messenger/utils/UIHelper.java
@@ -276,7 +276,7 @@ public class UIHelper {
default:
return new Pair<>("", false);
}
- } else if (message.isFileOrImage() && message.isDeleted()) {
+ } else if (message.isFileOrImage() && message.isFileDeleted()) {
return new Pair<>(context.getString(R.string.file_deleted), true);
} else if (message.getEncryption() == Message.ENCRYPTION_PGP) {
return new Pair<>(context.getString(R.string.pgp_message), true);