From eacfd2fa4f7e3df7ae008675a2e946d791f33e95 Mon Sep 17 00:00:00 2001 From: Grishka Date: Fri, 23 Feb 2024 20:00:35 +0300 Subject: [PATCH] AND-125 --- .../android/fragments/ProfileFragment.java | 24 +++++++++++++++---- mastodon/src/main/res/menu/profile.xml | 21 ++++++++++------ mastodon/src/main/res/values/strings.xml | 9 +++---- mastodon/src/main/res/values/styles.xml | 6 +++++ 4 files changed, 44 insertions(+), 16 deletions(-) diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/ProfileFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/ProfileFragment.java index fbc28991..fb6bf864 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/ProfileFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/ProfileFragment.java @@ -18,8 +18,11 @@ import android.graphics.drawable.LayerDrawable; import android.net.Uri; import android.os.Build; import android.os.Bundle; +import android.text.SpannableString; import android.text.SpannableStringBuilder; +import android.text.SpannedString; import android.text.TextUtils; +import android.text.style.ForegroundColorSpan; import android.text.style.ImageSpan; import android.transition.ChangeBounds; import android.transition.Fade; @@ -596,6 +599,13 @@ public class ProfileFragment extends LoaderFragment implements OnBackPressedList } } + private CharSequence makeRedString(CharSequence s){ + int color=UiUtils.getThemeColor(getActivity(), R.attr.colorM3Error); + SpannableString ss=new SpannableString(s); + ss.setSpan(new ForegroundColorSpan(color), 0, ss.length(), 0); + return ss; + } + @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater){ if(isOwnProfile && isInEditMode){ @@ -612,18 +622,22 @@ public class ProfileFragment extends LoaderFragment implements OnBackPressedList if(isOwnProfile) return; - menu.findItem(R.id.mute).setTitle(getString(relationship.muting ? R.string.unmute_user : R.string.mute_user, account.displayName)); - menu.findItem(R.id.block).setTitle(getString(relationship.blocking ? R.string.unblock_user : R.string.block_user, account.displayName)); - menu.findItem(R.id.report).setTitle(getString(R.string.report_user, account.displayName)); + menu.findItem(R.id.mute).setTitle(getString(relationship.muting ? R.string.unmute_user : R.string.mute_user, account.getDisplayUsername())); + menu.findItem(R.id.block).setTitle(makeRedString(getString(relationship.blocking ? R.string.unblock_user : R.string.block_user, account.getDisplayUsername()))); + menu.findItem(R.id.report).setTitle(makeRedString(getString(R.string.report_user, account.getDisplayUsername()))); if(relationship.following) - menu.findItem(R.id.hide_boosts).setTitle(getString(relationship.showingReblogs ? R.string.hide_boosts_from_user : R.string.show_boosts_from_user, account.displayName)); + menu.findItem(R.id.hide_boosts).setTitle(getString(relationship.showingReblogs ? R.string.hide_boosts_from_user : R.string.show_boosts_from_user)); else menu.findItem(R.id.hide_boosts).setVisible(false); if(!account.isLocal()) - menu.findItem(R.id.block_domain).setTitle(getString(relationship.domainBlocking ? R.string.unblock_domain : R.string.block_domain, account.getDomain())); + menu.findItem(R.id.block_domain).setTitle(makeRedString(getString(relationship.domainBlocking ? R.string.unblock_domain : R.string.block_domain, account.getDomain()))); else menu.findItem(R.id.block_domain).setVisible(false); menu.findItem(R.id.add_to_list).setVisible(relationship.following); + + if(Build.VERSION.SDK_INT>=Build.VERSION_CODES.P){ + menu.setGroupDividerEnabled(true); + } } @Override diff --git a/mastodon/src/main/res/menu/profile.xml b/mastodon/src/main/res/menu/profile.xml index d35e329f..2321e239 100644 --- a/mastodon/src/main/res/menu/profile.xml +++ b/mastodon/src/main/res/menu/profile.xml @@ -1,13 +1,20 @@ - + - - - - - - + + + + + + + + + + + + + \ No newline at end of file diff --git a/mastodon/src/main/res/values/strings.xml b/mastodon/src/main/res/values/strings.xml index a48d813b..adedf985 100644 --- a/mastodon/src/main/res/values/strings.xml +++ b/mastodon/src/main/res/values/strings.xml @@ -42,7 +42,7 @@ Follow Following Edit profile - Share profile + Share profile via… Mute %s Unmute %s Block %s @@ -223,8 +223,8 @@ You’re now following %s Requested to follow %s Open in browser - Hide boosts from %s - Show boosts from %s + Hide boosts + Show boosts Why do you want to join? This will help us review your application. Clear @@ -604,7 +604,7 @@ Remove Add member Search among people you follow - Add to list… + Add/remove from lists… Add to list Manage the lists %s appears on @@ -709,4 +709,5 @@ View %s on Mastodon %1$s on Mastodon: “%2$s” + Copy link to profile \ No newline at end of file diff --git a/mastodon/src/main/res/values/styles.xml b/mastodon/src/main/res/values/styles.xml index c5b03526..6b5121b6 100644 --- a/mastodon/src/main/res/values/styles.xml +++ b/mastodon/src/main/res/values/styles.xml @@ -68,6 +68,7 @@ #a6ffffff ?colorM3OnSurface ?colorM3OnSurfaceVariant + @style/popup_menu_item_text + + \ No newline at end of file