Show via identity, allow deleting outbound messages when identity is disabled

This commit is contained in:
M66B
2019-02-03 13:27:30 +00:00
parent 9da45704e0
commit 4311cbdce5
6 changed files with 78 additions and 7 deletions

View File

@@ -88,6 +88,7 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.text.Collator;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
@@ -195,6 +196,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
private TextView tvReplyTo;
private TextView tvCc;
private TextView tvBcc;
private TextView tvIdentity;
private TextView tvTimeEx;
private TextView tvSizeEx;
private TextView tvSubjectEx;
@@ -267,6 +269,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
tvReplyTo = itemView.findViewById(R.id.tvReplyTo);
tvCc = itemView.findViewById(R.id.tvCc);
tvBcc = itemView.findViewById(R.id.tvBcc);
tvIdentity = itemView.findViewById(R.id.tvIdentity);
tvTimeEx = itemView.findViewById(R.id.tvTimeEx);
tvSizeEx = itemView.findViewById(R.id.tvSizeEx);
tvSubjectEx = itemView.findViewById(R.id.tvSubjectEx);
@@ -737,6 +740,13 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
tvCc.setText(MessageHelper.formatAddresses(message.cc));
tvBcc.setText(MessageHelper.formatAddresses(message.bcc));
try {
InternetAddress via = new InternetAddress(message.identityEmail, message.identityName);
tvIdentity.setText(via.toString());
} catch (UnsupportedEncodingException ex) {
tvIdentity.setText(ex.getMessage());
}
tvTimeEx.setText(dtf.format(message.received));
tvSizeEx.setText(message.size == null ? null : Helper.humanReadableByteCount(message.size, true));
@@ -887,7 +897,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
bnvActions.getMenu().findItem(R.id.action_delete).setVisible(
(inTrash && message.msgid != null) ||
(!inTrash && hasTrash && message.uid != null) ||
(inOutbox && !TextUtils.isEmpty(message.error)));
(inOutbox && (!TextUtils.isEmpty(message.error) || !message.identitySynchronize)));
bnvActions.getMenu().findItem(R.id.action_delete).setTitle(inTrash ? R.string.title_delete : R.string.title_trash);
bnvActions.getMenu().findItem(R.id.action_move).setVisible(

View File

@@ -49,6 +49,7 @@ public interface DaoMessage {
@Query("SELECT message.*" +
", account.name AS accountName, IFNULL(identity.color, account.color) AS accountColor, account.notify AS accountNotify" +
", folder.name AS folderName, folder.display AS folderDisplay, folder.type AS folderType" +
", identity.name AS identityName, identity.email AS identityEmail, identity.synchronize AS identitySynchronize" +
", COUNT(message.id) AS count" +
", " + unseen_unified + " AS unseen" +
", " + unflagged_unified + " AS unflagged" +
@@ -88,6 +89,7 @@ public interface DaoMessage {
@Query("SELECT message.*" +
", account.name AS accountName, IFNULL(identity.color, account.color) AS accountColor, account.notify AS accountNotify" +
", folder.name AS folderName, folder.display AS folderDisplay, folder.type AS folderType" +
", identity.name AS identityName, identity.email AS identityEmail, identity.synchronize AS identitySynchronize" +
", COUNT(message.id) AS count" +
", " + unseen_folder + " AS unseen" +
", " + unflagged_folder + " AS unflagged" +
@@ -119,6 +121,7 @@ public interface DaoMessage {
@Query("SELECT message.*" +
", account.name AS accountName, IFNULL(identity.color, account.color) AS accountColor, account.notify AS accountNotify" +
", folder.name AS folderName, folder.display AS folderDisplay, folder.type AS folderType" +
", identity.name AS identityName, identity.email AS identityEmail, identity.synchronize AS identitySynchronize" +
", 1 AS count" +
", CASE WHEN message.ui_seen THEN 0 ELSE 1 END AS unseen" +
", CASE WHEN message.ui_flagged THEN 0 ELSE 1 END AS unflagged" +
@@ -201,6 +204,7 @@ public interface DaoMessage {
@Query("SELECT message.*" +
", account.name AS accountName, identity.color AS accountColor, account.notify AS accountNotify" +
", folder.name AS folderName, folder.display AS folderDisplay, folder.type AS folderType" +
", identity.name AS identityName, identity.email AS identityEmail, identity.synchronize AS identitySynchronize" +
", 1 AS count" +
", CASE WHEN message.ui_seen THEN 0 ELSE 1 END AS unseen" +
", CASE WHEN message.ui_flagged THEN 0 ELSE 1 END AS unflagged" +
@@ -217,6 +221,7 @@ public interface DaoMessage {
@Query("SELECT message.*" +
", account.name AS accountName, IFNULL(identity.color, account.color) AS accountColor, account.notify AS accountNotify" +
", folder.name AS folderName, folder.display AS folderDisplay, folder.type AS folderType" +
", identity.name AS identityName, identity.email AS identityEmail, identity.synchronize AS identitySynchronize" +
", 1 AS count" +
", 1 AS unseen" +
", 0 AS unflagged" +

View File

@@ -28,6 +28,9 @@ public class TupleMessageEx extends EntityMessage {
public String folderName;
public String folderDisplay;
public String folderType;
public String identityName;
public String identityEmail;
public Boolean identitySynchronize;
public int count;
public int unseen;
public int unflagged;
@@ -48,6 +51,9 @@ public class TupleMessageEx extends EntityMessage {
this.folderName.equals(other.folderName) &&
(this.folderDisplay == null ? other.folderDisplay == null : this.folderDisplay.equals(other.folderDisplay)) &&
this.folderType.equals(other.folderType) &&
(this.identityName == null ? other.identityName == null : this.identityName.equals(other.identityName)) &&
(this.identityEmail == null ? other.identityEmail == null : this.identityEmail.equals(other.identityEmail)) &&
(this.identitySynchronize == null ? other.identitySynchronize == null : this.identitySynchronize.equals(other.identitySynchronize)) &&
this.count == other.count &&
this.unseen == other.unseen &&
this.unflagged == other.unflagged &&