當前位置: 首頁>>代碼示例>>Java>>正文


Java ImageRequestBuilder.disableDiskCache方法代碼示例

本文整理匯總了Java中com.facebook.imagepipeline.request.ImageRequestBuilder.disableDiskCache方法的典型用法代碼示例。如果您正苦於以下問題:Java ImageRequestBuilder.disableDiskCache方法的具體用法?Java ImageRequestBuilder.disableDiskCache怎麽用?Java ImageRequestBuilder.disableDiskCache使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.facebook.imagepipeline.request.ImageRequestBuilder的用法示例。


在下文中一共展示了ImageRequestBuilder.disableDiskCache方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: loadImageFromUrl

import com.facebook.imagepipeline.request.ImageRequestBuilder; //導入方法依賴的package包/類
public static void loadImageFromUrl(Context context, ImageView imageView, String url, String cookie, String referer, boolean noCache, ControllerListener controllerListener) {
    if (TextUtils.isEmpty(url)) {
        imageView.setImageURI(null);
        return;
    }
    Uri uri = Uri.parse(url);
    JsonObject header = new JsonObject();
    header.addProperty("Cookie", cookie);
    header.addProperty("Referer", referer);
    if (url != null && url.startsWith("http")) {
        if (HProxy.isEnabled() && HProxy.isAllowPicture()) {
            HProxy proxy = new HProxy(url);
            header.addProperty(proxy.getHeaderKey(), proxy.getHeaderValue());
        }
        MyOkHttpNetworkFetcher.headers.put(uri, getGson().toJson(header));
    }
    if (imageView instanceof SimpleDraweeView) {
        SimpleDraweeView draweeView = ((SimpleDraweeView) imageView);
        ImageRequestBuilder requestBuilder = ImageRequestBuilder.newBuilderWithSource(uri)
                .setResizeOptions(new ResizeOptions(1080, 1920));
        if (noCache)
            requestBuilder.disableDiskCache();
        ImageRequest request = requestBuilder.build();
        DraweeController controller = Fresco.newDraweeControllerBuilder()
                .setCallerContext(context)
                .setTapToRetryEnabled(true)
                .setAutoPlayAnimations(true)
                .setOldController(draweeView.getController())
                .setControllerListener(controllerListener)
                .setImageRequest(request)
                .build();
        draweeView.setController(controller);
    }
}
 
開發者ID:PureDark,項目名稱:H-Viewer,代碼行數:35,代碼來源:ImageLoader.java

示例2: loadImageFromUrlRetainingImage

import com.facebook.imagepipeline.request.ImageRequestBuilder; //導入方法依賴的package包/類
public static RetainingDataSourceSupplier loadImageFromUrlRetainingImage(Context context, ImageView imageView, String url, String cookie, String referer, boolean noCache, ControllerListener controllerListener) {
    if (TextUtils.isEmpty(url)) {
        imageView.setImageURI(null);
        return null;
    }
    Uri uri = Uri.parse(url);
    JsonObject header = new JsonObject();
    header.addProperty("Cookie", cookie);
    header.addProperty("Referer", referer);
    if (url != null && url.startsWith("http")) {
        if (HProxy.isEnabled() && HProxy.isAllowPicture()) {
            HProxy proxy = new HProxy(url);
            header.addProperty(proxy.getHeaderKey(), proxy.getHeaderValue());
        }
        MyOkHttpNetworkFetcher.headers.put(uri, getGson().toJson(header));
    }
    if (imageView instanceof SimpleDraweeView) {
        SimpleDraweeView draweeView = ((SimpleDraweeView) imageView);
        RetainingDataSourceSupplier<CloseableReference<CloseableImage>> retainingSupplier = new RetainingDataSourceSupplier<>();
        PipelineDraweeControllerBuilder draweeControllerBuilder = Fresco.newDraweeControllerBuilder();
        draweeControllerBuilder.setDataSourceSupplier(retainingSupplier);
        DraweeController controller = draweeControllerBuilder
                .setCallerContext(context)
                .setTapToRetryEnabled(true)
                .setAutoPlayAnimations(true)
                .setOldController(draweeView.getController())
                .setControllerListener(controllerListener)
                .build();
        draweeView.setController(controller);
        ImageRequestBuilder requestBuilder = ImageRequestBuilder.newBuilderWithSource(uri)
                .setResizeOptions(new ResizeOptions(1080, 1920));
        if (noCache)
            requestBuilder.disableDiskCache();
        ImageRequest request = requestBuilder.build();
        retainingSupplier.setSupplier(Fresco.getImagePipeline().getDataSourceSupplier(request, null, ImageRequest.RequestLevel.FULL_FETCH));
        return retainingSupplier;
    }
    return null;
}
 
開發者ID:PureDark,項目名稱:H-Viewer,代碼行數:40,代碼來源:ImageLoader.java


注:本文中的com.facebook.imagepipeline.request.ImageRequestBuilder.disableDiskCache方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。