Load more of the home timeline on scroll

This commit is contained in:
Grishka 2022-01-17 21:55:15 +03:00
parent b3a99e0764
commit 13665a11ca
1 changed files with 9 additions and 2 deletions

View File

@ -34,11 +34,18 @@ public class HomeTimelineFragment extends StatusListFragment{
@Override
protected void doLoadData(int offset, int count){
new GetHomeTimeline(null, null, count)
String maxID;
if(offset>0 && !preloadedData.isEmpty())
maxID=preloadedData.get(preloadedData.size()-1).id;
else if(offset>0 && !data.isEmpty())
maxID=data.get(data.size()-1).id;
else
maxID=null;
new GetHomeTimeline(maxID, null, count)
.setCallback(new SimpleCallback<>(this){
@Override
public void onSuccess(List<Status> result){
onDataLoaded(result, false);
onDataLoaded(result, !result.isEmpty());
}
})
.exec(accountID);