Skip to content

Commit

Permalink
Merge pull request #454 from FineFindus/fix/quote-improvements
Browse files Browse the repository at this point in the history
feat: quote improvements
  • Loading branch information
LucasGGamerM authored Jul 6, 2024
2 parents bff6ac4 + bc8b0e1 commit 96ccb14
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -718,10 +718,14 @@ public void updateStatusWithQuote(Status status) {
}

if (startIndex!=-1 && endIndex!=-1) {
ArrayList<StatusDisplayItem> items=StatusDisplayItem.buildItems(this, status, accountID, status, knownAccounts, null, 0);
//Only StatusListFragments can display Status/Quotes
assert this instanceof StatusListFragment;
List<StatusDisplayItem> items=((StatusListFragment) this).buildDisplayItems(status);
displayItems.subList(startIndex, endIndex+1).clear();
boolean isEmpty=displayItems.isEmpty();
displayItems.addAll(startIndex, items);
adapter.notifyItemRangeChanged(startIndex, items.size());
if(!isEmpty)
adapter.notifyItemRangeChanged(startIndex, items.size());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ public static ArrayList<StatusDisplayItem> buildItems(BaseStatusListFragment<?>
if(!statusForContent.mediaAttachments.isEmpty() && statusForContent.poll==null) // add spacing if immediately preceded by attachment
contentItems.add(new DummyStatusDisplayItem(parentID, fragment));
contentItems.addAll(buildItems(fragment, statusForContent.quote, accountID, parentObject, knownAccounts, filterContext, FLAG_NO_FOOTER|FLAG_INSET|FLAG_NO_EMOJI_REACTIONS|FLAG_IS_FOR_QUOTE));
} else {
} else if((flags & FLAG_INSET)==0){
tryAddNonOfficialQuote(statusForContent, fragment, accountID);
}
if(contentItems!=items && statusForContent.spoilerRevealed){
Expand Down Expand Up @@ -431,12 +431,8 @@ private static void tryAddNonOfficialQuote(Status status, BaseStatusListFragment
@Override
public void onSuccess(SearchResults results){
if (!results.statuses.isEmpty()){
Status quote=results.statuses.get(0);
// don't show self-referential quotes
if(!Objects.equals(status.id, results.statuses.get(0).id)){
status.quote=quote;
fragment.updateStatusWithQuote(status);
}
status.quote=results.statuses.get(0);
fragment.updateStatusWithQuote(status);
}
}

Expand Down

0 comments on commit 96ccb14

Please sign in to comment.