refactor(preview-quote-toots): make the updateStatusWithQuote generic, and also readd the notification support
The notification support is needed because of the post notifications, which would benefit from this
This commit is contained in:
parent
96ccb14a59
commit
113b47d9e2
|
@ -706,12 +706,12 @@ public abstract class BaseStatusListFragment<T extends DisplayItemsParent> exten
|
||||||
toggleSpoiler(status, isForQuote, holder.getItemID());
|
toggleSpoiler(status, isForQuote, holder.getItemID());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateStatusWithQuote(Status status) {
|
public void updateStatusWithQuote(DisplayItemsParent parent) {
|
||||||
int startIndex=-1;
|
int startIndex=-1;
|
||||||
int endIndex=-1;
|
int endIndex=-1;
|
||||||
for(int i=0; i<displayItems.size(); i++){
|
for(int i=0; i<displayItems.size(); i++){
|
||||||
StatusDisplayItem item = displayItems.get(i);
|
StatusDisplayItem item = displayItems.get(i);
|
||||||
if(item.parentID.equals(status.id)) {
|
if(item.parentID.equals(parent.getID())) {
|
||||||
startIndex= startIndex==-1 ? i : startIndex;
|
startIndex= startIndex==-1 ? i : startIndex;
|
||||||
endIndex=i;
|
endIndex=i;
|
||||||
}
|
}
|
||||||
|
@ -719,8 +719,8 @@ public abstract class BaseStatusListFragment<T extends DisplayItemsParent> exten
|
||||||
|
|
||||||
if (startIndex!=-1 && endIndex!=-1) {
|
if (startIndex!=-1 && endIndex!=-1) {
|
||||||
//Only StatusListFragments can display Status/Quotes
|
//Only StatusListFragments can display Status/Quotes
|
||||||
assert this instanceof StatusListFragment;
|
assert (this instanceof StatusListFragment) || (this instanceof NotificationsListFragment);
|
||||||
List<StatusDisplayItem> items=((StatusListFragment) this).buildDisplayItems(status);
|
List<StatusDisplayItem> items=this.buildDisplayItems((T) parent);
|
||||||
displayItems.subList(startIndex, endIndex+1).clear();
|
displayItems.subList(startIndex, endIndex+1).clear();
|
||||||
boolean isEmpty=displayItems.isEmpty();
|
boolean isEmpty=displayItems.isEmpty();
|
||||||
displayItems.addAll(startIndex, items);
|
displayItems.addAll(startIndex, items);
|
||||||
|
|
Loading…
Reference in New Issue