Composer: show number of attachments

master
M66B 5 days ago
parent 5791edf3a1
commit 9d5f798637

@ -260,6 +260,7 @@ public class FragmentCompose extends FragmentBase {
private ImageButton ibCcBcc; private ImageButton ibCcBcc;
private ImageButton ibRemoveAttachments; private ImageButton ibRemoveAttachments;
private ImageButton ibExpanderAttachments; private ImageButton ibExpanderAttachments;
private TextView tvAttachments;
private RecyclerView rvAttachment; private RecyclerView rvAttachment;
private TextView tvNoInternetAttachments; private TextView tvNoInternetAttachments;
private TextView tvDsn; private TextView tvDsn;
@ -423,6 +424,7 @@ public class FragmentCompose extends FragmentBase {
ibCcBcc = view.findViewById(R.id.ibCcBcc); ibCcBcc = view.findViewById(R.id.ibCcBcc);
ibRemoveAttachments = view.findViewById(R.id.ibRemoveAttachments); ibRemoveAttachments = view.findViewById(R.id.ibRemoveAttachments);
ibExpanderAttachments = view.findViewById(R.id.ibExpanderAttachments); ibExpanderAttachments = view.findViewById(R.id.ibExpanderAttachments);
tvAttachments = view.findViewById(R.id.tvAttachments);
rvAttachment = view.findViewById(R.id.rvAttachment); rvAttachment = view.findViewById(R.id.rvAttachment);
tvNoInternetAttachments = view.findViewById(R.id.tvNoInternetAttachments); tvNoInternetAttachments = view.findViewById(R.id.tvNoInternetAttachments);
tvDsn = view.findViewById(R.id.tvDsn); tvDsn = view.findViewById(R.id.tvDsn);
@ -1534,6 +1536,8 @@ public class FragmentCompose extends FragmentBase {
} }
}); });
tvAttachments.setVisibility(View.GONE);
rvAttachment.setHasFixedSize(false); rvAttachment.setHasFixedSize(false);
LinearLayoutManager llm = new LinearLayoutManager(getContext()); LinearLayoutManager llm = new LinearLayoutManager(getContext());
rvAttachment.setLayoutManager(llm); rvAttachment.setLayoutManager(llm);
@ -6754,6 +6758,9 @@ public class FragmentCompose extends FragmentBase {
ibRemoveAttachments.setVisibility(attachments.size() > 2 && !hide_attachments ? View.VISIBLE : View.GONE); ibRemoveAttachments.setVisibility(attachments.size() > 2 && !hide_attachments ? View.VISIBLE : View.GONE);
ibExpanderAttachments.setVisibility(attachments.size() > 1 ? View.VISIBLE : View.GONE); ibExpanderAttachments.setVisibility(attachments.size() > 1 ? View.VISIBLE : View.GONE);
ibExpanderAttachments.setImageLevel(hide_attachments ? 1 /* more */ : 0 /* less */); ibExpanderAttachments.setImageLevel(hide_attachments ? 1 /* more */ : 0 /* less */);
tvAttachments.setText(getResources()
.getQuantityString(R.plurals.title_attachments, attachments.size(), attachments.size()));
tvAttachments.setVisibility(attachments.size() > 0 && hide_attachments ? View.VISIBLE : View.GONE);
grpAttachments.setVisibility(attachments.size() > 0 ? View.VISIBLE : View.GONE); grpAttachments.setVisibility(attachments.size() > 0 ? View.VISIBLE : View.GONE);
boolean downloading = false; boolean downloading = false;

@ -278,13 +278,25 @@
app:layout_constraintTop_toBottomOf="@id/vSeparatorAttachments" app:layout_constraintTop_toBottomOf="@id/vSeparatorAttachments"
app:srcCompat="@drawable/expander" /> app:srcCompat="@drawable/expander" />
<TextView
android:id="@+id/tvAttachments"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="6dp"
android:layout_marginEnd="6dp"
android:text="10 attachments"
android:textAppearance="@style/TextAppearance.AppCompat.Small"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/ibExpanderAttachments" />
<eu.faircode.email.FixedRecyclerView <eu.faircode.email.FixedRecyclerView
android:id="@+id/rvAttachment" android:id="@+id/rvAttachment"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/ibExpanderAttachments" app:layout_constraintTop_toBottomOf="@+id/tvAttachments"
app:layout_goneMarginTop="6dp" /> app:layout_goneMarginTop="6dp" />
<TextView <TextView

Loading…
Cancel
Save