Search in sources :

Example 1 with OkHttpBaseApi

use of de.geeksfactory.opacclient.apis.OkHttpBaseApi in project opacclient by opacapp.

the class CoverDownloadTask method getImage.

protected byte[] getImage() throws IOException {
    try {
        OpacApi api = ((OpacClient) context.getApplicationContext()).getApi();
        if (api instanceof ApacheBaseApi) {
            return getImageApacheClient(((ApacheBaseApi) api).http_client);
        } else if (api instanceof OkHttpBaseApi) {
            return getImageOkHttpClient(((OkHttpBaseApi) api).http_client);
        }
    } catch (OpacClient.LibraryRemovedException e) {
    }
    HttpClient httpClient;
    httpClient = new AndroidHttpClientFactory().getNewApacheHttpClient(false, true, false, false);
    return getImageApacheClient(httpClient);
}
Also used : OpacClient(de.geeksfactory.opacclient.OpacClient) OkHttpBaseApi(de.geeksfactory.opacclient.apis.OkHttpBaseApi) AndroidHttpClient(android.net.http.AndroidHttpClient) OkHttpClient(okhttp3.OkHttpClient) HttpClient(org.apache.http.client.HttpClient) OpacApi(de.geeksfactory.opacclient.apis.OpacApi) ApacheBaseApi(de.geeksfactory.opacclient.apis.ApacheBaseApi)

Aggregations

AndroidHttpClient (android.net.http.AndroidHttpClient)1 OpacClient (de.geeksfactory.opacclient.OpacClient)1 ApacheBaseApi (de.geeksfactory.opacclient.apis.ApacheBaseApi)1 OkHttpBaseApi (de.geeksfactory.opacclient.apis.OkHttpBaseApi)1 OpacApi (de.geeksfactory.opacclient.apis.OpacApi)1 OkHttpClient (okhttp3.OkHttpClient)1 HttpClient (org.apache.http.client.HttpClient)1