Paginate trending posts

This commit is contained in:
Grishka 2023-01-15 11:09:53 +03:00 committed by LucasGGamerM
parent 096aa23f69
commit d06cf1bb1e
2 changed files with 5 additions and 3 deletions

View File

@ -8,9 +8,11 @@ import org.joinmastodon.android.model.Status;
import java.util.List;
public class GetTrendingStatuses extends MastodonAPIRequest<List<Status>>{
public GetTrendingStatuses(int limit){
public GetTrendingStatuses(int offset, int limit){
super(HttpMethod.GET, "/trends/statuses", new TypeToken<>(){});
if(limit>0)
addQueryParameter("limit", ""+limit);
if(offset>0)
addQueryParameter("offset", ""+offset);
}
}

View File

@ -17,11 +17,11 @@ public class DiscoverPostsFragment extends StatusListFragment{
@Override
protected void doLoadData(int offset, int count){
currentRequest=new GetTrendingStatuses(count)
currentRequest=new GetTrendingStatuses(offset, count)
.setCallback(new SimpleCallback<>(this){
@Override
public void onSuccess(List<Status> result){
onDataLoaded(result, false);
onDataLoaded(result, !result.isEmpty());
}
}).exec(accountID);
}