From e5549654de4598aa02d7c761fe9dd80393fb6d07 Mon Sep 17 00:00:00 2001 From: M66B Date: Mon, 22 Oct 2018 13:14:46 +0000 Subject: [PATCH] Removed distraction free writing mode --- README.md | 3 +- .../eu/faircode/email/FragmentCompose.java | 74 ++----------------- 2 files changed, 9 insertions(+), 68 deletions(-) diff --git a/README.md b/README.md index baa071f8..7c5af342 100644 --- a/README.md +++ b/README.md @@ -23,8 +23,7 @@ This app starts a foreground service with a low priority status bar notification * Multiple accounts (inboxes) * Multiple identities (outboxes) * Unified inbox -* Message threading -* Distraction free writing +* Conversation view * Two way synchronization * Offline storage and operations * Battery friendly diff --git a/app/src/main/java/eu/faircode/email/FragmentCompose.java b/app/src/main/java/eu/faircode/email/FragmentCompose.java index ae942d70..f21af57a 100644 --- a/app/src/main/java/eu/faircode/email/FragmentCompose.java +++ b/app/src/main/java/eu/faircode/email/FragmentCompose.java @@ -20,7 +20,6 @@ package eu.faircode.email; */ import android.Manifest; -import android.app.Activity; import android.content.ClipboardManager; import android.content.Context; import android.content.DialogInterface; @@ -45,7 +44,6 @@ import android.text.style.StyleSpan; import android.text.style.URLSpan; import android.text.style.UnderlineSpan; import android.util.Log; -import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuInflater; @@ -119,8 +117,6 @@ public class FragmentCompose extends FragmentEx { private AdapterAttachment adapter; private long working = -1; - private boolean free = false; - private boolean addresses; private boolean autosave = false; @Override @@ -189,58 +185,6 @@ public class FragmentCompose extends FragmentEx { } }); - etBody.setOnFocusChangeListener(new View.OnFocusChangeListener() { - @Override - public void onFocusChange(View view, boolean hasFocus) { - free = hasFocus; - - Activity activity = getActivity(); - if (activity != null) - activity.invalidateOptionsMenu(); - - grpHeader.setVisibility(hasFocus ? View.GONE : View.VISIBLE); - if (hasFocus) { - addresses = (grpAddresses.getVisibility() != View.GONE); - grpAddresses.setVisibility(View.GONE); - grpAttachments.setVisibility(View.GONE); - } - } - }); - - etBody.setOnKeyListener(new View.OnKeyListener() { - @Override - public boolean onKey(View view, int keyCode, KeyEvent event) { - if (event.getAction() == KeyEvent.ACTION_DOWN) { - switch (keyCode) { - case KeyEvent.KEYCODE_BACK: - if (grpHeader.getVisibility() == View.GONE) { - free = false; - - Activity activity = getActivity(); - if (activity != null) - activity.invalidateOptionsMenu(); - - grpHeader.setVisibility(View.VISIBLE); - if (addresses) - grpAddresses.setVisibility(View.VISIBLE); - if (rvAttachment.getAdapter().getItemCount() > 0) - grpAttachments.setVisibility(View.VISIBLE); - - new Handler().post(new Runnable() { - @Override - public void run() { - etTo.requestFocus(); - } - }); - - return true; - } - } - } - return false; - } - }); - bottom_navigation.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() { @Override public boolean onNavigationItemSelected(@NonNull MenuItem item) { @@ -425,13 +369,13 @@ public class FragmentCompose extends FragmentEx { @Override public void onPrepareOptionsMenu(Menu menu) { super.onPrepareOptionsMenu(menu); - menu.findItem(R.id.menu_bold).setVisible(free && working >= 0); - menu.findItem(R.id.menu_italic).setVisible(free && working >= 0); - menu.findItem(R.id.menu_link).setVisible(free && working >= 0); - menu.findItem(R.id.menu_image).setVisible(free && working >= 0); - menu.findItem(R.id.menu_attachment).setVisible(!free && working >= 0); + menu.findItem(R.id.menu_bold).setVisible(working >= 0); + menu.findItem(R.id.menu_italic).setVisible(working >= 0); + menu.findItem(R.id.menu_link).setVisible(working >= 0); + menu.findItem(R.id.menu_image).setVisible(working >= 0); + menu.findItem(R.id.menu_attachment).setVisible(working >= 0); menu.findItem(R.id.menu_attachment).setEnabled(etBody.isEnabled()); - menu.findItem(R.id.menu_addresses).setVisible(!free && working >= 0); + menu.findItem(R.id.menu_addresses).setVisible(working >= 0); PackageManager pm = getContext().getPackageManager(); menu.findItem(R.id.menu_image).setEnabled(getImageIntent().resolveActivity(pm) != null); @@ -1130,7 +1074,7 @@ public class FragmentCompose extends FragmentEx { attachments = new ArrayList<>(); adapter.set(attachments); - grpAttachments.setVisibility(!free && attachments.size() > 0 ? View.VISIBLE : View.GONE); + grpAttachments.setVisibility(attachments.size() > 0 ? View.VISIBLE : View.GONE); } }); @@ -1139,10 +1083,8 @@ public class FragmentCompose extends FragmentEx { @Override public void onChanged(final EntityMessage draft) { // Draft was deleted - if (draft == null || draft.ui_hide) { + if (draft == null || draft.ui_hide) finish(); - return; - } } }); }