Search in sources :

Example 1 with Synthetic

use of com.bumptech.glide.util.Synthetic in project glide by bumptech.

the class EngineJob method handleResultOnMainThread.

@Synthetic
void handleResultOnMainThread() {
    stateVerifier.throwIfRecycled();
    if (isCancelled) {
        resource.recycle();
        release(false);
        return;
    } else if (cbs.isEmpty()) {
        throw new IllegalStateException("Received a resource without any callbacks to notify");
    } else if (hasResource) {
        throw new IllegalStateException("Already have resource");
    }
    engineResource = engineResourceFactory.build(resource, isCacheable);
    hasResource = true;
    // Hold on to resource for duration of request so we don't recycle it in the middle of
    // notifying if it synchronously released by one of the callbacks.
    engineResource.acquire();
    listener.onEngineJobComplete(key, engineResource);
    for (ResourceCallback cb : cbs) {
        if (!isInIgnoredCallbacks(cb)) {
            engineResource.acquire();
            cb.onResourceReady(engineResource, dataSource);
        }
    }
    // Our request is complete, so we can release the resource.
    engineResource.release();
    release(false);
}
Also used : ResourceCallback(com.bumptech.glide.request.ResourceCallback) Synthetic(com.bumptech.glide.util.Synthetic)

Example 2 with Synthetic

use of com.bumptech.glide.util.Synthetic in project glide by bumptech.

the class DefaultConnectivityMonitor method isConnected.

@Synthetic
boolean isConnected(Context context) {
    ConnectivityManager connectivityManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
    NetworkInfo networkInfo = connectivityManager.getActiveNetworkInfo();
    return networkInfo != null && networkInfo.isConnected();
}
Also used : NetworkInfo(android.net.NetworkInfo) ConnectivityManager(android.net.ConnectivityManager) Synthetic(com.bumptech.glide.util.Synthetic)

Example 3 with Synthetic

use of com.bumptech.glide.util.Synthetic in project glide by bumptech.

the class EngineJob method handleExceptionOnMainThread.

@Synthetic
void handleExceptionOnMainThread() {
    stateVerifier.throwIfRecycled();
    if (isCancelled) {
        release(false);
        return;
    } else if (cbs.isEmpty()) {
        throw new IllegalStateException("Received an exception without any callbacks to notify");
    } else if (hasLoadFailed) {
        throw new IllegalStateException("Already failed once");
    }
    hasLoadFailed = true;
    listener.onEngineJobComplete(key, null);
    for (ResourceCallback cb : cbs) {
        if (!isInIgnoredCallbacks(cb)) {
            cb.onLoadFailed(exception);
        }
    }
    release(false);
}
Also used : ResourceCallback(com.bumptech.glide.request.ResourceCallback) Synthetic(com.bumptech.glide.util.Synthetic)

Aggregations

Synthetic (com.bumptech.glide.util.Synthetic)3 ResourceCallback (com.bumptech.glide.request.ResourceCallback)2 ConnectivityManager (android.net.ConnectivityManager)1 NetworkInfo (android.net.NetworkInfo)1