Skip to content

Commit

Permalink
merge discover posts fragment
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuel Kaiser committed Jan 13, 2024
1 parent bb96e20 commit ace3e4e
Showing 1 changed file with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

public class DiscoverPostsFragment extends StatusListFragment{
private DiscoverInfoBannerHelper bannerHelper;
private int offset;
private int realOffset=0;

@Override
public void onCreate(Bundle savedInstanceState){
Expand All @@ -27,17 +27,14 @@ public void onCreate(Bundle savedInstanceState){
}

@Override
protected void doLoadData(int o, int count){
if(refreshing) offset=0;
currentRequest=new GetTrendingStatuses(offset, count)
protected void doLoadData(int offset, int count){
currentRequest=new GetTrendingStatuses(offset==0 ? 0 : realOffset, count)
.setCallback(new SimpleCallback<>(this){
@Override
public void onSuccess(List<Status> result){
if(getActivity()==null) return;
boolean empty=result.isEmpty();
offset+=result.size();
AccountSessionManager.get(accountID).filterStatuses(result, getFilterContext());
onDataLoaded(result, !empty);
realOffset+=result.size();
AccountSessionManager.get(accountID).filterStatuses(result, FilterContext.PUBLIC);
onDataLoaded(result, !result.isEmpty());
bannerHelper.onBannerBecameVisible();
}
}).exec(accountID);
Expand Down

0 comments on commit ace3e4e

Please sign in to comment.