Trending statuses

This commit is contained in:
Grishka 2022-02-07 15:44:00 +03:00
parent aa193b8921
commit 1f4611bc4e
2 changed files with 34 additions and 8 deletions

View File

@ -0,0 +1,20 @@
package org.joinmastodon.android.api.requests.trends;
import com.google.gson.reflect.TypeToken;
import org.joinmastodon.android.api.MastodonAPIRequest;
import org.joinmastodon.android.model.Status;
import java.util.List;
public class GetTrendingStatuses extends MastodonAPIRequest<List<Status>>{
public GetTrendingStatuses(String maxID, String minID, int limit){
super(HttpMethod.GET, "/trends/statuses", new TypeToken<>(){});
if(maxID!=null)
addQueryParameter("max_id", maxID);
if(minID!=null)
addQueryParameter("min_id", minID);
if(limit>0)
addQueryParameter("limit", ""+limit);
}
}

View File

@ -1,15 +1,21 @@
package org.joinmastodon.android.fragments;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import org.joinmastodon.android.api.requests.trends.GetTrendingStatuses;
import org.joinmastodon.android.model.Status;
import me.grishka.appkit.fragments.ToolbarFragment;
import java.util.List;
public class SearchFragment extends ToolbarFragment{
import me.grishka.appkit.api.SimpleCallback;
public class SearchFragment extends StatusListFragment{
@Override
public View onCreateContentView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){
return new View(getActivity());
protected void doLoadData(int offset, int count){
currentRequest=new GetTrendingStatuses(offset>0 ? getMaxID() : null, null, count)
.setCallback(new SimpleCallback<>(this){
@Override
public void onSuccess(List<Status> result){
onDataLoaded(result, !result.isEmpty());
}
}).exec(accountID);
}
}