From 886cad559c5fa936e95cdee66074c586af2fbbdc Mon Sep 17 00:00:00 2001 From: M66B Date: Fri, 7 Sep 2018 16:28:15 +0000 Subject: [PATCH] Added menu to mark read/unread, star/unstar --- .../eu/faircode/email/AdapterMessage.java | 77 ++++++++++++------- app/src/main/res/values-af/strings.xml | 2 + app/src/main/res/values-ar-rBH/strings.xml | 2 + app/src/main/res/values-ar-rEG/strings.xml | 2 + app/src/main/res/values-ar-rSA/strings.xml | 2 + app/src/main/res/values-ar-rYE/strings.xml | 2 + app/src/main/res/values-ar/strings.xml | 2 + app/src/main/res/values-ca/strings.xml | 2 + app/src/main/res/values-cs/strings.xml | 2 + app/src/main/res/values-da/strings.xml | 2 + app/src/main/res/values-de/strings.xml | 2 + app/src/main/res/values-el/strings.xml | 2 + app/src/main/res/values-en/strings.xml | 2 + app/src/main/res/values-es-rES/strings.xml | 2 + app/src/main/res/values-fi/strings.xml | 2 + app/src/main/res/values-fr/strings.xml | 2 + app/src/main/res/values-he/strings.xml | 2 + app/src/main/res/values-hu/strings.xml | 2 + app/src/main/res/values-it/strings.xml | 2 + app/src/main/res/values-iw/strings.xml | 2 + app/src/main/res/values-ja/strings.xml | 2 + app/src/main/res/values-ko/strings.xml | 2 + app/src/main/res/values-nb/strings.xml | 2 + app/src/main/res/values-nl/strings.xml | 2 + app/src/main/res/values-no/strings.xml | 2 + app/src/main/res/values-pl/strings.xml | 2 + app/src/main/res/values-pt-rBR/strings.xml | 2 + app/src/main/res/values-pt-rPT/strings.xml | 2 + app/src/main/res/values-ro/strings.xml | 2 + app/src/main/res/values-ru/strings.xml | 2 + app/src/main/res/values-sr/strings.xml | 2 + app/src/main/res/values-sv-rSE/strings.xml | 2 + app/src/main/res/values-tr/strings.xml | 2 + app/src/main/res/values-uk/strings.xml | 2 + app/src/main/res/values-vi/strings.xml | 2 + app/src/main/res/values-zh-rCN/strings.xml | 2 + app/src/main/res/values-zh-rTW/strings.xml | 2 + app/src/main/res/values/strings.xml | 2 + 38 files changed, 125 insertions(+), 26 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/AdapterMessage.java b/app/src/main/java/eu/faircode/email/AdapterMessage.java index 111200a381..1e48c93f22 100644 --- a/app/src/main/java/eu/faircode/email/AdapterMessage.java +++ b/app/src/main/java/eu/faircode/email/AdapterMessage.java @@ -26,6 +26,8 @@ import android.os.Bundle; import android.preference.PreferenceManager; import android.text.format.DateUtils; import android.view.LayoutInflater; +import android.view.Menu; +import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; @@ -39,6 +41,7 @@ import java.util.Date; import java.util.List; import androidx.annotation.NonNull; +import androidx.appcompat.widget.PopupMenu; import androidx.lifecycle.LifecycleOwner; import androidx.lifecycle.Observer; import androidx.localbroadcastmanager.content.LocalBroadcastManager; @@ -70,6 +73,9 @@ public class AdapterMessage extends PagedListAdapter() { + PopupMenu popupMenu = new PopupMenu(context, itemView); + popupMenu.getMenu().add(Menu.NONE, action_flag, 1, message.ui_flagged ? R.string.title_unflag : R.string.title_flag); + popupMenu.getMenu().add(Menu.NONE, action_seen, 2, message.ui_seen ? R.string.title_unseen : R.string.title_seen); + popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() { @Override - protected Void onLoad(Context context, Bundle args) { - long id = args.getLong("id"); - DB db = DB.getInstance(context); - try { - db.beginTransaction(); + public boolean onMenuItemClick(MenuItem target) { + Bundle args = new Bundle(); + args.putLong("id", message.id); + args.putInt("action", target.getItemId()); - EntityMessage message = db.message().getMessage(id); - for (EntityMessage tmessage : db.message().getMessageByThread(message.account, message.thread)) { - db.message().setMessageUiSeen(tmessage.id, !message.ui_seen); - EntityOperation.queue(db, tmessage, EntityOperation.SEEN, !tmessage.ui_seen); + new SimpleTask() { + @Override + protected Void onLoad(Context context, Bundle args) { + long id = args.getLong("id"); + int action = args.getInt("action"); + + DB db = DB.getInstance(context); + try { + db.beginTransaction(); + + EntityMessage message = db.message().getMessage(id); + for (EntityMessage tmessage : db.message().getMessageByThread(message.account, message.thread)) + if (action == action_flag) { + db.message().setMessageUiFlagged(tmessage.id, !message.ui_flagged); + EntityOperation.queue(db, tmessage, EntityOperation.FLAG, !tmessage.ui_flagged); + } else if (action == action_seen) { + db.message().setMessageUiSeen(tmessage.id, !message.ui_seen); + EntityOperation.queue(db, tmessage, EntityOperation.SEEN, !tmessage.ui_seen); + } + + db.setTransactionSuccessful(); + } finally { + db.endTransaction(); + } + + EntityOperation.process(context); + + return null; } - db.setTransactionSuccessful(); - } finally { - db.endTransaction(); - } + @Override + public void onException(Bundle args, Throwable ex) { + Toast.makeText(context, ex.toString(), Toast.LENGTH_LONG).show(); + } + }.load(context, owner, args); - EntityOperation.process(context); - - return null; + return true; } + }); - @Override - public void onException(Bundle args, Throwable ex) { - Toast.makeText(context, ex.toString(), Toast.LENGTH_LONG).show(); - } - }.load(context, owner, args); + popupMenu.show(); return true; } diff --git a/app/src/main/res/values-af/strings.xml b/app/src/main/res/values-af/strings.xml index ffab25d6fb..6411f12170 100644 --- a/app/src/main/res/values-af/strings.xml +++ b/app/src/main/res/values-af/strings.xml @@ -126,6 +126,8 @@ Show conversation Mark read Mark unread + Add star + Remove star Forward Reply to all Show headers diff --git a/app/src/main/res/values-ar-rBH/strings.xml b/app/src/main/res/values-ar-rBH/strings.xml index fc605d569e..e55517e057 100644 --- a/app/src/main/res/values-ar-rBH/strings.xml +++ b/app/src/main/res/values-ar-rBH/strings.xml @@ -142,6 +142,8 @@ Show conversation Mark read Mark unread + Add star + Remove star Forward Reply to all Show headers diff --git a/app/src/main/res/values-ar-rEG/strings.xml b/app/src/main/res/values-ar-rEG/strings.xml index fc605d569e..e55517e057 100644 --- a/app/src/main/res/values-ar-rEG/strings.xml +++ b/app/src/main/res/values-ar-rEG/strings.xml @@ -142,6 +142,8 @@ Show conversation Mark read Mark unread + Add star + Remove star Forward Reply to all Show headers diff --git a/app/src/main/res/values-ar-rSA/strings.xml b/app/src/main/res/values-ar-rSA/strings.xml index fc605d569e..e55517e057 100644 --- a/app/src/main/res/values-ar-rSA/strings.xml +++ b/app/src/main/res/values-ar-rSA/strings.xml @@ -142,6 +142,8 @@ Show conversation Mark read Mark unread + Add star + Remove star Forward Reply to all Show headers diff --git a/app/src/main/res/values-ar-rYE/strings.xml b/app/src/main/res/values-ar-rYE/strings.xml index fc605d569e..e55517e057 100644 --- a/app/src/main/res/values-ar-rYE/strings.xml +++ b/app/src/main/res/values-ar-rYE/strings.xml @@ -142,6 +142,8 @@ Show conversation Mark read Mark unread + Add star + Remove star Forward Reply to all Show headers diff --git a/app/src/main/res/values-ar/strings.xml b/app/src/main/res/values-ar/strings.xml index fc605d569e..e55517e057 100644 --- a/app/src/main/res/values-ar/strings.xml +++ b/app/src/main/res/values-ar/strings.xml @@ -142,6 +142,8 @@ Show conversation Mark read Mark unread + Add star + Remove star Forward Reply to all Show headers diff --git a/app/src/main/res/values-ca/strings.xml b/app/src/main/res/values-ca/strings.xml index ffab25d6fb..6411f12170 100644 --- a/app/src/main/res/values-ca/strings.xml +++ b/app/src/main/res/values-ca/strings.xml @@ -126,6 +126,8 @@ Show conversation Mark read Mark unread + Add star + Remove star Forward Reply to all Show headers diff --git a/app/src/main/res/values-cs/strings.xml b/app/src/main/res/values-cs/strings.xml index 83934452a3..886e268c01 100644 --- a/app/src/main/res/values-cs/strings.xml +++ b/app/src/main/res/values-cs/strings.xml @@ -134,6 +134,8 @@ Show conversation Mark read Mark unread + Add star + Remove star Forward Reply to all Show headers diff --git a/app/src/main/res/values-da/strings.xml b/app/src/main/res/values-da/strings.xml index 7c4ff90ce9..df0589d24a 100644 --- a/app/src/main/res/values-da/strings.xml +++ b/app/src/main/res/values-da/strings.xml @@ -126,6 +126,8 @@ Show conversation Markér som læst Markér som ulæst + Add star + Remove star Videresend Svar alle Show headers diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 55dbb4171e..98de43a0d4 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -126,6 +126,8 @@ Unterhaltung anzeigen Als gelesen markieren Als ungelesen markieren + Add star + Remove star Weiterleiten Antworten an alle Kopfzeile anzeigen diff --git a/app/src/main/res/values-el/strings.xml b/app/src/main/res/values-el/strings.xml index ffab25d6fb..6411f12170 100644 --- a/app/src/main/res/values-el/strings.xml +++ b/app/src/main/res/values-el/strings.xml @@ -126,6 +126,8 @@ Show conversation Mark read Mark unread + Add star + Remove star Forward Reply to all Show headers diff --git a/app/src/main/res/values-en/strings.xml b/app/src/main/res/values-en/strings.xml index ffab25d6fb..6411f12170 100644 --- a/app/src/main/res/values-en/strings.xml +++ b/app/src/main/res/values-en/strings.xml @@ -126,6 +126,8 @@ Show conversation Mark read Mark unread + Add star + Remove star Forward Reply to all Show headers diff --git a/app/src/main/res/values-es-rES/strings.xml b/app/src/main/res/values-es-rES/strings.xml index ffab25d6fb..6411f12170 100644 --- a/app/src/main/res/values-es-rES/strings.xml +++ b/app/src/main/res/values-es-rES/strings.xml @@ -126,6 +126,8 @@ Show conversation Mark read Mark unread + Add star + Remove star Forward Reply to all Show headers diff --git a/app/src/main/res/values-fi/strings.xml b/app/src/main/res/values-fi/strings.xml index ffab25d6fb..6411f12170 100644 --- a/app/src/main/res/values-fi/strings.xml +++ b/app/src/main/res/values-fi/strings.xml @@ -126,6 +126,8 @@ Show conversation Mark read Mark unread + Add star + Remove star Forward Reply to all Show headers diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index 320dbd48c3..1945c82164 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -126,6 +126,8 @@ Afficher le fil de discussion Marquer comme lu Marquer comme non lu + Add star + Remove star Transférer Répondre à tous Afficher les en-têtes diff --git a/app/src/main/res/values-he/strings.xml b/app/src/main/res/values-he/strings.xml index 752516e3dd..db41c9f8da 100644 --- a/app/src/main/res/values-he/strings.xml +++ b/app/src/main/res/values-he/strings.xml @@ -134,6 +134,8 @@ Show conversation Mark read Mark unread + Add star + Remove star Forward Reply to all Show headers diff --git a/app/src/main/res/values-hu/strings.xml b/app/src/main/res/values-hu/strings.xml index ffab25d6fb..6411f12170 100644 --- a/app/src/main/res/values-hu/strings.xml +++ b/app/src/main/res/values-hu/strings.xml @@ -126,6 +126,8 @@ Show conversation Mark read Mark unread + Add star + Remove star Forward Reply to all Show headers diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index 561b562c78..a7459d73c6 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -126,6 +126,8 @@ Show conversation Segna come letto Segna come non letto + Add star + Remove star Inoltra Rispondi a tutti Show headers diff --git a/app/src/main/res/values-iw/strings.xml b/app/src/main/res/values-iw/strings.xml index 752516e3dd..db41c9f8da 100644 --- a/app/src/main/res/values-iw/strings.xml +++ b/app/src/main/res/values-iw/strings.xml @@ -134,6 +134,8 @@ Show conversation Mark read Mark unread + Add star + Remove star Forward Reply to all Show headers diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 76bbe77255..d2ad62236c 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -122,6 +122,8 @@ Show conversation Mark read Mark unread + Add star + Remove star Forward Reply to all Show headers diff --git a/app/src/main/res/values-ko/strings.xml b/app/src/main/res/values-ko/strings.xml index 76bbe77255..d2ad62236c 100644 --- a/app/src/main/res/values-ko/strings.xml +++ b/app/src/main/res/values-ko/strings.xml @@ -122,6 +122,8 @@ Show conversation Mark read Mark unread + Add star + Remove star Forward Reply to all Show headers diff --git a/app/src/main/res/values-nb/strings.xml b/app/src/main/res/values-nb/strings.xml index ffab25d6fb..6411f12170 100644 --- a/app/src/main/res/values-nb/strings.xml +++ b/app/src/main/res/values-nb/strings.xml @@ -126,6 +126,8 @@ Show conversation Mark read Mark unread + Add star + Remove star Forward Reply to all Show headers diff --git a/app/src/main/res/values-nl/strings.xml b/app/src/main/res/values-nl/strings.xml index ffab25d6fb..6411f12170 100644 --- a/app/src/main/res/values-nl/strings.xml +++ b/app/src/main/res/values-nl/strings.xml @@ -126,6 +126,8 @@ Show conversation Mark read Mark unread + Add star + Remove star Forward Reply to all Show headers diff --git a/app/src/main/res/values-no/strings.xml b/app/src/main/res/values-no/strings.xml index ffab25d6fb..6411f12170 100644 --- a/app/src/main/res/values-no/strings.xml +++ b/app/src/main/res/values-no/strings.xml @@ -126,6 +126,8 @@ Show conversation Mark read Mark unread + Add star + Remove star Forward Reply to all Show headers diff --git a/app/src/main/res/values-pl/strings.xml b/app/src/main/res/values-pl/strings.xml index d2550373e6..0494ca8285 100644 --- a/app/src/main/res/values-pl/strings.xml +++ b/app/src/main/res/values-pl/strings.xml @@ -134,6 +134,8 @@ Pokaż konwersację Oznacz jako przeczytane Oznacz jako nieprzeczytane + Add star + Remove star Prześlij dalej Odpowiedz wszystkim Pokaż nagłówki diff --git a/app/src/main/res/values-pt-rBR/strings.xml b/app/src/main/res/values-pt-rBR/strings.xml index f063bb0d7d..4c9e1ef02e 100644 --- a/app/src/main/res/values-pt-rBR/strings.xml +++ b/app/src/main/res/values-pt-rBR/strings.xml @@ -126,6 +126,8 @@ Show conversation Mark read Mark unread + Add star + Remove star Encaminhar Responder a todos Show headers diff --git a/app/src/main/res/values-pt-rPT/strings.xml b/app/src/main/res/values-pt-rPT/strings.xml index ffab25d6fb..6411f12170 100644 --- a/app/src/main/res/values-pt-rPT/strings.xml +++ b/app/src/main/res/values-pt-rPT/strings.xml @@ -126,6 +126,8 @@ Show conversation Mark read Mark unread + Add star + Remove star Forward Reply to all Show headers diff --git a/app/src/main/res/values-ro/strings.xml b/app/src/main/res/values-ro/strings.xml index 56f0a9a886..2b33ff4577 100644 --- a/app/src/main/res/values-ro/strings.xml +++ b/app/src/main/res/values-ro/strings.xml @@ -130,6 +130,8 @@ Arată conversație Marchează ca Citit Marcare ca necitit + Add star + Remove star Redirecționează Răspunde tuturor Arată antetul diff --git a/app/src/main/res/values-ru/strings.xml b/app/src/main/res/values-ru/strings.xml index 83934452a3..886e268c01 100644 --- a/app/src/main/res/values-ru/strings.xml +++ b/app/src/main/res/values-ru/strings.xml @@ -134,6 +134,8 @@ Show conversation Mark read Mark unread + Add star + Remove star Forward Reply to all Show headers diff --git a/app/src/main/res/values-sr/strings.xml b/app/src/main/res/values-sr/strings.xml index dece84e07e..90201b8e66 100644 --- a/app/src/main/res/values-sr/strings.xml +++ b/app/src/main/res/values-sr/strings.xml @@ -130,6 +130,8 @@ Show conversation Mark read Mark unread + Add star + Remove star Forward Reply to all Show headers diff --git a/app/src/main/res/values-sv-rSE/strings.xml b/app/src/main/res/values-sv-rSE/strings.xml index ffab25d6fb..6411f12170 100644 --- a/app/src/main/res/values-sv-rSE/strings.xml +++ b/app/src/main/res/values-sv-rSE/strings.xml @@ -126,6 +126,8 @@ Show conversation Mark read Mark unread + Add star + Remove star Forward Reply to all Show headers diff --git a/app/src/main/res/values-tr/strings.xml b/app/src/main/res/values-tr/strings.xml index 077a34f783..71e508cde6 100644 --- a/app/src/main/res/values-tr/strings.xml +++ b/app/src/main/res/values-tr/strings.xml @@ -126,6 +126,8 @@ Show conversation Okundu olarak işaretle Okunmadı olarak işaretle + Add star + Remove star İlet Tümünü yanıtla Show headers diff --git a/app/src/main/res/values-uk/strings.xml b/app/src/main/res/values-uk/strings.xml index 83934452a3..886e268c01 100644 --- a/app/src/main/res/values-uk/strings.xml +++ b/app/src/main/res/values-uk/strings.xml @@ -134,6 +134,8 @@ Show conversation Mark read Mark unread + Add star + Remove star Forward Reply to all Show headers diff --git a/app/src/main/res/values-vi/strings.xml b/app/src/main/res/values-vi/strings.xml index 76bbe77255..d2ad62236c 100644 --- a/app/src/main/res/values-vi/strings.xml +++ b/app/src/main/res/values-vi/strings.xml @@ -122,6 +122,8 @@ Show conversation Mark read Mark unread + Add star + Remove star Forward Reply to all Show headers diff --git a/app/src/main/res/values-zh-rCN/strings.xml b/app/src/main/res/values-zh-rCN/strings.xml index 89cf8396fa..d1685a542a 100644 --- a/app/src/main/res/values-zh-rCN/strings.xml +++ b/app/src/main/res/values-zh-rCN/strings.xml @@ -122,6 +122,8 @@ Show conversation 标记为已读 标记为未读 + Add star + Remove star 转发 回复全部 Show headers diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index 76bbe77255..d2ad62236c 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -122,6 +122,8 @@ Show conversation Mark read Mark unread + Add star + Remove star Forward Reply to all Show headers diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index d7ce100a4d..0c83ad12dd 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -147,6 +147,8 @@ Show conversation Mark read Mark unread + Add star + Remove star Forward Reply to all Show headers