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);
}
}
}

View File

@ -42,8 +42,8 @@
android:layout_height="wrap_content"
android:textAppearance="@style/m3_body_large"
android:singleLine="true"
android:ellipsize="end"
tools:text="Link title"/>
android:ellipsize="middle"
tools:text="07a9d88625a9d63d680f35baf040156e71ed87e5f068f14d332c0c5a83f7a939.webm"/>
<TextView
android:id="@+id/domain"

View File

@ -274,5 +274,4 @@
<string name="sk_settings_confirm_before_reblog">Vor dem Teilen bestätigen</string>
<string name="sk_reacted">hat reagiert</string>
<string name="sk_reacted_with">hat mit %s reagiert</string>
<string name="sk_attachment">Anhang</string>
</resources>

View File

@ -286,5 +286,4 @@
<string name="sk_settings_content_types_explanation">Allows setting a content type like Markdown when creating a post. Keep in mind that not all instances support this.</string>
<string name="sk_settings_default_content_type">Default content type</string>
<string name="sk_settings_default_content_type_explanation">This lets you have a content type be pre-selected when creating new posts, overriding the value set in “Posting preferences”.</string>
<string name="sk_attachment">Attachment</string>
</resources>