From 7ce50487529077952174c13a8796627d7cda4b38 Mon Sep 17 00:00:00 2001 From: Nik Clayton Date: Thu, 4 May 2023 16:00:30 +0200 Subject: [PATCH] Show the requester's bio in a "wants to follow you" notification (#3284) --- .../tusky/adapter/FollowRequestViewHolder.kt | 13 ++++-- app/src/main/res/layout/item_follow.xml | 1 + .../main/res/layout/item_follow_request.xml | 43 ++++++++++++------- 3 files changed, 38 insertions(+), 19 deletions(-) diff --git a/app/src/main/java/com/keylesspalace/tusky/adapter/FollowRequestViewHolder.kt b/app/src/main/java/com/keylesspalace/tusky/adapter/FollowRequestViewHolder.kt index b12b7170..a428ba3c 100644 --- a/app/src/main/java/com/keylesspalace/tusky/adapter/FollowRequestViewHolder.kt +++ b/app/src/main/java/com/keylesspalace/tusky/adapter/FollowRequestViewHolder.kt @@ -27,7 +27,9 @@ import com.keylesspalace.tusky.entity.TimelineAccount import com.keylesspalace.tusky.interfaces.AccountActionListener import com.keylesspalace.tusky.util.StatusDisplayOptions import com.keylesspalace.tusky.util.emojify +import com.keylesspalace.tusky.util.hide import com.keylesspalace.tusky.util.loadAvatar +import com.keylesspalace.tusky.util.parseAsMastodonHtml import com.keylesspalace.tusky.util.unicodeWrap import com.keylesspalace.tusky.util.visible import com.keylesspalace.tusky.viewdata.NotificationViewData @@ -87,9 +89,14 @@ class FollowRequestViewHolder( binding.notificationTextView.visible(showHeader) val formattedUsername = itemView.context.getString(R.string.post_username_format, account.username) binding.usernameTextView.text = formattedUsername - val avatarRadius = binding.avatar.context.resources.getDimensionPixelSize( - R.dimen.avatar_radius_48dp - ) + if (account.note.isEmpty()) { + binding.accountNote.hide() + } else { + binding.accountNote.text = + account.note.parseAsMastodonHtml() + .emojify(account.emojis, binding.accountNote, animateEmojis) + } + val avatarRadius = binding.avatar.context.resources.getDimensionPixelSize(R.dimen.avatar_radius_48dp) loadAvatar(account.avatar, binding.avatar, avatarRadius, animateAvatar) binding.avatarBadge.visible(showBotOverlay && account.bot) } diff --git a/app/src/main/res/layout/item_follow.xml b/app/src/main/res/layout/item_follow.xml index bbd2b4e6..762ad8aa 100644 --- a/app/src/main/res/layout/item_follow.xml +++ b/app/src/main/res/layout/item_follow.xml @@ -74,6 +74,7 @@ android:layout_height="wrap_content" android:layout_marginTop="7dp" android:hyphenationFrequency="full" + android:lineSpacingMultiplier="1.1" android:textSize="?attr/status_text_medium" android:textIsSelectable="true" app:layout_constrainedWidth="true" diff --git a/app/src/main/res/layout/item_follow_request.xml b/app/src/main/res/layout/item_follow_request.xml index c0c8df97..bb0cc162 100644 --- a/app/src/main/res/layout/item_follow_request.xml +++ b/app/src/main/res/layout/item_follow_request.xml @@ -4,8 +4,9 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="wrap_content" - android:paddingStart="16dp" - android:paddingBottom="10dp"> + android:paddingStart="?android:attr/listPreferredItemPaddingStart" + android:paddingEnd="?android:attr/listPreferredItemPaddingEnd" + android:paddingBottom="8dp"> + tools:text="Someone requested to follow you" + tools:ignore="RtlSymmetry" /> @@ -80,7 +81,6 @@ style="@style/TuskyImageButton" android:layout_width="52dp" android:layout_height="48dp" - android:layout_centerVertical="true" android:layout_marginStart="12dp" android:background="?attr/selectableItemBackgroundBorderless" android:contentDescription="@string/action_reject" @@ -88,7 +88,7 @@ app:layout_constraintBottom_toBottomOf="@id/avatar" app:layout_constraintEnd_toStartOf="@id/acceptButton" app:layout_constraintStart_toEndOf="@id/displayNameTextView" - app:layout_constraintTop_toTopOf="@id/avatar" + app:layout_constraintTop_toBottomOf="@+id/notificationTextView" app:srcCompat="@drawable/ic_reject_24dp" /> + +