39 lines
1.1 KiB
Java
39 lines
1.1 KiB
Java
package app.fedilab.fedilabtube.asynctasks;
|
|
|
|
import android.content.Context;
|
|
import android.os.AsyncTask;
|
|
|
|
import java.lang.ref.WeakReference;
|
|
|
|
import app.fedilab.fedilabtube.client.HttpsConnection;
|
|
import app.fedilab.fedilabtube.client.PeertubeAPI;
|
|
import app.fedilab.fedilabtube.client.entities.PeertubeInformation;
|
|
|
|
|
|
public class RetrievePeertubeInformationAsyncTask extends AsyncTask<Void, Void, Void> {
|
|
|
|
|
|
public static PeertubeInformation peertubeInformation;
|
|
private WeakReference<Context> contextReference;
|
|
|
|
|
|
public RetrievePeertubeInformationAsyncTask(Context context) {
|
|
this.contextReference = new WeakReference<>(context);
|
|
}
|
|
|
|
@Override
|
|
protected Void doInBackground(Void... params) {
|
|
PeertubeAPI peertubeAPI = new PeertubeAPI(this.contextReference.get());
|
|
try {
|
|
peertubeInformation = peertubeAPI.getPeertubeInformation();
|
|
} catch (HttpsConnection.HttpsConnectionException e) {
|
|
e.printStackTrace();
|
|
}
|
|
return null;
|
|
}
|
|
|
|
@Override
|
|
protected void onPostExecute(Void result) {
|
|
}
|
|
}
|