mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-26 01:36:55 +00:00
Added setting to add shared files to existing draft
This commit is contained in:
parent
5e9b6642a5
commit
684758371a
5 changed files with 27 additions and 13 deletions
|
@ -40,15 +40,12 @@ import androidx.preference.PreferenceManager;
|
|||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class ActivityCompose extends ActivityBase implements FragmentManager.OnBackStackChangedListener {
|
||||
static final int PI_REPLY = 1;
|
||||
|
||||
private static final long APPEND_ATTACHMENT_INTERVAL = 3 * 60 * 1000L;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
@ -213,12 +210,9 @@ public class ActivityCompose extends ActivityBase implements FragmentManager.OnB
|
|||
|
||||
FragmentManager fm = getSupportFragmentManager();
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
boolean attach_new = prefs.getBoolean("attach_new", true);
|
||||
|
||||
long now = new Date().getTime();
|
||||
long last = prefs.getLong("last_composed", 0L);
|
||||
|
||||
if (!create && !BuildConfig.PLAY_STORE_RELEASE &&
|
||||
now - last < APPEND_ATTACHMENT_INTERVAL &&
|
||||
if (!attach_new && !create &&
|
||||
args.size() == 1 && args.containsKey("attachments")) {
|
||||
List<Fragment> fragments = fm.getFragments();
|
||||
if (fragments.size() == 1) {
|
||||
|
|
|
@ -1424,9 +1424,6 @@ public class FragmentCompose extends FragmentBase {
|
|||
Bundle extras = new Bundle();
|
||||
extras.putBoolean("autosave", true);
|
||||
onAction(R.id.action_save, extras, "pause");
|
||||
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
prefs.edit().putLong("last_composed", new Date().getTime()).apply();
|
||||
}
|
||||
|
||||
ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||
|
|
|
@ -63,6 +63,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
|
|||
private RadioGroup rgFwd;
|
||||
private SwitchCompat swSendReminders;
|
||||
private Spinner spSendDelayed;
|
||||
private SwitchCompat swAttachNew;
|
||||
private SwitchCompat swReplyAll;
|
||||
private SwitchCompat swSendPending;
|
||||
|
||||
|
@ -95,7 +96,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
|
|||
"suggest_names", "suggest_sent", "suggested_received", "suggest_frequently",
|
||||
"alt_re", "alt_fwd",
|
||||
"send_reminders", "send_delayed",
|
||||
"reply_all", "send_pending",
|
||||
"attach_new", "reply_all", "send_pending",
|
||||
"compose_font", "prefix_once", "separate_reply", "extended_reply", "write_below", "quote_reply", "quote_limit", "resize_reply",
|
||||
"signature_location", "signature_new", "signature_reply", "signature_forward",
|
||||
"discard_delete", "reply_move",
|
||||
|
@ -125,6 +126,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
|
|||
rgFwd = view.findViewById(R.id.rgFwd);
|
||||
swSendReminders = view.findViewById(R.id.swSendReminders);
|
||||
spSendDelayed = view.findViewById(R.id.spSendDelayed);
|
||||
swAttachNew = view.findViewById(R.id.swAttachNew);
|
||||
swReplyAll = view.findViewById(R.id.swReplyAll);
|
||||
swSendPending = view.findViewById(R.id.swSendPending);
|
||||
|
||||
|
@ -265,6 +267,13 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
|
|||
}
|
||||
});
|
||||
|
||||
swAttachNew.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("attach_new", checked).apply();
|
||||
}
|
||||
});
|
||||
|
||||
swReplyAll.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
|
@ -537,6 +546,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc
|
|||
break;
|
||||
}
|
||||
|
||||
swAttachNew.setChecked(prefs.getBoolean("attach_new", true));
|
||||
swReplyAll.setChecked(prefs.getBoolean("reply_all", false));
|
||||
swSendPending.setChecked(prefs.getBoolean("send_pending", true));
|
||||
|
||||
|
|
|
@ -309,6 +309,18 @@
|
|||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvSendDelayed" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swAttachNew"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:checked="true"
|
||||
android:text="@string/title_advanced_attach_new"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/spSendDelayed"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swReplyAll"
|
||||
android:layout_width="0dp"
|
||||
|
@ -317,7 +329,7 @@
|
|||
android:text="@string/title_advanced_reply_all"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/spSendDelayed"
|
||||
app:layout_constraintTop_toBottomOf="@id/swAttachNew"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<eu.faircode.email.FixedTextView
|
||||
|
|
|
@ -351,6 +351,7 @@
|
|||
<string name="title_advanced_alt_re_fwd">Alternative reply/forward prefix</string>
|
||||
<string name="title_advanced_send_reminders">Show reminders</string>
|
||||
<string name="title_advanced_send_delayed">Delay sending messages</string>
|
||||
<string name="title_advanced_attach_new">Add shared files to a new draft</string>
|
||||
<string name="title_advanced_reply_all">Long press answer button to reply to all</string>
|
||||
<string name="title_advanced_send_pending">Show non-obtrusive send delayed icon</string>
|
||||
|
||||
|
|
Loading…
Reference in a new issue