use remote url; file name as fallback for alt text

This commit is contained in:
sk
2023-05-27 01:32:49 +02:00
parent f933bdbc53
commit c10d7cfee4
4 changed files with 9 additions and 9 deletions

View File

@@ -44,14 +44,16 @@ public class FileStatusDisplayItem extends StatusDisplayItem{
@Override
public void onBind(FileStatusDisplayItem item) {
title.setText(item.attachment.description == null
? title.getContext().getText(R.string.sk_attachment)
: item.attachment.description);
domain.setText(Uri.parse(item.attachment.url).getHost());
Uri url = Uri.parse(item.attachment.remoteUrl);
title.setText(item.attachment.description != null
? item.attachment.description
: url.getLastPathSegment());
title.setEllipsize(item.attachment.description != null ? TextUtils.TruncateAt.END : TextUtils.TruncateAt.MIDDLE);
domain.setText(url.getHost());
}
private void onClick(View v) {
UiUtils.openURL(itemView.getContext(), item.parentFragment.getAccountID(), item.attachment.url);
UiUtils.openURL(itemView.getContext(), item.parentFragment.getAccountID(), item.attachment.remoteUrl);
}
}
}