LynxMediaResourceFetcher is defined inside LynxEngine and injected from outside to implement the path redirection capability of Image and other third-party resources.
public abstract class LynxMediaResourceFetcher { public abstract String shouldRedirectUrl(LynxResourceRequest request); /** * Quick check for a local path. * * @param url input path * @return * TRUE if is a local path; * FALSE if not a local path; * UNDEFINED if not sure; */ public OptionalBool isLocalResource(String url) { return OptionalBool.UNDEFINED; } /** * fetch Image Drawable directly. * * @param request * @param callback Response with the needed drawable. */ public void fetchImage(LynxResourceRequest request, LynxResourceCallback<Closeable> callback) {}}
@protocol LynxMediaResourceFetcher <NSObject>@required- (NSString* _Nonnull)shouldRedirectUrl:(LynxResourceRequest* _Nonnull)request;/** * Quick check for a local path. * * @param url input path * @return TRUE if is a local path; FALSE if not a local path */@optional- (LynxResourceOptionalBool)isLocalResource:(NSURL* _Nonnull)url;/** * fetch UIImage directly. * * @param request * @param callback Response with the needed uiImage. * * @return A block which can cancel the image request if it is not finished. nil if cancel action is * not supported. */@optional- (dispatch_block_t)fetchUIImage:(LynxResourceRequest* _Nonnull)request onComplete:(LynxMediaResourceCompletionBlock _Nonnull)response;@end
Except as otherwise noted, this work is licensed under a Creative Commons Attribution 4.0 International License, and code samples are licensed under the Apache License 2.0.