Basic status rendering

This commit is contained in:
Grishka
2022-01-17 13:27:34 +03:00
parent 42d5f52ff5
commit dfbc1fd2e2
41 changed files with 1735 additions and 17 deletions

View File

@@ -60,6 +60,8 @@ public class MastodonAPIController{
public <T> void submitRequest(final MastodonAPIRequest<T> req){
thread.postRunnable(()->{
try{
if(req.canceled)
return;
Request.Builder builder=new Request.Builder()
.url(req.getURL().toString())
.method(req.getMethod(), req.getRequestBody())

View File

@@ -32,6 +32,7 @@ public abstract class MastodonAPIRequest<T> extends APIRequest<T>{
TypeToken<T> respTypeToken;
Call okhttpCall;
Token token;
boolean canceled;
public MastodonAPIRequest(HttpMethod method, String path, Class<T> respClass){
this.path=path;
@@ -47,6 +48,7 @@ public abstract class MastodonAPIRequest<T> extends APIRequest<T>{
@Override
public synchronized void cancel(){
canceled=true;
if(okhttpCall!=null){
okhttpCall.cancel();
}

View File

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

View File

@@ -159,6 +159,7 @@ public class AccountSessionManager{
.build();
new CustomTabsIntent.Builder()
.setShareState(CustomTabsIntent.SHARE_STATE_OFF)
.build()
.launchUrl(context, uri);
}