Browse Source

Revert "Fixed threaded messages actions"

This reverts commit 2b807d5253.
main
M66B 6 years ago
parent
commit
46a467c001
2 changed files with 4 additions and 36 deletions
  1. +1
    -1
      app/src/main/java/eu/faircode/email/AdapterMessage.java
  2. +3
    -35
      app/src/main/java/eu/faircode/email/FragmentMessages.java

+ 1
- 1
app/src/main/java/eu/faircode/email/AdapterMessage.java View File

@ -263,7 +263,7 @@ public class AdapterMessage extends PagedListAdapter<TupleMessageEx, AdapterMess
final TupleMessageEx message = getItem(pos); final TupleMessageEx message = getItem(pos);
PopupMenu popupMenu = new PopupMenu(context, itemView); PopupMenu popupMenu = new PopupMenu(context, itemView);
if (!message.threaded && !EntityFolder.OUTBOX.equals(message.folderType)) {
if (!EntityFolder.OUTBOX.equals(message.folderType)) {
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_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.getMenu().add(Menu.NONE, action_seen, 2, message.ui_seen ? R.string.title_unseen : R.string.title_seen);
} }


+ 3
- 35
app/src/main/java/eu/faircode/email/FragmentMessages.java View File

@ -42,7 +42,6 @@ import android.widget.TextView;
import com.google.android.material.floatingactionbutton.FloatingActionButton; import com.google.android.material.floatingactionbutton.FloatingActionButton;
import com.google.android.material.snackbar.Snackbar; import com.google.android.material.snackbar.Snackbar;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
@ -242,14 +241,12 @@ public class FragmentMessages extends FragmentEx {
Bundle args = new Bundle(); Bundle args = new Bundle();
args.putLong("id", message.id); args.putLong("id", message.id);
args.putInt("direction", direction); args.putInt("direction", direction);
args.putBoolean("single", !message.threaded);
new SimpleTask<String[]>() { new SimpleTask<String[]>() {
@Override @Override
protected String[] onLoad(Context context, Bundle args) { protected String[] onLoad(Context context, Bundle args) {
long id = args.getLong("id"); long id = args.getLong("id");
int direction = args.getInt("direction"); int direction = args.getInt("direction");
boolean single = args.getBoolean("single");
EntityFolder target = null; EntityFolder target = null;
// Get target folder and hide message // Get target folder and hide message
@ -269,14 +266,7 @@ public class FragmentMessages extends FragmentEx {
target = db.folder().getFolderByType(message.account, EntityFolder.TRASH); target = db.folder().getFolderByType(message.account, EntityFolder.TRASH);
} }
List<EntityMessage> messages = new ArrayList<>();
if (single)
messages.add(message);
else
messages.addAll(db.message().getMessageByThread(message.account, message.thread));
for (EntityMessage m : messages)
db.message().setMessageUiHide(m.id, true);
db.message().setMessageUiHide(message.id, true);
db.setTransactionSuccessful(); db.setTransactionSuccessful();
} finally { } finally {
@ -305,30 +295,8 @@ public class FragmentMessages extends FragmentEx {
@Override @Override
protected Void onLoad(Context context, Bundle args) { protected Void onLoad(Context context, Bundle args) {
long id = args.getLong("id"); long id = args.getLong("id");
boolean single = args.getBoolean("single");
DB db = DB.getInstance(context);
try {
db.beginTransaction();
EntityMessage message = db.message().getMessage(id);
List<EntityMessage> messages = new ArrayList<>();
if (single)
messages.add(message);
else
messages.addAll(db.message().getMessageByThread(message.account, message.thread));
for (EntityMessage m : messages) {
Log.i(Helper.TAG, "Undo move id=" + m.id);
DB.getInstance(context).message().setMessageUiHide(m.id, false);
}
db.setTransactionSuccessful();
} finally {
db.endTransaction();
}
Log.i(Helper.TAG, "Undo move id=" + id);
DB.getInstance(context).message().setMessageUiHide(id, false);
return null; return null;
} }


Loading…
Cancel
Save