From c10d7cfee451c3331b414fcf2aeca9eb9f542dee Mon Sep 17 00:00:00 2001 From: sk Date: Sat, 27 May 2023 01:32:49 +0200 Subject: [PATCH] use remote url; file name as fallback for alt text --- .../ui/displayitems/FileStatusDisplayItem.java | 12 +++++++----- mastodon/src/main/res/layout/display_item_file.xml | 4 ++-- mastodon/src/main/res/values-de-rDE/strings_sk.xml | 1 - mastodon/src/main/res/values/strings_sk.xml | 1 - 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/FileStatusDisplayItem.java b/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/FileStatusDisplayItem.java index 1d460a3e9..dd33e03ad 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/FileStatusDisplayItem.java +++ b/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/FileStatusDisplayItem.java @@ -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); } } } diff --git a/mastodon/src/main/res/layout/display_item_file.xml b/mastodon/src/main/res/layout/display_item_file.xml index e428abf26..1001aeac6 100644 --- a/mastodon/src/main/res/layout/display_item_file.xml +++ b/mastodon/src/main/res/layout/display_item_file.xml @@ -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"/> Vor dem Teilen bestätigen hat reagiert hat mit %s reagiert - Anhang \ No newline at end of file diff --git a/mastodon/src/main/res/values/strings_sk.xml b/mastodon/src/main/res/values/strings_sk.xml index cafbe7de6..6eae86635 100644 --- a/mastodon/src/main/res/values/strings_sk.xml +++ b/mastodon/src/main/res/values/strings_sk.xml @@ -286,5 +286,4 @@ Allows setting a content type like Markdown when creating a post. Keep in mind that not all instances support this. Default content type This lets you have a content type be pre-selected when creating new posts, overriding the value set in “Posting preferences”. - Attachment \ No newline at end of file