diff --git a/app/src/main/java/eu/faircode/email/AdapterAttachment.java b/app/src/main/java/eu/faircode/email/AdapterAttachment.java index 32429cac..394e66ec 100644 --- a/app/src/main/java/eu/faircode/email/AdapterAttachment.java +++ b/app/src/main/java/eu/faircode/email/AdapterAttachment.java @@ -108,7 +108,7 @@ public class AdapterAttachment extends RecyclerView.Adapter 0) grpAttachments.setVisibility(View.VISIBLE); @@ -230,14 +233,15 @@ public class FragmentCompose extends FragmentEx { setHasOptionsMenu(true); // Initialize - spFrom.setEnabled(false); - //grpFrom.setVisibility(View.GONE); + grpHeader.setVisibility(View.GONE); grpAddresses.setVisibility(View.GONE); grpAttachments.setVisibility(View.GONE); - grpReady.setVisibility(View.GONE); + grpMessage.setVisibility(View.GONE); pbWait.setVisibility(View.VISIBLE); - Helper.setViewsEnabled(view, false); + getActivity().invalidateOptionsMenu(); + spFrom.setEnabled(false); + Helper.setViewsEnabled(view, false); if (ContextCompat.checkSelfPermission(getContext(), Manifest.permission.READ_CONTACTS) == PackageManager.PERMISSION_GRANTED) { @@ -347,7 +351,7 @@ public class FragmentCompose extends FragmentEx { @Override public void onPrepareOptionsMenu(Menu menu) { super.onPrepareOptionsMenu(menu); - menu.findItem(R.id.menu_attachment).setVisible(working >= 0); + menu.findItem(R.id.menu_attachment).setVisible(!free && working >= 0); menu.findItem(R.id.menu_attachment).setEnabled(etBody.isEnabled()); menu.findItem(R.id.menu_addresses).setVisible(!free && working >= 0); } @@ -678,11 +682,6 @@ public class FragmentCompose extends FragmentEx { String action = getArguments().getString("action"); Log.i(Helper.TAG, "Loaded draft id=" + draft.id + " action=" + action); - getActivity().invalidateOptionsMenu(); - pbWait.setVisibility(View.GONE); - grpAddresses.setVisibility("reply_all".equals(action) ? View.VISIBLE : View.GONE); - grpReady.setVisibility(View.VISIBLE); - etTo.setText(draft.to == null ? null : TextUtils.join(", ", draft.to)); etCc.setText(draft.cc == null ? null : TextUtils.join(", ", draft.cc)); etBcc.setText(draft.bcc == null ? null : TextUtils.join(", ", draft.bcc)); @@ -690,15 +689,20 @@ public class FragmentCompose extends FragmentEx { etBody.setText(TextUtils.isEmpty(draft.body) ? null : Html.fromHtml(draft.body)); + getActivity().invalidateOptionsMenu(); + Helper.setViewsEnabled(view, true); + + pbWait.setVisibility(View.GONE); + grpHeader.setVisibility(View.VISIBLE); + grpAddresses.setVisibility("reply_all".equals(action) ? View.VISIBLE : View.GONE); + grpMessage.setVisibility(View.VISIBLE); + if ("reply".equals(action) || "reply_all".equals(action)) { etBody.requestFocus(); etBody.setSelection(0); } else if ("forward".equals(action)) etTo.requestFocus(); - Helper.setViewsEnabled(view, true); - getActivity().invalidateOptionsMenu(); - DB db = DB.getInstance(getContext()); db.identity().liveIdentities(true).removeObservers(getViewLifecycleOwner()); @@ -756,7 +760,6 @@ public class FragmentCompose extends FragmentEx { } spFrom.setEnabled(true); - //grpFrom.setVisibility(View.VISIBLE); } }); diff --git a/app/src/main/java/eu/faircode/email/FragmentMessage.java b/app/src/main/java/eu/faircode/email/FragmentMessage.java index 0ad68ee0..014c7572 100644 --- a/app/src/main/java/eu/faircode/email/FragmentMessage.java +++ b/app/src/main/java/eu/faircode/email/FragmentMessage.java @@ -84,10 +84,10 @@ public class FragmentMessage extends FragmentEx { private FloatingActionButton fab; private BottomNavigationView bottom_navigation; private ProgressBar pbWait; - private Group grpReady; private Group grpHeader; private Group grpAddresses; private Group grpAttachments; + private Group grpMessage; private boolean free = false; private AdapterAttachment adapter; @@ -121,10 +121,10 @@ public class FragmentMessage extends FragmentEx { fab = view.findViewById(R.id.fab); bottom_navigation = view.findViewById(R.id.bottom_navigation); pbWait = view.findViewById(R.id.pbWait); - grpReady = view.findViewById(R.id.grpReady); grpHeader = view.findViewById(R.id.grpHeader); grpAddresses = view.findViewById(R.id.grpAddresses); grpAttachments = view.findViewById(R.id.grpAttachments); + grpMessage = view.findViewById(R.id.grpMessage); setHasOptionsMenu(true); @@ -200,6 +200,8 @@ public class FragmentMessage extends FragmentEx { }); fab.setOnClickListener(new View.OnClickListener() { + private boolean addresses; + @Override public void onClick(View view) { free = (top_navigation.getVisibility() != View.GONE); @@ -207,10 +209,13 @@ public class FragmentMessage extends FragmentEx { grpHeader.setVisibility(free ? View.GONE : View.VISIBLE); if (free) { fab.setImageResource(R.drawable.baseline_fullscreen_exit_24); + addresses = (grpAddresses.getVisibility() != View.GONE); grpAddresses.setVisibility(View.GONE); grpAttachments.setVisibility(View.GONE); } else { fab.setImageResource(R.drawable.baseline_fullscreen_24); + if (addresses) + grpAddresses.setVisibility(View.VISIBLE); if (rvAttachment.getAdapter().getItemCount() > 0) grpAttachments.setVisibility(View.VISIBLE); } @@ -242,12 +247,12 @@ public class FragmentMessage extends FragmentEx { }); // Initialize + grpHeader.setVisibility(View.GONE); grpAddresses.setVisibility(View.GONE); grpAttachments.setVisibility(View.GONE); + grpMessage.setVisibility(View.GONE); + tvCount.setVisibility(View.GONE); tvError.setVisibility(View.GONE); - top_navigation.setVisibility(View.GONE); - bottom_navigation.setVisibility(View.GONE); - grpReady.setVisibility(View.GONE); pbWait.setVisibility(View.VISIBLE); rvAttachment.setHasFixedSize(false); @@ -287,7 +292,6 @@ public class FragmentMessage extends FragmentEx { tvSubject.setText(message.subject); tvCount.setText(Integer.toString(message.count)); - tvCount.setVisibility(message.count > 1 ? View.VISIBLE : View.GONE); tvReplyTo.setText(message.reply == null ? null : MessageHelper.getFormattedAddresses(message.reply, true)); tvCc.setText(message.cc == null ? null : MessageHelper.getFormattedAddresses(message.cc, true)); @@ -305,7 +309,6 @@ public class FragmentMessage extends FragmentEx { tvTime.setTextColor(colorUnseen); tvError.setText(message.error); - tvError.setVisibility(message.error == null ? View.GONE : View.VISIBLE); MenuItem actionSeen = top_navigation.getMenu().findItem(R.id.action_seen); actionSeen.setIcon(message.ui_seen @@ -368,7 +371,10 @@ public class FragmentMessage extends FragmentEx { } pbWait.setVisibility(View.GONE); - grpReady.setVisibility(View.VISIBLE); + grpHeader.setVisibility(View.VISIBLE); + grpMessage.setVisibility(View.VISIBLE); + tvCount.setVisibility(message.count > 1 ? View.VISIBLE : View.GONE); + tvError.setVisibility(message.error == null ? View.GONE : View.VISIBLE); } }); @@ -412,8 +418,7 @@ public class FragmentMessage extends FragmentEx { } private void onMenuAddresses() { - if (grpReady.getVisibility() == View.VISIBLE) - grpAddresses.setVisibility(grpAddresses.getVisibility() == View.GONE ? View.VISIBLE : View.GONE); + grpAddresses.setVisibility(grpAddresses.getVisibility() == View.GONE ? View.VISIBLE : View.GONE); } private void onActionThread(long id) { diff --git a/app/src/main/res/layout/fragment_compose.xml b/app/src/main/res/layout/fragment_compose.xml index 48a980a0..224de3b6 100644 --- a/app/src/main/res/layout/fragment_compose.xml +++ b/app/src/main/res/layout/fragment_compose.xml @@ -133,7 +133,7 @@ android:scrollbars="vertical" app:layout_constrainedHeight="true" app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintHeight_max="150dp" + app:layout_constraintHeight_max="90dp" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/vSeparatorAttachments" /> @@ -194,12 +194,6 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> - - + + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_message.xml b/app/src/main/res/layout/fragment_message.xml index 8606459d..4abc502f 100644 --- a/app/src/main/res/layout/fragment_message.xml +++ b/app/src/main/res/layout/fragment_message.xml @@ -180,7 +180,7 @@ android:scrollbars="vertical" app:layout_constrainedHeight="true" app:layout_constraintEnd_toEndOf="parent" - app:layout_constraintHeight_max="150dp" + app:layout_constraintHeight_max="90dp" app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/vSeparatorAttachments" /> @@ -270,17 +270,11 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> - - + app:constraint_referenced_ids="tvFrom,tvToTitle,tvTo,tvTime,tvSubject,top_navigation" /> + +