From 06b85c916e230b4d83e72e5fabee1dffde312c75 Mon Sep 17 00:00:00 2001 From: M66B Date: Tue, 30 Apr 2019 09:14:42 +0200 Subject: [PATCH] Hide undo/redo when not applicable --- .../java/eu/faircode/email/FragmentCompose.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentCompose.java b/app/src/main/java/eu/faircode/email/FragmentCompose.java index 341d17db32..bc2a23176c 100644 --- a/app/src/main/java/eu/faircode/email/FragmentCompose.java +++ b/app/src/main/java/eu/faircode/email/FragmentCompose.java @@ -2237,8 +2237,8 @@ public class FragmentCompose extends FragmentBase { grpHeader.setVisibility(View.VISIBLE); grpAddresses.setVisibility("reply_all".equals(action) ? View.VISIBLE : View.GONE); - bottom_navigation.getMenu().findItem(R.id.action_undo).setEnabled(draft.revision != null && draft.revision > 1); - bottom_navigation.getMenu().findItem(R.id.action_redo).setEnabled(draft.revision != null && !draft.revision.equals(draft.revisions)); + bottom_navigation.getMenu().findItem(R.id.action_undo).setVisible(draft.revision != null && draft.revision > 1); + bottom_navigation.getMenu().findItem(R.id.action_redo).setVisible(draft.revision != null && !draft.revision.equals(draft.revisions)); getActivity().invalidateOptionsMenu(); @@ -2683,8 +2683,8 @@ public class FragmentCompose extends FragmentBase { etCc.setText(MessageHelper.formatAddressesCompose(draft.cc)); etBcc.setText(MessageHelper.formatAddressesCompose(draft.bcc)); - bottom_navigation.getMenu().findItem(R.id.action_undo).setEnabled(draft.revision != null && draft.revision > 1); - bottom_navigation.getMenu().findItem(R.id.action_redo).setEnabled(draft.revision != null && !draft.revision.equals(draft.revisions)); + bottom_navigation.getMenu().findItem(R.id.action_undo).setVisible(draft.revision != null && draft.revision > 1); + bottom_navigation.getMenu().findItem(R.id.action_redo).setVisible(draft.revision != null && !draft.revision.equals(draft.revisions)); if (action == R.id.action_delete) { autosave = false; @@ -2788,10 +2788,11 @@ public class FragmentCompose extends FragmentBase { pbWait.setVisibility(View.GONE); edit_bar.setVisibility(style ? View.VISIBLE : View.GONE); + bottom_navigation.getMenu().findItem(R.id.action_undo).setVisible(draft.revision != null && draft.revision > 1); + bottom_navigation.getMenu().findItem(R.id.action_redo).setVisible(draft.revision != null && !draft.revision.equals(draft.revisions)); bottom_navigation.setVisibility(View.VISIBLE); + Helper.setViewsEnabled(view, true); - bottom_navigation.getMenu().findItem(R.id.action_undo).setEnabled(draft.revision != null && draft.revision > 1); - bottom_navigation.getMenu().findItem(R.id.action_redo).setEnabled(draft.revision != null && !draft.revision.equals(draft.revisions)); getActivity().invalidateOptionsMenu(); }