fix gap time being wrong when next status is own
closes sk22#902
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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<StatusDisplayItem> getNextVisibleDisplayItem(){
|
||||
return getNextVisibleDisplayItem(null);
|
||||
}
|
||||
public Optional<StatusDisplayItem> getNextVisibleDisplayItem(Predicate<StatusDisplayItem> predicate){
|
||||
Optional<StatusDisplayItem> 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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user