Added option to move sent messages when moving a conversation

pull/212/head
M66B 2 years ago
parent 15808410e0
commit b95947d079

@ -4520,6 +4520,9 @@ public class FragmentMessages extends FragmentBase
boolean filter_archive = args.getBoolean("filter_archive");
long tid = args.getLong("folder");
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
boolean move_thread_sent = prefs.getBoolean("move_thread_sent", false);
ArrayList<MessageTarget> result = new ArrayList<>();
DB db = DB.getInstance(context);
@ -4540,7 +4543,8 @@ public class FragmentMessages extends FragmentBase
EntityFolder sourceFolder = db.folder().getFolder(threaded.folder);
if (sourceFolder != null && !sourceFolder.read_only &&
!targetFolder.id.equals(threaded.folder) &&
!EntityFolder.isOutgoing(sourceFolder.type) &&
(!EntityFolder.isOutgoing(sourceFolder.type) ||
(EntityFolder.SENT.equals(sourceFolder.type) && move_thread_sent)) &&
(!filter_archive || !EntityFolder.ARCHIVE.equals(sourceFolder.type)))
result.add(new MessageTarget(context, threaded, account, sourceFolder, account, targetFolder));
}

@ -100,6 +100,7 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
private SwitchCompat swAutoBlockSender;
private SwitchCompat swAutoHideAnswer;
private SwitchCompat swSwipeReply;
private SwitchCompat swMoveThreadSent;
private Button btnDefaultFolder;
private TextView tvDefaultFolder;
@ -119,7 +120,7 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
"autoclose", "onclose", "autoclose_unseen", "autoclose_send", "collapse_marked",
"undo_timeout",
"autoread", "flag_snoozed", "autounflag", "auto_important", "reset_importance", "thread_sent_trash",
"reset_snooze", "auto_block_sender", "auto_hide_answer", "swipe_reply", "default_folder"
"reset_snooze", "auto_block_sender", "auto_hide_answer", "swipe_reply", "move_thread_sent", "default_folder"
};
@Override
@ -179,6 +180,7 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
swAutoBlockSender = view.findViewById(R.id.swAutoBlockSender);
swAutoHideAnswer = view.findViewById(R.id.swAutoHideAnswer);
swSwipeReply = view.findViewById(R.id.swSwipeReply);
swMoveThreadSent = view.findViewById(R.id.swMoveThreadSent);
btnDefaultFolder = view.findViewById(R.id.btnDefaultFolder);
tvDefaultFolder = view.findViewById(R.id.tvDefaultFolder);
@ -562,6 +564,13 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
}
});
swMoveThreadSent.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
prefs.edit().putBoolean("move_thread_sent", checked).apply();
}
});
Intent tree = new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE);
Helper.openAdvanced(getContext(), tree);
PackageManager pm = getContext().getPackageManager();
@ -711,6 +720,7 @@ public class FragmentOptionsBehavior extends FragmentBase implements SharedPrefe
swAutoBlockSender.setChecked(prefs.getBoolean("auto_block_sender", true));
swAutoHideAnswer.setChecked(prefs.getBoolean("auto_hide_answer", !accessibility));
swSwipeReply.setChecked(prefs.getBoolean("swipe_reply", false));
swMoveThreadSent.setChecked(prefs.getBoolean("move_thread_sent", false));
tvDefaultFolder.setText(prefs.getString("default_folder", null));
}

@ -818,6 +818,17 @@
app:layout_constraintTop_toBottomOf="@id/swAutoHideAnswer"
app:switchPadding="12dp" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swMoveThreadSent"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_advanced_move_thread_sent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swSwipeReply"
app:switchPadding="12dp" />
<Button
android:id="@+id/btnDefaultFolder"
style="?android:attr/buttonStyleSmall"
@ -829,7 +840,7 @@
android:tag="disable"
android:text="@string/title_advanced_default_folder"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swSwipeReply" />
app:layout_constraintTop_toBottomOf="@id/swMoveThreadSent" />
<TextView
android:id="@+id/tvDefaultFolderHint"

@ -672,6 +672,7 @@
<string name="title_advanced_auto_block_sender">Automatically block the sender when reporting spam</string>
<string name="title_advanced_auto_hide_answer">Automatically hide the answer button when scrolling</string>
<string name="title_advanced_swipe_reply">Swipe expanded messages to the right to reply</string>
<string name="title_advanced_move_thread_sent">When moving a conversation, also move sent messages</string>
<string name="title_advanced_default_snooze">Default snooze/delay time</string>
<string name="title_advanced_default_folder">Select default folder</string>

Loading…
Cancel
Save