1
0
Fork 0
mirror of https://github.com/M66B/FairEmail.git synced 2024-12-21 23:32:51 +00:00

EML: use floating action button

This commit is contained in:
M66B 2024-12-19 08:59:14 +01:00
parent 4670c11dfe
commit 0aa295b899
4 changed files with 34 additions and 19 deletions

View file

@ -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)

View file

@ -5,7 +5,7 @@
android:layout_height="match_parent"
tools:context="eu.faircode.email.ActivityEML">
<ScrollView
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
@ -17,7 +17,8 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:paddingBottom="90dp">
<TextView
android:id="@+id/tvHint"
@ -356,7 +357,7 @@
android:layout_height="0dp"
app:constraint_referenced_ids="cardMessage,cardStructure" />
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>
</androidx.core.widget.NestedScrollView>
<eu.faircode.email.ContentLoadingProgressBar
android:id="@+id/pbWait"
@ -368,4 +369,17 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fabSave"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
android:layout_margin="@dimen/fab_padding"
android:contentDescription="@string/title_save"
app:backgroundTint="?attr/colorFabBackground"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:srcCompat="@drawable/twotone_move_to_inbox_24"
app:tint="?attr/colorFabForeground" />
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -1,12 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
android:id="@+id/menu_save"
android:icon="@drawable/twotone_move_to_inbox_24"
android:title="@string/title_save"
app:showAsAction="always" />
<item
android:id="@+id/menu_draft"
android:checkable="true"

View file

@ -2352,7 +2352,10 @@
<string name="title_hint_junk">Spam filtering should be done by the email server and cannot be done reliably on a battery powered device with limited capabilities.</string>
<string name="title_hint_junk_learn">By moving messages to and from the spam folder, the email server "learns" what spam is</string>
<string name="title_hint_contact_actions">Long press for options</string>
<string name="title_hint_eml">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.</string>
<string name="title_hint_eml">
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.
</string>
<string name="title_open_link">Open link</string>
<string name="title_image_link">Image link</string>