Merge pull request #454 from FineFindus/fix/quote-improvements

feat: quote improvements
This commit is contained in:
LucasGGamerM 2024-07-06 19:40:29 -03:00 committed by GitHub
commit 96ccb14a59
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 9 deletions

View File

@ -718,10 +718,14 @@ public abstract class BaseStatusListFragment<T extends DisplayItemsParent> exten
}
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());
}
}

View File

@ -338,7 +338,7 @@ public abstract class StatusDisplayItem{
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){
@ -431,12 +431,8 @@ public abstract class StatusDisplayItem{
@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);
}
}