Image buttons for attachment save/download all

This commit is contained in:
M66B 2020-06-25 20:24:44 +02:00
parent ec17e2f3ca
commit c16069171f
2 changed files with 39 additions and 31 deletions

View File

@ -400,8 +400,8 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
private RecyclerView rvAttachment;
private CheckBox cbInline;
private Button btnSaveAttachments;
private Button btnDownloadAttachments;
private ImageButton ibSaveAttachments;
private ImageButton ibDownloadAttachments;
private TextView tvNoInternetAttachments;
private View vSeparator;
@ -603,8 +603,8 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
rvAttachment.setAdapter(adapterAttachment);
cbInline = attachments.findViewById(R.id.cbInline);
btnSaveAttachments = attachments.findViewById(R.id.btnSaveAttachments);
btnDownloadAttachments = attachments.findViewById(R.id.btnDownloadAttachments);
ibSaveAttachments = attachments.findViewById(R.id.ibSaveAttachments);
ibDownloadAttachments = attachments.findViewById(R.id.ibDownloadAttachments);
tvNoInternetAttachments = attachments.findViewById(R.id.tvNoInternetAttachments);
vSeparator = vsBody.findViewById(R.id.vSeparator);
@ -696,8 +696,8 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ibPinContact.setOnClickListener(this);
ibAddContact.setOnClickListener(this);
btnSaveAttachments.setOnClickListener(this);
btnDownloadAttachments.setOnClickListener(this);
ibSaveAttachments.setOnClickListener(this);
ibDownloadAttachments.setOnClickListener(this);
ibFull.setOnClickListener(this);
ibImages.setOnClickListener(this);
@ -784,8 +784,8 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ibPinContact.setOnClickListener(null);
ibAddContact.setOnClickListener(null);
btnSaveAttachments.setOnClickListener(null);
btnDownloadAttachments.setOnClickListener(null);
ibSaveAttachments.setOnClickListener(null);
ibDownloadAttachments.setOnClickListener(null);
ibFull.setOnClickListener(null);
ibImages.setOnClickListener(null);
@ -1285,8 +1285,8 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
clearCalendar();
cbInline.setVisibility(View.GONE);
btnSaveAttachments.setVisibility(View.GONE);
btnDownloadAttachments.setVisibility(View.GONE);
ibSaveAttachments.setVisibility(View.GONE);
ibDownloadAttachments.setVisibility(View.GONE);
tvNoInternetAttachments.setVisibility(View.GONE);
vSeparator.setVisibility(View.GONE);
@ -2346,8 +2346,8 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
cbInline.setChecked(show_inline);
cbInline.setVisibility(has_inline ? View.VISIBLE : View.GONE);
btnSaveAttachments.setVisibility(save ? View.VISIBLE : View.GONE);
btnDownloadAttachments.setVisibility(download && suitable ? View.VISIBLE : View.GONE);
ibSaveAttachments.setVisibility(save ? View.VISIBLE : View.GONE);
ibDownloadAttachments.setVisibility(download && suitable ? View.VISIBLE : View.GONE);
tvNoInternetAttachments.setVisibility(downloading && !suitable ? View.VISIBLE : View.GONE);
cbInline.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@ -2733,10 +2733,10 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
onToggleAddresses(message);
break;
case R.id.btnSaveAttachments:
case R.id.ibSaveAttachments:
onSaveAttachments(message);
break;
case R.id.btnDownloadAttachments:
case R.id.ibDownloadAttachments:
onDownloadAttachments(message);
break;

View File

@ -31,34 +31,42 @@
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:text="@string/title_show_inline"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintEnd_toStartOf="@+id/ibSaveAttachments"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/rvAttachment" />
<Button
android:id="@+id/btnSaveAttachments"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/title_save_all"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbInline" />
<ImageButton
android:id="@+id/ibSaveAttachments"
android:layout_width="36dp"
android:layout_height="36dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/title_save_all"
android:padding="6dp"
android:scaleType="fitCenter"
android:tooltipText="@string/title_save_all"
app:layout_constraintEnd_toStartOf="@id/ibDownloadAttachments"
app:layout_constraintTop_toBottomOf="@+id/rvAttachment"
app:srcCompat="@drawable/baseline_save_alt_24" />
<Button
android:id="@+id/btnDownloadAttachments"
style="?android:attr/buttonStyleSmall"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/title_download_all"
<ImageButton
android:id="@+id/ibDownloadAttachments"
android:layout_width="36dp"
android:layout_height="36dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/title_download_all"
android:padding="6dp"
android:scaleType="fitCenter"
android:tooltipText="@string/title_download_all"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/cbInline" />
app:layout_constraintTop_toBottomOf="@+id/rvAttachment"
app:srcCompat="@drawable/baseline_cloud_download_24" />
<androidx.constraintlayout.widget.Barrier
android:id="@+id/barrier_internet"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:barrierDirection="bottom"
app:constraint_referenced_ids="btnDownloadAttachments,btnSaveAttachments" />
app:constraint_referenced_ids="cbInline,ibSaveAttachments,ibDownloadAttachments" />
<eu.faircode.email.FixedTextView
android:id="@+id/tvNoInternetAttachments"