public class ImageLoaderModule extends NativeImageLoaderAndroidSpec implements LifecycleEventListener
NativeModule.NativeMethod
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
NAME |
METHOD_TYPE_ASYNC, METHOD_TYPE_PROMISE, METHOD_TYPE_SYNC
Constructor and Description |
---|
ImageLoaderModule(ReactApplicationContext reactContext) |
ImageLoaderModule(ReactApplicationContext reactContext,
java.lang.Object callerContext) |
Modifier and Type | Method and Description |
---|---|
void |
abortRequest(double requestId) |
java.lang.String |
getName() |
void |
getSize(java.lang.String uriString,
Promise promise)
Fetch the width and height of the given image.
|
void |
getSizeWithHeaders(java.lang.String uriString,
ReadableMap headers,
Promise promise)
Fetch the width and height of the given image with headers.
|
void |
onHostDestroy()
Called when host activity receives destroy event (e.g.
|
void |
onHostPause()
Called when host activity receives pause event (e.g.
|
void |
onHostResume()
Called either when the host activity receives a resume event (e.g.
|
void |
prefetchImage(java.lang.String uriString,
double requestIdAsDouble,
Promise promise)
Prefetches the given image to the Fresco image disk cache.
|
void |
queryCache(ReadableArray uris,
Promise promise) |
getCurrentActivity, getReactApplicationContext, getReactApplicationContextIfActiveOrWarn
canOverrideExistingModule, getConstants, hasConstants, initialize, invalidate, onCatalystInstanceDestroy
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
invalidate
public static final java.lang.String NAME
public ImageLoaderModule(ReactApplicationContext reactContext)
public ImageLoaderModule(ReactApplicationContext reactContext, java.lang.Object callerContext)
public java.lang.String getName()
getName
in interface NativeModule
require()
this module
from javascript.public void getSize(java.lang.String uriString, Promise promise)
getSize
in class NativeImageLoaderAndroidSpec
uriString
- the URI of the remote image to prefetchpromise
- the promise that is fulfilled when the image is successfully prefetched or
rejected when there is an errorpublic void getSizeWithHeaders(java.lang.String uriString, ReadableMap headers, Promise promise)
getSizeWithHeaders
in class NativeImageLoaderAndroidSpec
uriString
- the URI of the remote image to prefetchheaders
- headers send with the requestpromise
- the promise that is fulfilled when the image is successfully prefetched or
rejected when there is an errorpublic void prefetchImage(java.lang.String uriString, double requestIdAsDouble, Promise promise)
prefetchImage
in class NativeImageLoaderAndroidSpec
uriString
- the URI of the remote image to prefetchrequestIdAsDouble
- the client-supplied request ID used to identify this requestpromise
- the promise that is fulfilled when the image is successfully prefetched or
rejected when there is an errorpublic void abortRequest(double requestId)
abortRequest
in class NativeImageLoaderAndroidSpec
public void queryCache(ReadableArray uris, Promise promise)
queryCache
in class NativeImageLoaderAndroidSpec
public void onHostResume()
LifecycleEventListener
Activity#onResume
or
if the native module that implements this is initialized while the host activity is already
resumed. Always called for the most current activity.onHostResume
in interface LifecycleEventListener
public void onHostPause()
LifecycleEventListener
Activity#onPause
. Always called
for the most current activity.onHostPause
in interface LifecycleEventListener
public void onHostDestroy()
LifecycleEventListener
Activity#onDestroy
. Only called
for the last React activity to be destroyed.onHostDestroy
in interface LifecycleEventListener