diff --git a/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/GapStatusDisplayItem.java b/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/GapStatusDisplayItem.java index ee4764a92..96c2366ae 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/GapStatusDisplayItem.java +++ b/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/GapStatusDisplayItem.java @@ -8,6 +8,7 @@ import android.widget.TextView; import org.joinmastodon.android.R; import org.joinmastodon.android.fragments.BaseStatusListFragment; +import org.joinmastodon.android.fragments.StatusListFragment; import org.joinmastodon.android.model.Status; import org.joinmastodon.android.ui.drawables.SawtoothTearDrawable; import org.joinmastodon.android.ui.utils.UiUtils; @@ -63,7 +64,12 @@ public class GapStatusDisplayItem extends StatusDisplayItem{ } top.setClickable(!item.loading); bottom.setClickable(!item.loading); - StatusDisplayItem next=getNextVisibleDisplayItem().orElse(null); + StatusDisplayItem next=getNextVisibleDisplayItem(i->{ + if(!(item.parentFragment instanceof StatusListFragment)) return false; + Status s=((StatusListFragment) item.parentFragment).getStatusByID(i.parentID); + return s!=null && !s.fromStatusCreated; + }).orElse(null); + bottom.setVisibility(next==null ? View.GONE : View.VISIBLE); Instant dateBelow=next instanceof HeaderStatusDisplayItem h ? h.status.createdAt : next instanceof ReblogOrReplyLineStatusDisplayItem l ? l.status.createdAt : null; diff --git a/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/StatusDisplayItem.java b/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/StatusDisplayItem.java index 71bfdf54f..c4cf28ab5 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/StatusDisplayItem.java +++ b/mastodon/src/main/java/org/joinmastodon/android/ui/displayitems/StatusDisplayItem.java @@ -45,6 +45,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.Optional; +import java.util.function.Predicate; import java.util.stream.Collectors; import me.grishka.appkit.Nav; @@ -384,12 +385,14 @@ public abstract class StatusDisplayItem{ } public Optional getNextVisibleDisplayItem(){ + return getNextVisibleDisplayItem(null); + } + public Optional getNextVisibleDisplayItem(Predicate predicate){ Optional next=getNextDisplayItem(); for(int offset=1; next.isPresent(); next=getDisplayItemOffset(++offset)){ - if(!next.map(n-> - (n instanceof EmojiReactionsStatusDisplayItem e && e.isHidden()) || - (n instanceof DummyStatusDisplayItem) - ).orElse(false)) return next; + boolean isHidden=next.map(n->(n instanceof EmojiReactionsStatusDisplayItem e && e.isHidden()) + || (n instanceof DummyStatusDisplayItem)).orElse(false); + if(!isHidden && (predicate==null || predicate.test(next.get()))) return next; } return Optional.empty(); }