Added warning for dangerous files

This commit is contained in:
M66B
2022-09-17 22:03:53 +02:00
parent 9dee5e793b
commit 35e495cec1
5 changed files with 76 additions and 18 deletions

View File

@@ -78,6 +78,8 @@ public class AdapterAttachment extends RecyclerView.Adapter<AdapterAttachment.Vi
private boolean debug;
private int dp12;
private int dp36;
private int textColorTertiary;
private int colorWarning;
private List<EntityAttachment> items = new ArrayList<>();
@@ -167,7 +169,10 @@ public class AdapterAttachment extends RecyclerView.Adapter<AdapterAttachment.Vi
? View.VISIBLE : View.INVISIBLE);
}
boolean dangerous = Helper.DANGEROUS_EXTENSIONS.contains(Helper.getExtension(attachment.name));
tvName.setText(attachment.name);
tvName.setTextColor(dangerous ? colorWarning : textColorTertiary);
tvName.setTypeface(null, dangerous ? Typeface.BOLD : Typeface.NORMAL);
if (attachment.size != null)
tvSize.setText(Helper.humanReadableByteCount(attachment.size));
@@ -422,6 +427,8 @@ public class AdapterAttachment extends RecyclerView.Adapter<AdapterAttachment.Vi
this.debug = prefs.getBoolean("debug", false);
this.dp12 = Helper.dp2pixels(context, 12);
this.dp36 = Helper.dp2pixels(context, 36);
this.textColorTertiary = Helper.resolveColor(context, android.R.attr.textColorTertiary);
this.colorWarning = Helper.resolveColor(context, R.attr.colorWarning);
setHasStableIds(true);