mirror of
https://github.com/M66B/FairEmail.git
synced 2026-04-07 09:33:39 +02:00
Added option to show send button at the top
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -885,6 +885,18 @@
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swSendAtTop"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="12dp"
|
||||
android:checked="true"
|
||||
android:text="@string/title_advanced_send_top"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvCaptionAdvanced"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<androidx.appcompat.widget.SwitchCompat
|
||||
android:id="@+id/swAttachNew"
|
||||
android:layout_width="0dp"
|
||||
@@ -894,7 +906,7 @@
|
||||
android:text="@string/title_advanced_attach_new"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvCaptionAdvanced"
|
||||
app:layout_constraintTop_toBottomOf="@id/swSendAtTop"
|
||||
app:switchPadding="12dp" />
|
||||
|
||||
<TextView
|
||||
|
||||
@@ -19,6 +19,12 @@
|
||||
android:title="@string/title_translate"
|
||||
app:showAsAction="always" />
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_send"
|
||||
android:icon="@drawable/twotone_send_24"
|
||||
android:title="@string/title_send"
|
||||
app:showAsAction="always" />
|
||||
|
||||
<item
|
||||
android:id="@+id/menu_zoom"
|
||||
android:icon="@drawable/twotone_format_size_24"
|
||||
|
||||
@@ -474,6 +474,7 @@
|
||||
<string name="title_advanced_send_nav_color">Use the identity color for the bottom action bar</string>
|
||||
<string name="title_advanced_send_reminders">Show reminders</string>
|
||||
<string name="title_advanced_send_delayed">Delay sending messages</string>
|
||||
<string name="title_advanced_send_top">Show send button at the top</string>
|
||||
<string name="title_advanced_attach_new">Create a new draft message for shared addresses and files</string>
|
||||
<string name="title_advanced_answer_caption">Answer button settings</string>
|
||||
<string name="title_advanced_answer_default">Short pressing on the answer button will:</string>
|
||||
|
||||
Reference in New Issue
Block a user