From 0f728093427742916f1d92d2882a070b628efe4d Mon Sep 17 00:00:00 2001 From: sk Date: Thu, 24 Aug 2023 13:15:53 +0200 Subject: [PATCH] scroll to existing reaction when adding --- .../EmojiReactionsStatusDisplayItem.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/EmojiReactionsStatusDisplayItem.java b/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/EmojiReactionsStatusDisplayItem.java index 9f5830c7b..fd0eb2b80 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/EmojiReactionsStatusDisplayItem.java +++ b/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/EmojiReactionsStatusDisplayItem.java @@ -17,6 +17,7 @@ import android.widget.ProgressBar; import androidx.annotation.NonNull; import androidx.recyclerview.widget.LinearLayoutManager; +import androidx.recyclerview.widget.LinearSmoothScroller; import androidx.recyclerview.widget.RecyclerView; import org.joinmastodon.android.E; @@ -43,6 +44,8 @@ import org.joinmastodon.android.ui.utils.TextDrawable; import org.joinmastodon.android.ui.utils.UiUtils; import org.joinmastodon.android.ui.views.ProgressBarButton; +import java.util.Optional; + import me.grishka.appkit.Nav; import me.grishka.appkit.api.Callback; import me.grishka.appkit.api.ErrorResponse; @@ -216,7 +219,16 @@ public class EmojiReactionsStatusDisplayItem extends StatusDisplayItem { } private void addEmojiReaction(String emoji, Emoji info) { - if(item.status.reactions.stream().filter(r->r.name.equals(emoji) && r.me).findAny().isPresent()) return; + for(int i=0; i