Support opening unknown attachment types via openLink
(#2044)
* Support opening unknown attachment types via openLink. #1970 * Fix label text for unknown attachment types
This commit is contained in:
parent
cb2296f248
commit
baa915a0a3
7 changed files with 22 additions and 16 deletions
|
@ -533,7 +533,6 @@ public abstract class StatusBaseViewHolder extends RecyclerView.ViewHolder {
|
|||
@DrawableRes
|
||||
private static int getLabelIcon(Attachment.Type type) {
|
||||
switch (type) {
|
||||
default:
|
||||
case IMAGE:
|
||||
return R.drawable.ic_photo_24dp;
|
||||
case GIFV:
|
||||
|
@ -541,6 +540,8 @@ public abstract class StatusBaseViewHolder extends RecyclerView.ViewHolder {
|
|||
return R.drawable.ic_videocam_24dp;
|
||||
case AUDIO:
|
||||
return R.drawable.ic_music_box_24dp;
|
||||
default:
|
||||
return R.drawable.ic_attach_file_24dp;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -718,7 +719,7 @@ public abstract class StatusBaseViewHolder extends RecyclerView.ViewHolder {
|
|||
setBookmarked(status.isBookmarked());
|
||||
List<Attachment> attachments = status.getAttachments();
|
||||
boolean sensitive = status.isSensitive();
|
||||
if (statusDisplayOptions.mediaPreviewEnabled() && !hasAudioAttachment(attachments)) {
|
||||
if (statusDisplayOptions.mediaPreviewEnabled() && hasPreviewableAttachment(attachments)) {
|
||||
setMediaPreviews(attachments, sensitive, listener, status.isShowingContent(), statusDisplayOptions.useBlurhash());
|
||||
|
||||
if (attachments.size() == 0) {
|
||||
|
@ -767,13 +768,13 @@ public abstract class StatusBaseViewHolder extends RecyclerView.ViewHolder {
|
|||
}
|
||||
}
|
||||
|
||||
protected static boolean hasAudioAttachment(List<Attachment> attachments) {
|
||||
protected static boolean hasPreviewableAttachment(List<Attachment> attachments) {
|
||||
for (Attachment attachment : attachments) {
|
||||
if (attachment.getType() == Attachment.Type.AUDIO) {
|
||||
return true;
|
||||
if (attachment.getType() == Attachment.Type.AUDIO || attachment.getType() == Attachment.Type.UNKNOWN) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
private void setDescriptionForStatus(@NonNull StatusViewData.Concrete status,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue