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

View File

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