diff --git a/app/src/main/java/eu/faircode/email/FragmentCompose.java b/app/src/main/java/eu/faircode/email/FragmentCompose.java index 2bddfd29ab..305f54ca82 100644 --- a/app/src/main/java/eu/faircode/email/FragmentCompose.java +++ b/app/src/main/java/eu/faircode/email/FragmentCompose.java @@ -1936,6 +1936,27 @@ public class FragmentCompose extends FragmentBase { }); menu.findItem(R.id.menu_translate).setActionView(ibTranslate); + ImageButton ibSend = (ImageButton) infl.inflate(R.layout.action_button, null); + ibSend.setId(View.generateViewId()); + ibSend.setImageResource(R.drawable.twotone_send_24); + ibSend.setContentDescription(getString(R.string.title_translate)); + ibSend.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View view) { + onAction(R.id.action_check, "menu:send"); + } + }); + ibSend.setOnLongClickListener(new View.OnLongClickListener() { + @Override + public boolean onLongClick(View v) { + Bundle args = new Bundle(); + args.putBoolean("force_dialog", true); + onAction(R.id.action_check, args, "menu:send:force"); + return true; + } + }); + menu.findItem(R.id.menu_send).setActionView(ibSend); + ImageButton ibZoom = (ImageButton) infl.inflate(R.layout.action_button, null); ibZoom.setId(View.generateViewId()); ibZoom.setImageResource(R.drawable.twotone_format_size_24); @@ -1959,12 +1980,21 @@ public class FragmentCompose extends FragmentBase { final Context context = getContext(); - menu.findItem(R.id.menu_encrypt).setEnabled(state == State.LOADED); - menu.findItem(R.id.menu_translate).setEnabled(state == State.LOADED); - menu.findItem(R.id.menu_translate).setVisible(DeepL.isAvailable(context)); + SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); + boolean send_at_top = prefs.getBoolean("send_at_top", false); + boolean save_drafts = prefs.getBoolean("save_drafts", true); + boolean send_chips = prefs.getBoolean("send_chips", true); + boolean send_dialog = prefs.getBoolean("send_dialog", true); + boolean image_dialog = prefs.getBoolean("image_dialog", true); + boolean experiments = prefs.getBoolean("experiments", false); + menu.findItem(R.id.menu_ai).setEnabled(state == State.LOADED && !chatting); ((ImageButton) menu.findItem(R.id.menu_ai).getActionView()).setEnabled(!chatting); menu.findItem(R.id.menu_ai).setVisible(AI.isAvailable(context)); + menu.findItem(R.id.menu_encrypt).setEnabled(state == State.LOADED); + menu.findItem(R.id.menu_translate).setEnabled(state == State.LOADED); + menu.findItem(R.id.menu_translate).setVisible(DeepL.isAvailable(context)); + menu.findItem(R.id.menu_send).setVisible(send_at_top); menu.findItem(R.id.menu_zoom).setEnabled(state == State.LOADED); menu.findItem(R.id.menu_style).setEnabled(state == State.LOADED); menu.findItem(R.id.menu_media).setEnabled(state == State.LOADED); @@ -2021,13 +2051,6 @@ public class FragmentCompose extends FragmentBase { ibZoom.setAlpha(state == State.LOADED ? 1f : Helper.LOW_LIGHT); ibZoom.setEnabled(state == State.LOADED); - SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); - boolean save_drafts = prefs.getBoolean("save_drafts", true); - boolean send_chips = prefs.getBoolean("send_chips", true); - boolean send_dialog = prefs.getBoolean("send_dialog", true); - boolean image_dialog = prefs.getBoolean("image_dialog", true); - boolean experiments = prefs.getBoolean("experiments", false); - menu.findItem(R.id.menu_save_drafts).setChecked(save_drafts); menu.findItem(R.id.menu_send_chips).setChecked(send_chips); menu.findItem(R.id.menu_send_dialog).setChecked(send_dialog); @@ -2073,6 +2096,8 @@ public class FragmentCompose extends FragmentBase { } }); + bottom_navigation.findViewById(R.id.action_send).setVisibility(send_at_top ? View.GONE : View.VISIBLE); + bottom_navigation.findViewById(R.id.action_send).setOnLongClickListener(new View.OnLongClickListener() { @Override public boolean onLongClick(View v) { diff --git a/app/src/main/java/eu/faircode/email/FragmentOptionsSend.java b/app/src/main/java/eu/faircode/email/FragmentOptionsSend.java index a306aefd82..6c3e2b3435 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptionsSend.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptionsSend.java @@ -113,6 +113,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc private SwitchCompat swSignatureForward; private Button btnEditSignature; + private SwitchCompat swSendAtTop; private SwitchCompat swAttachNew; private SwitchCompat swAutoLink; private SwitchCompat swPlainOnly; @@ -144,7 +145,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc "separate_reply", "extended_reply", "write_below", "quote_reply", "quote_limit", "resize_reply", "resize_paste", "signature_location", "signature_new", "signature_reply", "signature_reply_once", "signature_forward", - "attach_new", "auto_link", "plain_only", "plain_only_reply", + "send_at_top", "attach_new", "auto_link", "plain_only", "plain_only_reply", "format_flowed", "usenet_signature", "remove_signatures", "receipt_default", "receipt_type", "receipt_legacy", "forward_new", @@ -208,6 +209,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc swSignatureForward = view.findViewById(R.id.swSignatureForward); btnEditSignature = view.findViewById(R.id.btnEditSignature); + swSendAtTop = view.findViewById(R.id.swSendAtTop); swAttachNew = view.findViewById(R.id.swAttachNew); swAutoLink = view.findViewById(R.id.swAutoLink); swPlainOnly = view.findViewById(R.id.swPlainOnly); @@ -661,6 +663,13 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc } }); + swSendAtTop.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { + prefs.edit().putBoolean("send_at_top", checked).apply(); + } + }); + swAttachNew.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { @@ -952,6 +961,7 @@ public class FragmentOptionsSend extends FragmentBase implements SharedPreferenc swSignatureReplyOnce.setEnabled(swSignatureReply.isChecked()); swSignatureForward.setChecked(prefs.getBoolean("signature_forward", true)); + swSendAtTop.setChecked(prefs.getBoolean("send_at_top", false)); swAttachNew.setChecked(prefs.getBoolean("attach_new", true)); swAutoLink.setChecked(prefs.getBoolean("auto_link", false)); swPlainOnly.setChecked(prefs.getBoolean("plain_only", false)); diff --git a/app/src/main/res/layout/fragment_options_send.xml b/app/src/main/res/layout/fragment_options_send.xml index db180de15d..942e63855d 100644 --- a/app/src/main/res/layout/fragment_options_send.xml +++ b/app/src/main/res/layout/fragment_options_send.xml @@ -885,6 +885,18 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> + + + + Use the identity color for the bottom action bar Show reminders Delay sending messages + Show send button at the top Create a new draft message for shared addresses and files Answer button settings Short pressing on the answer button will: