From 0aa295b899b46fb8dad1c16eed6072b66de86b20 Mon Sep 17 00:00:00 2001 From: M66B Date: Thu, 19 Dec 2024 08:59:14 +0100 Subject: [PATCH] EML: use floating action button --- .../java/eu/faircode/email/ActivityEML.java | 22 +++++++++++-------- app/src/main/res/layout/activity_eml.xml | 20 ++++++++++++++--- app/src/main/res/menu/menu_eml.xml | 6 ----- app/src/main/res/values/strings.xml | 5 ++++- 4 files changed, 34 insertions(+), 19 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/ActivityEML.java b/app/src/main/java/eu/faircode/email/ActivityEML.java index b17738d164..0175edf541 100644 --- a/app/src/main/java/eu/faircode/email/ActivityEML.java +++ b/app/src/main/java/eu/faircode/email/ActivityEML.java @@ -54,6 +54,7 @@ import androidx.preference.PreferenceManager; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; +import com.google.android.material.floatingactionbutton.FloatingActionButton; import com.google.android.material.snackbar.Snackbar; import com.sun.mail.imap.IMAPFolder; @@ -94,6 +95,7 @@ public class ActivityEML extends ActivityBase { private TextView tvHeaders; private TextView tvAuthentication; private ContentLoadingProgressBar pbWait; + private FloatingActionButton fabSave; private Group grpReady; private boolean draft; @@ -136,6 +138,7 @@ public class ActivityEML extends ActivityBase { tvHeaders = findViewById(R.id.tvHeaders); tvAuthentication = findViewById(R.id.tvAuthentication); pbWait = findViewById(R.id.pbWait); + fabSave = findViewById(R.id.fabSave); grpReady = findViewById(R.id.grpReady); rvAttachment.setHasFixedSize(false); @@ -211,6 +214,13 @@ public class ActivityEML extends ActivityBase { } }); + fabSave.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + onMenuSave(); + } + }); + // Initialize vSeparatorAttachments.setVisibility(View.GONE); grpReady.setVisibility(View.GONE); @@ -568,14 +578,11 @@ public class ActivityEML extends ActivityBase { .setChecked(junk); if (draft && BuildConfig.DEBUG) - menu.findItem(R.id.menu_save) - .setIcon(R.drawable.twotone_drafts_24); + fabSave.setImageResource(R.drawable.twotone_drafts_24); else if (junk && BuildConfig.DEBUG) - menu.findItem(R.id.menu_save) - .setIcon(R.drawable.twotone_report_24); + fabSave.setImageResource(R.drawable.twotone_report_24); else - menu.findItem(R.id.menu_save) - .setIcon(R.drawable.twotone_move_to_inbox_24); + fabSave.setImageResource(R.drawable.twotone_move_to_inbox_24); return super.onPrepareOptionsMenu(menu); } @@ -586,9 +593,6 @@ public class ActivityEML extends ActivityBase { if (itemId == android.R.id.home) { finish(); return true; - } else if (itemId == R.id.menu_save) { - onMenuSave(); - return true; } else if (itemId == R.id.menu_draft) { draft = !draft; if (draft) diff --git a/app/src/main/res/layout/activity_eml.xml b/app/src/main/res/layout/activity_eml.xml index f64aa1241e..ee482670dc 100644 --- a/app/src/main/res/layout/activity_eml.xml +++ b/app/src/main/res/layout/activity_eml.xml @@ -5,7 +5,7 @@ android:layout_height="match_parent" tools:context="eu.faircode.email.ActivityEML"> - + android:layout_height="wrap_content" + android:paddingBottom="90dp"> - + + + \ No newline at end of file diff --git a/app/src/main/res/menu/menu_eml.xml b/app/src/main/res/menu/menu_eml.xml index aa862b03c0..a5dc19597c 100644 --- a/app/src/main/res/menu/menu_eml.xml +++ b/app/src/main/res/menu/menu_eml.xml @@ -1,12 +1,6 @@ - - Spam filtering should be done by the email server and cannot be done reliably on a battery powered device with limited capabilities. By moving messages to and from the spam folder, the email server "learns" what spam is Long press for options - This is a summary of the content of a raw message file. Save the raw message with the save icon in the action bar to view all content. + + This is a summary of the contents of a raw message file. + You can use the bottom-right button to save the message to the inbox to view all content. + Open link Image link