fix wrong check for gap item

re sk22#898
This commit is contained in:
sk 2023-10-27 17:34:47 +02:00
parent a18a4383e5
commit 42c56401db
1 changed files with 4 additions and 2 deletions

View File

@ -193,10 +193,12 @@ public abstract class StatusListFragment extends BaseStatusListFragment<Status>
if(firstIndex==-1) return false; if(firstIndex==-1) return false;
int lastIndex=firstIndex; int lastIndex=firstIndex;
while(lastIndex<displayItems.size()){ while(lastIndex<displayItems.size()){
if(!displayItems.get(lastIndex).parentID.equals(parentID)) break; StatusDisplayItem item=displayItems.get(lastIndex);
if(!item.parentID.equals(parentID) || item instanceof GapStatusDisplayItem) break;
lastIndex++; lastIndex++;
} }
int count=lastIndex-firstIndex; int count=lastIndex-firstIndex;
if(count<1) return false;
displayItems.subList(firstIndex, lastIndex).clear(); displayItems.subList(firstIndex, lastIndex).clear();
adapter.notifyItemRangeRemoved(firstIndex, count); adapter.notifyItemRangeRemoved(firstIndex, count);
return true; return true;
@ -217,7 +219,7 @@ public abstract class StatusListFragment extends BaseStatusListFragment<Status>
StatusDisplayItem item=displayItems.get(i); StatusDisplayItem item=displayItems.get(i);
// we found a status that the to-be-removed status replies to! // we found a status that the to-be-removed status replies to!
// storing indices to maybe update its display items // storing indices to maybe update its display items
if(item.parentID.equals(status.inReplyToId) && !(item instanceof GapStatusDisplayItem)){ if(item.parentID.equals(status.inReplyToId)){
if(ancestorFirstIndex==-1) ancestorFirstIndex=i; if(ancestorFirstIndex==-1) ancestorFirstIndex=i;
ancestorLastIndex=i; ancestorLastIndex=i;
} }