From 6c1424055fc86e2dfcb94f51c8fb26c23ade3b9a Mon Sep 17 00:00:00 2001 From: FineFindus <63370021+FineFindus@users.noreply.github.com> Date: Mon, 9 Jan 2023 21:02:00 +0100 Subject: [PATCH] feat(StatusDisplay): add toolTip/ContentDescription to visibilty icon --- .../ui/displayitems/ExtendedFooterStatusDisplayItem.java | 6 ++++++ .../java/org/joinmastodon/android/ui/utils/UiUtils.java | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/ExtendedFooterStatusDisplayItem.java b/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/ExtendedFooterStatusDisplayItem.java index ed50eb4c1..060b43819 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/ExtendedFooterStatusDisplayItem.java +++ b/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/ExtendedFooterStatusDisplayItem.java @@ -2,6 +2,7 @@ package org.joinmastodon.android.ui.displayitems; import android.annotation.SuppressLint; import android.content.Context; +import android.os.Build; import android.os.Bundle; import android.text.SpannableStringBuilder; import android.text.TextUtils; @@ -100,6 +101,11 @@ public class ExtendedFooterStatusDisplayItem extends StatusDisplayItem{ case PRIVATE -> R.drawable.ic_fluent_people_checkmark_20_regular; case DIRECT -> R.drawable.ic_fluent_mention_24_regular; }); + + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + visibility.setTooltipText(UiUtils.getVisibilityText(s)); + } + visibility.setContentDescription(UiUtils.getVisibilityText(s)); } @Override diff --git a/mastodon/src/main/java/org/joinmastodon/android/ui/utils/UiUtils.java b/mastodon/src/main/java/org/joinmastodon/android/ui/utils/UiUtils.java index de9843a35..b889ae2b0 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/ui/utils/UiUtils.java +++ b/mastodon/src/main/java/org/joinmastodon/android/ui/utils/UiUtils.java @@ -1004,4 +1004,13 @@ public class UiUtils{ return false; } } + + public static String getVisibilityText(Status status) { + return MastodonApp.context.getString(switch (status.visibility) { + case PUBLIC -> R.string.visibility_public; + case UNLISTED -> R.string.sk_visibility_unlisted; + case PRIVATE -> R.string.visibility_followers_only; + case DIRECT -> R.string.visibility_private; + }); + } }