mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-24 16:53:37 +00:00
Added menu to mark read/unread, star/unstar
This commit is contained in:
parent
5fb89f3d3c
commit
886cad559c
38 changed files with 125 additions and 26 deletions
|
@ -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<TupleMessageEx, AdapterMess
|
|||
TextView tvError;
|
||||
ProgressBar pbLoading;
|
||||
|
||||
private static final int action_seen = 1;
|
||||
private static final int action_flag = 2;
|
||||
|
||||
ViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
|
||||
|
@ -207,40 +213,59 @@ public class AdapterMessage extends PagedListAdapter<TupleMessageEx, AdapterMess
|
|||
if (pos == RecyclerView.NO_POSITION)
|
||||
return false;
|
||||
|
||||
TupleMessageEx message = getItem(pos);
|
||||
final TupleMessageEx message = getItem(pos);
|
||||
|
||||
Bundle args = new Bundle();
|
||||
args.putLong("id", message.id);
|
||||
|
||||
new SimpleTask<Void>() {
|
||||
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<Void>() {
|
||||
@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;
|
||||
}
|
||||
|
|
|
@ -126,6 +126,8 @@
|
|||
<string name="title_thread">Show conversation</string>
|
||||
<string name="title_seen">Mark read</string>
|
||||
<string name="title_unseen">Mark unread</string>
|
||||
<string name="title_flag">Add star</string>
|
||||
<string name="title_unflag">Remove star</string>
|
||||
<string name="title_forward">Forward</string>
|
||||
<string name="title_reply_all">Reply to all</string>
|
||||
<string name="title_show_headers">Show headers</string>
|
||||
|
|
|
@ -142,6 +142,8 @@
|
|||
<string name="title_thread">Show conversation</string>
|
||||
<string name="title_seen">Mark read</string>
|
||||
<string name="title_unseen">Mark unread</string>
|
||||
<string name="title_flag">Add star</string>
|
||||
<string name="title_unflag">Remove star</string>
|
||||
<string name="title_forward">Forward</string>
|
||||
<string name="title_reply_all">Reply to all</string>
|
||||
<string name="title_show_headers">Show headers</string>
|
||||
|
|
|
@ -142,6 +142,8 @@
|
|||
<string name="title_thread">Show conversation</string>
|
||||
<string name="title_seen">Mark read</string>
|
||||
<string name="title_unseen">Mark unread</string>
|
||||
<string name="title_flag">Add star</string>
|
||||
<string name="title_unflag">Remove star</string>
|
||||
<string name="title_forward">Forward</string>
|
||||
<string name="title_reply_all">Reply to all</string>
|
||||
<string name="title_show_headers">Show headers</string>
|
||||
|
|
|
@ -142,6 +142,8 @@
|
|||
<string name="title_thread">Show conversation</string>
|
||||
<string name="title_seen">Mark read</string>
|
||||
<string name="title_unseen">Mark unread</string>
|
||||
<string name="title_flag">Add star</string>
|
||||
<string name="title_unflag">Remove star</string>
|
||||
<string name="title_forward">Forward</string>
|
||||
<string name="title_reply_all">Reply to all</string>
|
||||
<string name="title_show_headers">Show headers</string>
|
||||
|
|
|
@ -142,6 +142,8 @@
|
|||
<string name="title_thread">Show conversation</string>
|
||||
<string name="title_seen">Mark read</string>
|
||||
<string name="title_unseen">Mark unread</string>
|
||||
<string name="title_flag">Add star</string>
|
||||
<string name="title_unflag">Remove star</string>
|
||||
<string name="title_forward">Forward</string>
|
||||
<string name="title_reply_all">Reply to all</string>
|
||||
<string name="title_show_headers">Show headers</string>
|
||||
|
|
|
@ -142,6 +142,8 @@
|
|||
<string name="title_thread">Show conversation</string>
|
||||
<string name="title_seen">Mark read</string>
|
||||
<string name="title_unseen">Mark unread</string>
|
||||
<string name="title_flag">Add star</string>
|
||||
<string name="title_unflag">Remove star</string>
|
||||
<string name="title_forward">Forward</string>
|
||||
<string name="title_reply_all">Reply to all</string>
|
||||
<string name="title_show_headers">Show headers</string>
|
||||
|
|
|
@ -126,6 +126,8 @@
|
|||
<string name="title_thread">Show conversation</string>
|
||||
<string name="title_seen">Mark read</string>
|
||||
<string name="title_unseen">Mark unread</string>
|
||||
<string name="title_flag">Add star</string>
|
||||
<string name="title_unflag">Remove star</string>
|
||||
<string name="title_forward">Forward</string>
|
||||
<string name="title_reply_all">Reply to all</string>
|
||||
<string name="title_show_headers">Show headers</string>
|
||||
|
|
|
@ -134,6 +134,8 @@
|
|||
<string name="title_thread">Show conversation</string>
|
||||
<string name="title_seen">Mark read</string>
|
||||
<string name="title_unseen">Mark unread</string>
|
||||
<string name="title_flag">Add star</string>
|
||||
<string name="title_unflag">Remove star</string>
|
||||
<string name="title_forward">Forward</string>
|
||||
<string name="title_reply_all">Reply to all</string>
|
||||
<string name="title_show_headers">Show headers</string>
|
||||
|
|
|
@ -126,6 +126,8 @@
|
|||
<string name="title_thread">Show conversation</string>
|
||||
<string name="title_seen">Markér som læst</string>
|
||||
<string name="title_unseen">Markér som ulæst</string>
|
||||
<string name="title_flag">Add star</string>
|
||||
<string name="title_unflag">Remove star</string>
|
||||
<string name="title_forward">Videresend</string>
|
||||
<string name="title_reply_all">Svar alle</string>
|
||||
<string name="title_show_headers">Show headers</string>
|
||||
|
|
|
@ -126,6 +126,8 @@
|
|||
<string name="title_thread">Unterhaltung anzeigen</string>
|
||||
<string name="title_seen">Als gelesen markieren</string>
|
||||
<string name="title_unseen">Als ungelesen markieren</string>
|
||||
<string name="title_flag">Add star</string>
|
||||
<string name="title_unflag">Remove star</string>
|
||||
<string name="title_forward">Weiterleiten</string>
|
||||
<string name="title_reply_all">Antworten an alle</string>
|
||||
<string name="title_show_headers">Kopfzeile anzeigen</string>
|
||||
|
|
|
@ -126,6 +126,8 @@
|
|||
<string name="title_thread">Show conversation</string>
|
||||
<string name="title_seen">Mark read</string>
|
||||
<string name="title_unseen">Mark unread</string>
|
||||
<string name="title_flag">Add star</string>
|
||||
<string name="title_unflag">Remove star</string>
|
||||
<string name="title_forward">Forward</string>
|
||||
<string name="title_reply_all">Reply to all</string>
|
||||
<string name="title_show_headers">Show headers</string>
|
||||
|
|
|
@ -126,6 +126,8 @@
|
|||
<string name="title_thread">Show conversation</string>
|
||||
<string name="title_seen">Mark read</string>
|
||||
<string name="title_unseen">Mark unread</string>
|
||||
<string name="title_flag">Add star</string>
|
||||
<string name="title_unflag">Remove star</string>
|
||||
<string name="title_forward">Forward</string>
|
||||
<string name="title_reply_all">Reply to all</string>
|
||||
<string name="title_show_headers">Show headers</string>
|
||||
|
|
|
@ -126,6 +126,8 @@
|
|||
<string name="title_thread">Show conversation</string>
|
||||
<string name="title_seen">Mark read</string>
|
||||
<string name="title_unseen">Mark unread</string>
|
||||
<string name="title_flag">Add star</string>
|
||||
<string name="title_unflag">Remove star</string>
|
||||
<string name="title_forward">Forward</string>
|
||||
<string name="title_reply_all">Reply to all</string>
|
||||
<string name="title_show_headers">Show headers</string>
|
||||
|
|
|
@ -126,6 +126,8 @@
|
|||
<string name="title_thread">Show conversation</string>
|
||||
<string name="title_seen">Mark read</string>
|
||||
<string name="title_unseen">Mark unread</string>
|
||||
<string name="title_flag">Add star</string>
|
||||
<string name="title_unflag">Remove star</string>
|
||||
<string name="title_forward">Forward</string>
|
||||
<string name="title_reply_all">Reply to all</string>
|
||||
<string name="title_show_headers">Show headers</string>
|
||||
|
|
|
@ -126,6 +126,8 @@
|
|||
<string name="title_thread">Afficher le fil de discussion</string>
|
||||
<string name="title_seen">Marquer comme lu</string>
|
||||
<string name="title_unseen">Marquer comme non lu</string>
|
||||
<string name="title_flag">Add star</string>
|
||||
<string name="title_unflag">Remove star</string>
|
||||
<string name="title_forward">Transférer</string>
|
||||
<string name="title_reply_all">Répondre à tous</string>
|
||||
<string name="title_show_headers">Afficher les en-têtes</string>
|
||||
|
|
|
@ -134,6 +134,8 @@
|
|||
<string name="title_thread">Show conversation</string>
|
||||
<string name="title_seen">Mark read</string>
|
||||
<string name="title_unseen">Mark unread</string>
|
||||
<string name="title_flag">Add star</string>
|
||||
<string name="title_unflag">Remove star</string>
|
||||
<string name="title_forward">Forward</string>
|
||||
<string name="title_reply_all">Reply to all</string>
|
||||
<string name="title_show_headers">Show headers</string>
|
||||
|
|
|
@ -126,6 +126,8 @@
|
|||
<string name="title_thread">Show conversation</string>
|
||||
<string name="title_seen">Mark read</string>
|
||||
<string name="title_unseen">Mark unread</string>
|
||||
<string name="title_flag">Add star</string>
|
||||
<string name="title_unflag">Remove star</string>
|
||||
<string name="title_forward">Forward</string>
|
||||
<string name="title_reply_all">Reply to all</string>
|
||||
<string name="title_show_headers">Show headers</string>
|
||||
|
|
|
@ -126,6 +126,8 @@
|
|||
<string name="title_thread">Show conversation</string>
|
||||
<string name="title_seen">Segna come letto</string>
|
||||
<string name="title_unseen">Segna come non letto</string>
|
||||
<string name="title_flag">Add star</string>
|
||||
<string name="title_unflag">Remove star</string>
|
||||
<string name="title_forward">Inoltra</string>
|
||||
<string name="title_reply_all">Rispondi a tutti</string>
|
||||
<string name="title_show_headers">Show headers</string>
|
||||
|
|
|
@ -134,6 +134,8 @@
|
|||
<string name="title_thread">Show conversation</string>
|
||||
<string name="title_seen">Mark read</string>
|
||||
<string name="title_unseen">Mark unread</string>
|
||||
<string name="title_flag">Add star</string>
|
||||
<string name="title_unflag">Remove star</string>
|
||||
<string name="title_forward">Forward</string>
|
||||
<string name="title_reply_all">Reply to all</string>
|
||||
<string name="title_show_headers">Show headers</string>
|
||||
|
|
|
@ -122,6 +122,8 @@
|
|||
<string name="title_thread">Show conversation</string>
|
||||
<string name="title_seen">Mark read</string>
|
||||
<string name="title_unseen">Mark unread</string>
|
||||
<string name="title_flag">Add star</string>
|
||||
<string name="title_unflag">Remove star</string>
|
||||
<string name="title_forward">Forward</string>
|
||||
<string name="title_reply_all">Reply to all</string>
|
||||
<string name="title_show_headers">Show headers</string>
|
||||
|
|
|
@ -122,6 +122,8 @@
|
|||
<string name="title_thread">Show conversation</string>
|
||||
<string name="title_seen">Mark read</string>
|
||||
<string name="title_unseen">Mark unread</string>
|
||||
<string name="title_flag">Add star</string>
|
||||
<string name="title_unflag">Remove star</string>
|
||||
<string name="title_forward">Forward</string>
|
||||
<string name="title_reply_all">Reply to all</string>
|
||||
<string name="title_show_headers">Show headers</string>
|
||||
|
|
|
@ -126,6 +126,8 @@
|
|||
<string name="title_thread">Show conversation</string>
|
||||
<string name="title_seen">Mark read</string>
|
||||
<string name="title_unseen">Mark unread</string>
|
||||
<string name="title_flag">Add star</string>
|
||||
<string name="title_unflag">Remove star</string>
|
||||
<string name="title_forward">Forward</string>
|
||||
<string name="title_reply_all">Reply to all</string>
|
||||
<string name="title_show_headers">Show headers</string>
|
||||
|
|
|
@ -126,6 +126,8 @@
|
|||
<string name="title_thread">Show conversation</string>
|
||||
<string name="title_seen">Mark read</string>
|
||||
<string name="title_unseen">Mark unread</string>
|
||||
<string name="title_flag">Add star</string>
|
||||
<string name="title_unflag">Remove star</string>
|
||||
<string name="title_forward">Forward</string>
|
||||
<string name="title_reply_all">Reply to all</string>
|
||||
<string name="title_show_headers">Show headers</string>
|
||||
|
|
|
@ -126,6 +126,8 @@
|
|||
<string name="title_thread">Show conversation</string>
|
||||
<string name="title_seen">Mark read</string>
|
||||
<string name="title_unseen">Mark unread</string>
|
||||
<string name="title_flag">Add star</string>
|
||||
<string name="title_unflag">Remove star</string>
|
||||
<string name="title_forward">Forward</string>
|
||||
<string name="title_reply_all">Reply to all</string>
|
||||
<string name="title_show_headers">Show headers</string>
|
||||
|
|
|
@ -134,6 +134,8 @@
|
|||
<string name="title_thread">Pokaż konwersację</string>
|
||||
<string name="title_seen">Oznacz jako przeczytane</string>
|
||||
<string name="title_unseen">Oznacz jako nieprzeczytane</string>
|
||||
<string name="title_flag">Add star</string>
|
||||
<string name="title_unflag">Remove star</string>
|
||||
<string name="title_forward">Prześlij dalej</string>
|
||||
<string name="title_reply_all">Odpowiedz wszystkim</string>
|
||||
<string name="title_show_headers">Pokaż nagłówki</string>
|
||||
|
|
|
@ -126,6 +126,8 @@
|
|||
<string name="title_thread">Show conversation</string>
|
||||
<string name="title_seen">Mark read</string>
|
||||
<string name="title_unseen">Mark unread</string>
|
||||
<string name="title_flag">Add star</string>
|
||||
<string name="title_unflag">Remove star</string>
|
||||
<string name="title_forward">Encaminhar</string>
|
||||
<string name="title_reply_all">Responder a todos</string>
|
||||
<string name="title_show_headers">Show headers</string>
|
||||
|
|
|
@ -126,6 +126,8 @@
|
|||
<string name="title_thread">Show conversation</string>
|
||||
<string name="title_seen">Mark read</string>
|
||||
<string name="title_unseen">Mark unread</string>
|
||||
<string name="title_flag">Add star</string>
|
||||
<string name="title_unflag">Remove star</string>
|
||||
<string name="title_forward">Forward</string>
|
||||
<string name="title_reply_all">Reply to all</string>
|
||||
<string name="title_show_headers">Show headers</string>
|
||||
|
|
|
@ -130,6 +130,8 @@
|
|||
<string name="title_thread">Arată conversație</string>
|
||||
<string name="title_seen">Marchează ca Citit</string>
|
||||
<string name="title_unseen">Marcare ca necitit</string>
|
||||
<string name="title_flag">Add star</string>
|
||||
<string name="title_unflag">Remove star</string>
|
||||
<string name="title_forward">Redirecționează</string>
|
||||
<string name="title_reply_all">Răspunde tuturor</string>
|
||||
<string name="title_show_headers">Arată antetul</string>
|
||||
|
|
|
@ -134,6 +134,8 @@
|
|||
<string name="title_thread">Show conversation</string>
|
||||
<string name="title_seen">Mark read</string>
|
||||
<string name="title_unseen">Mark unread</string>
|
||||
<string name="title_flag">Add star</string>
|
||||
<string name="title_unflag">Remove star</string>
|
||||
<string name="title_forward">Forward</string>
|
||||
<string name="title_reply_all">Reply to all</string>
|
||||
<string name="title_show_headers">Show headers</string>
|
||||
|
|
|
@ -130,6 +130,8 @@
|
|||
<string name="title_thread">Show conversation</string>
|
||||
<string name="title_seen">Mark read</string>
|
||||
<string name="title_unseen">Mark unread</string>
|
||||
<string name="title_flag">Add star</string>
|
||||
<string name="title_unflag">Remove star</string>
|
||||
<string name="title_forward">Forward</string>
|
||||
<string name="title_reply_all">Reply to all</string>
|
||||
<string name="title_show_headers">Show headers</string>
|
||||
|
|
|
@ -126,6 +126,8 @@
|
|||
<string name="title_thread">Show conversation</string>
|
||||
<string name="title_seen">Mark read</string>
|
||||
<string name="title_unseen">Mark unread</string>
|
||||
<string name="title_flag">Add star</string>
|
||||
<string name="title_unflag">Remove star</string>
|
||||
<string name="title_forward">Forward</string>
|
||||
<string name="title_reply_all">Reply to all</string>
|
||||
<string name="title_show_headers">Show headers</string>
|
||||
|
|
|
@ -126,6 +126,8 @@
|
|||
<string name="title_thread">Show conversation</string>
|
||||
<string name="title_seen">Okundu olarak işaretle</string>
|
||||
<string name="title_unseen">Okunmadı olarak işaretle</string>
|
||||
<string name="title_flag">Add star</string>
|
||||
<string name="title_unflag">Remove star</string>
|
||||
<string name="title_forward">İlet</string>
|
||||
<string name="title_reply_all">Tümünü yanıtla</string>
|
||||
<string name="title_show_headers">Show headers</string>
|
||||
|
|
|
@ -134,6 +134,8 @@
|
|||
<string name="title_thread">Show conversation</string>
|
||||
<string name="title_seen">Mark read</string>
|
||||
<string name="title_unseen">Mark unread</string>
|
||||
<string name="title_flag">Add star</string>
|
||||
<string name="title_unflag">Remove star</string>
|
||||
<string name="title_forward">Forward</string>
|
||||
<string name="title_reply_all">Reply to all</string>
|
||||
<string name="title_show_headers">Show headers</string>
|
||||
|
|
|
@ -122,6 +122,8 @@
|
|||
<string name="title_thread">Show conversation</string>
|
||||
<string name="title_seen">Mark read</string>
|
||||
<string name="title_unseen">Mark unread</string>
|
||||
<string name="title_flag">Add star</string>
|
||||
<string name="title_unflag">Remove star</string>
|
||||
<string name="title_forward">Forward</string>
|
||||
<string name="title_reply_all">Reply to all</string>
|
||||
<string name="title_show_headers">Show headers</string>
|
||||
|
|
|
@ -122,6 +122,8 @@
|
|||
<string name="title_thread">Show conversation</string>
|
||||
<string name="title_seen">标记为已读</string>
|
||||
<string name="title_unseen">标记为未读</string>
|
||||
<string name="title_flag">Add star</string>
|
||||
<string name="title_unflag">Remove star</string>
|
||||
<string name="title_forward">转发</string>
|
||||
<string name="title_reply_all">回复全部</string>
|
||||
<string name="title_show_headers">Show headers</string>
|
||||
|
|
|
@ -122,6 +122,8 @@
|
|||
<string name="title_thread">Show conversation</string>
|
||||
<string name="title_seen">Mark read</string>
|
||||
<string name="title_unseen">Mark unread</string>
|
||||
<string name="title_flag">Add star</string>
|
||||
<string name="title_unflag">Remove star</string>
|
||||
<string name="title_forward">Forward</string>
|
||||
<string name="title_reply_all">Reply to all</string>
|
||||
<string name="title_show_headers">Show headers</string>
|
||||
|
|
|
@ -147,6 +147,8 @@
|
|||
<string name="title_thread">Show conversation</string>
|
||||
<string name="title_seen">Mark read</string>
|
||||
<string name="title_unseen">Mark unread</string>
|
||||
<string name="title_flag">Add star</string>
|
||||
<string name="title_unflag">Remove star</string>
|
||||
<string name="title_forward">Forward</string>
|
||||
<string name="title_reply_all">Reply to all</string>
|
||||
<string name="title_show_headers">Show headers</string>
|
||||
|
|
Loading…
Reference in a new issue