Added infra button click

This commit is contained in:
M66B 2021-11-10 17:12:12 +01:00
parent f4c605335c
commit db01e409d7
3 changed files with 33 additions and 9 deletions

View File

@ -457,7 +457,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
private TextView tvNoInternetBody;
private ImageButton ibDownloading;
private Group grpDownloading;
private ImageView ivInfrastructure;
private ImageButton ibInfrastructure;
private ImageButton ibTrashBottom;
private ImageButton ibArchiveBottom;
private ImageButton ibMoveBottom;
@ -836,7 +836,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
tvNoInternetBody = vsBody.findViewById(R.id.tvNoInternetBody);
ibDownloading = vsBody.findViewById(R.id.ibDownloading);
grpDownloading = vsBody.findViewById(R.id.grpDownloading);
ivInfrastructure = vsBody.findViewById(R.id.ivInfrastructure);
ibInfrastructure = vsBody.findViewById(R.id.ibInfrastructure);
ibTrashBottom = vsBody.findViewById(R.id.ibTrashBottom);
ibArchiveBottom = vsBody.findViewById(R.id.ibArchiveBottom);
ibMoveBottom = vsBody.findViewById(R.id.ibMoveBottom);
@ -951,6 +951,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ibTools.setOnClickListener(this);
ibDownloading.setOnClickListener(this);
ibInfrastructure.setOnClickListener(this);
ibTrashBottom.setOnClickListener(this);
ibTrashBottom.setOnLongClickListener(this);
ibArchiveBottom.setOnClickListener(this);
@ -1048,6 +1049,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
ibTools.setOnClickListener(null);
ibDownloading.setOnClickListener(null);
ibInfrastructure.setOnClickListener(null);
ibTrashBottom.setOnClickListener(null);
ibTrashBottom.setOnLongClickListener(null);
ibArchiveBottom.setOnClickListener(null);
@ -1578,7 +1580,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
pbBody.setVisibility(View.GONE);
grpAction.setVisibility(View.GONE);
clearActions();
ivInfrastructure.setVisibility(View.GONE);
ibInfrastructure.setVisibility(View.GONE);
ibTrashBottom.setVisibility(View.GONE);
ibArchiveBottom.setVisibility(View.GONE);
ibMoveBottom.setVisibility(View.GONE);
@ -1834,7 +1836,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
grpAction.setVisibility(View.GONE);
clearActions();
ivInfrastructure.setVisibility(View.GONE);
ibInfrastructure.setVisibility(View.GONE);
ibTrashBottom.setVisibility(View.GONE);
ibArchiveBottom.setVisibility(View.GONE);
ibMoveBottom.setVisibility(View.GONE);
@ -2880,8 +2882,8 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
.getIdentifier(resname, "drawable", context.getPackageName());
}
if (resid != 0)
ivInfrastructure.setImageResource(resid);
ivInfrastructure.setVisibility(resid != 0 ? View.VISIBLE : View.GONE);
ibInfrastructure.setImageResource(resid);
ibInfrastructure.setVisibility(resid != 0 ? View.VISIBLE : View.GONE);
ibTrashBottom.setVisibility(ibTrash.getVisibility());
ibArchiveBottom.setVisibility(ibArchive.getVisibility());
@ -3474,6 +3476,8 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
onActionJunk(message);
} else if (id == R.id.ibInbox) {
onActionInbox(message);
} else if (id == R.id.ibInfrastructure) {
onActionShowInfra(message);
} else if (id == R.id.ibMore) {
onActionMore(message);
} else if (id == R.id.ibTools) {
@ -4863,6 +4867,14 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
popupMenu.show();
}
private void onActionShowInfra(TupleMessageEx message) {
String resname = "infra_" + message.infrastructure;
int resid = context.getResources()
.getIdentifier(resname, "string", context.getPackageName());
String infra = (resid < 0 ? message.infrastructure : context.getString(resid));
ToastEx.makeText(context, infra, Toast.LENGTH_LONG).show();
}
private boolean onOpenLink(Uri uri, String title, boolean always_confirm) {
Log.i("Opening uri=" + uri + " title=" + title);
uri = Uri.parse(uri.toString().replaceAll("\\s+", ""));

View File

@ -114,11 +114,13 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvBody" />
<ImageView
android:id="@+id/ivInfrastructure"
<ImageButton
android:id="@+id/ibInfrastructure"
android:layout_width="36dp"
android:layout_height="36dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:padding="6dp"
android:scaleType="fitCenter"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/wvBody"
app:srcCompat="@drawable/infra_awsses" />
@ -132,7 +134,7 @@
android:contentDescription="@string/title_trash"
android:padding="6dp"
android:scaleType="fitCenter"
app:layout_constraintStart_toEndOf="@id/ivInfrastructure"
app:layout_constraintStart_toEndOf="@id/ibInfrastructure"
app:layout_constraintTop_toBottomOf="@id/wvBody"
app:srcCompat="@drawable/twotone_delete_24"
app:tint="?attr/colorAccent" />

View File

@ -1806,6 +1806,16 @@
<string name="title_accessibility_from">Sender</string>
<string name="title_accessibility_to">Recipient</string>
<string name="infra_awsses" translatable="false">Amazon SES</string>
<string name="infra_mailchimp" translatable="false">Mailchimp</string>
<string name="infra_mailgun" translatable="false">Mailgun</string>
<string name="infra_mailjet" translatable="false">Mailjet</string>
<string name="infra_mandrill" translatable="false">Mandrill</string>
<string name="infra_postmark" translatable="false">Postmark</string>
<string name="infra_salesforce" translatable="false">Salesforce</string>
<string name="infra_sendgrid" translatable="false">SendGrid</string>
<string name="infra_sendinblue" translatable="false">Sendinblue</string>
<string-array name="pollIntervalNames">
<item>Always</item>
<item>Every 5 minutes</item>