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


Java ImagePipeline類代碼示例

本文整理匯總了Java中com.facebook.imagepipeline.core.ImagePipeline的典型用法代碼示例。如果您正苦於以下問題:Java ImagePipeline類的具體用法?Java ImagePipeline怎麽用?Java ImagePipeline使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: clearCache

import com.facebook.imagepipeline.core.ImagePipeline; //導入依賴的package包/類
/**
     * 清除緩存
     */
    private void clearCache() {
        // 清理新聞json數據 - 不清理json數據
//        NewsDALManager.shared.clearCache();

        // Fresco清除圖片緩存
        ImagePipeline imagePipeline = Fresco.getImagePipeline();
        imagePipeline.clearCaches();

        // 清除緩存目錄 - 清除所有緩存目錄文件
        FileCacheUtils.clearAllCache(mContext);

        final KProgressHUD hud = ProgressHUD.show(mContext, "正在清理...");
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                hud.dismiss();
                ProgressHUD.showInfo(mContext, "清理緩存完成");
            }
        }, 2000);

    }
 
開發者ID:6ag,項目名稱:LiuAGeAndroid,代碼行數:25,代碼來源:MainActivity.java

示例2: attach

import com.facebook.imagepipeline.core.ImagePipeline; //導入依賴的package包/類
void attach(BitmapUpdateListener listener) {
  mBitmapUpdateListener = listener;

  mAttachCounter++;
  if (mAttachCounter != 1) {
    // this is a secondary attach, ignore it, only updating Bitmap boundaries if needed.
    Bitmap bitmap = getBitmap();
    if (bitmap != null) {
      listener.onSecondaryAttach(bitmap);
    }
    return;
  }

  listener.onImageLoadEvent(ImageLoadEvent.ON_LOAD_START);

  Assertions.assertCondition(mDataSource == null);
  Assertions.assertCondition(mImageRef == null);

  // Submit the request
  ImagePipeline imagePipeline = ImagePipelineFactory.getInstance().getImagePipeline();
  mDataSource = imagePipeline.fetchDecodedImage(mImageRequest, RCTImageView.getCallerContext());
  mDataSource.subscribe(this, UiThreadImmediateExecutorService.getInstance());
}
 
開發者ID:qq565999484,項目名稱:RNLearn_Project1,代碼行數:24,代碼來源:PipelineRequestHelper.java

示例3: queryCache

import com.facebook.imagepipeline.core.ImagePipeline; //導入依賴的package包/類
@ReactMethod
public void queryCache(final ReadableArray uris, final Promise promise) {
  // perform cache interrogation in async task as disk cache checks are expensive
  new GuardedAsyncTask<Void, Void>(getReactApplicationContext()) {
    @Override
    protected void doInBackgroundGuarded(Void... params) {
      WritableMap result = Arguments.createMap();
      ImagePipeline imagePipeline = Fresco.getImagePipeline();
      for (int i = 0; i < uris.size(); i++) {
        String uriString = uris.getString(i);
        final Uri uri = Uri.parse(uriString);
        if (imagePipeline.isInBitmapMemoryCache(uri)) {
          result.putString(uriString, "memory");
        } else if (imagePipeline.isInDiskCacheSync(uri)) {
          result.putString(uriString, "disk");
        }
      }
      promise.resolve(result);
    }
  }.executeOnExecutor(GuardedAsyncTask.THREAD_POOL_EXECUTOR);
}
 
開發者ID:qq565999484,項目名稱:RNLearn_Project1,代碼行數:22,代碼來源:ImageLoaderModule.java

示例4: clearCache

import com.facebook.imagepipeline.core.ImagePipeline; //導入依賴的package包/類
/**
     * 清除緩存
     */
    private void clearCache() {
        // 清理新聞json數據 - 不清理json數據
//        NewsDALManager.shared.clearCache();

        // Fresco清除圖片緩存
        ImagePipeline imagePipeline = Fresco.getImagePipeline();
        imagePipeline.clearCaches();

        // 清除緩存目錄 - 清除所有緩存目錄文件
        FileCacheUtils.clearAllCache(mContext);

        final KProgressHUD hud = ProgressHUD.show(mContext, "正在清理...");
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                hud.dismiss();
                ProgressHUD.showInfo(mContext, "清理緩存完成");
                cacheTextView.setText(FileCacheUtils.getTotalCacheSize(mContext));
            }
        }, 2000);

    }
 
開發者ID:6ag,項目名稱:BaoKanAndroid,代碼行數:26,代碼來源:ProfileFragment.java

示例5: setImage

import com.facebook.imagepipeline.core.ImagePipeline; //導入依賴的package包/類
public void setImage(String uri) {
    if (uri == null) {
        iconBitmapDescriptor = null;
        update();
    } else if (uri.startsWith("http://") || uri.startsWith("https://") ||
            uri.startsWith("file://")) {
        ImageRequest imageRequest = ImageRequestBuilder
                .newBuilderWithSource(Uri.parse(uri))
                .build();

        ImagePipeline imagePipeline = Fresco.getImagePipeline();
        dataSource = imagePipeline.fetchDecodedImage(imageRequest, this);
        DraweeController controller = Fresco.newDraweeControllerBuilder()
                .setImageRequest(imageRequest)
                .setControllerListener(mLogoControllerListener)
                .setOldController(logoHolder.getController())
                .build();
        logoHolder.setController(controller);
    } else {
        iconBitmapDescriptor = getBitmapDescriptorByName(uri);
        update();
    }
}
 
開發者ID:laoqiu,項目名稱:react-native-amap,代碼行數:24,代碼來源:AMapMarker.java

示例6: loadBitmapFromUrl

import com.facebook.imagepipeline.core.ImagePipeline; //導入依賴的package包/類
public static void loadBitmapFromUrl(Context context, String url, String cookie, String referer, BaseBitmapDataSubscriber dataSubscriber) {
    if (TextUtils.isEmpty(url))
        return;
    Uri uri = Uri.parse(url);
    JsonObject header = new JsonObject();
    header.addProperty("Cookie", cookie);
    header.addProperty("Referer", referer);
    if (HProxy.isEnabled() && HProxy.isAllowPicture()) {
        HProxy proxy = new HProxy(url);
        header.addProperty(proxy.getHeaderKey(), proxy.getHeaderValue());
    }
    MyOkHttpNetworkFetcher.headers.put(uri, getGson().toJson(header));
    ImagePipeline imagePipeline = Fresco.getImagePipeline();
    ImageRequestBuilder builder = ImageRequestBuilder.newBuilderWithSource(uri);
    ImageRequest request = builder.build();
    DataSource<CloseableReference<CloseableImage>>
            dataSource = imagePipeline.fetchDecodedImage(request, context);
    dataSource.subscribe(dataSubscriber, CallerThreadExecutor.getInstance());
}
 
開發者ID:PureDark,項目名稱:H-Viewer,代碼行數:20,代碼來源:ImageLoader.java

示例7: loadResourceFromUrl

import com.facebook.imagepipeline.core.ImagePipeline; //導入依賴的package包/類
public static void loadResourceFromUrl(Context context, Uri uri, String cookie, String referer, BaseDataSubscriber dataSubscriber) {
    if (uri.getScheme().startsWith("http")) {
        JsonObject header = new JsonObject();
        header.addProperty("Cookie", cookie);
        header.addProperty("Referer", referer);
        if (HProxy.isEnabled() && HProxy.isAllowPicture()) {
            HProxy proxy = new HProxy(uri.toString());
            header.addProperty(proxy.getHeaderKey(), proxy.getHeaderValue());
        }
        MyOkHttpNetworkFetcher.headers.put(uri, getGson().toJson(header));
    }
    ImagePipeline imagePipeline = Fresco.getImagePipeline();
    ImageRequestBuilder builder = ImageRequestBuilder.newBuilderWithSource(uri);
    ImageRequest request = builder.build();
    DataSource<CloseableReference<PooledByteBuffer>>
            dataSource = imagePipeline.fetchEncodedImage(request, context);
    dataSource.subscribe(dataSubscriber, CallerThreadExecutor.getInstance());
}
 
開發者ID:PureDark,項目名稱:H-Viewer,代碼行數:19,代碼來源:ImageLoader.java

示例8: setViewListener

import com.facebook.imagepipeline.core.ImagePipeline; //導入依賴的package包/類
@Override
public void setViewListener() {
	settingsListAdapter.setOnRecyclerViewItemClickListener(new BaseQuickAdapter.OnRecyclerViewItemClickListener() {
		@Override
		public void onItemClick(View view, int i) {
			if (i == 1) {
				ImagePipeline imagePipeline = Fresco.getImagePipeline();

				imagePipeline.clearMemoryCaches();
				imagePipeline.clearDiskCaches();

				// combines above two lines
				imagePipeline.clearCaches();

				processExtraData();
			}
		}
	});
}
 
開發者ID:iflove,項目名稱:gank-examples,代碼行數:20,代碼來源:SettingActivity.java

示例9: LoadImageFromURLAndCallBack

import com.facebook.imagepipeline.core.ImagePipeline; //導入依賴的package包/類
public static void LoadImageFromURLAndCallBack(SimpleDraweeView destImageView , String URL,Context context,BaseBitmapDataSubscriber bbds)
{
    int w = destImageView.getWidth();
    int h  =destImageView.getHeight();
    if(w<1){
        w = destImageView.getLayoutParams().width;
    }
    if(h<1){
        h  =destImageView.getLayoutParams().height;
    }
    ImageRequest imageRequest =
            ImageRequestBuilder.newBuilderWithSource(Uri.parse(URL))
                    .setResizeOptions(new ResizeOptions(w,h))
                    .setProgressiveRenderingEnabled(true)
                    .build();
    ImagePipeline imagePipeline = Fresco.getImagePipeline();
    DataSource<CloseableReference<CloseableImage>> dataSource = imagePipeline.fetchDecodedImage(imageRequest, context);
    dataSource.subscribe(bbds, CallerThreadExecutor.getInstance());
    DraweeController draweeController = Fresco.newDraweeControllerBuilder()
            .setImageRequest(imageRequest)
            .setOldController(destImageView.getController())
            .setAutoPlayAnimations(true)
            .build();
    destImageView.setController(draweeController);
}
 
開發者ID:tianyuan168326,項目名稱:nono-android,代碼行數:26,代碼來源:FrescoImageloadHelper.java

示例10: LoadImageFromURIAndCallBack

import com.facebook.imagepipeline.core.ImagePipeline; //導入依賴的package包/類
public static void LoadImageFromURIAndCallBack(SimpleDraweeView destImageView , Uri uri,Context context,BaseBitmapDataSubscriber bbds)
{
    int w = destImageView.getWidth();
    int h  =destImageView.getHeight();
    if(w<1){
        w = destImageView.getLayoutParams().width;
    }
    if(h<1){
        h  =destImageView.getLayoutParams().height;
    }
    ImageRequest imageRequest =
            ImageRequestBuilder.newBuilderWithSource(uri)
                    .setResizeOptions(new ResizeOptions(w,h))
                    .setProgressiveRenderingEnabled(true)
                    .build();
    ImagePipeline imagePipeline = Fresco.getImagePipeline();
    DataSource<CloseableReference<CloseableImage>> dataSource = imagePipeline.fetchDecodedImage(imageRequest, context);
    dataSource.subscribe(bbds, CallerThreadExecutor.getInstance());
    DraweeController draweeController = Fresco.newDraweeControllerBuilder()
            .setImageRequest(imageRequest)
            .setOldController(destImageView.getController())
            .setAutoPlayAnimations(true)
            .build();
    destImageView.setController(draweeController);
}
 
開發者ID:tianyuan168326,項目名稱:nono-android,代碼行數:26,代碼來源:FrescoImageloadHelper.java

示例11: PipelineDraweeControllerBuilder

import com.facebook.imagepipeline.core.ImagePipeline; //導入依賴的package包/類
public PipelineDraweeControllerBuilder(
    Context context,
    PipelineDraweeControllerFactory pipelineDraweeControllerFactory,
    ImagePipeline imagePipeline,
    Set<ControllerListener> boundControllerListeners) {
  super(context, boundControllerListeners);
  mImagePipeline = imagePipeline;
  mPipelineDraweeControllerFactory = pipelineDraweeControllerFactory;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:10,代碼來源:PipelineDraweeControllerBuilder.java

示例12: clear

import com.facebook.imagepipeline.core.ImagePipeline; //導入依賴的package包/類
@Override
public void clear(Context ctx, FrescoImageConfig config) {
    Fresco.getImagePipeline().clearMemoryCaches();
    Fresco.getImagePipeline().clearCaches();
    Fresco.getImagePipeline().clearDiskCaches();
    String url = appendUrl(config.getUrl());
    ImagePipeline imagePipeline = Fresco.getImagePipeline();
    Uri uri = Uri.parse(url);
    imagePipeline.evictFromMemoryCache(uri);
}
 
開發者ID:BaoBaoJianqiang,項目名稱:CustomListView,代碼行數:11,代碼來源:FrescoImageLoaderStrategy.java

示例13: onLowMemory

import com.facebook.imagepipeline.core.ImagePipeline; //導入依賴的package包/類
@Override
public void onLowMemory() {
    super.onLowMemory();
    ImagePipeline imagePipeline = Fresco.getImagePipeline();
    imagePipeline.clearMemoryCaches();
}
 
開發者ID:liu-xiao-dong,項目名稱:JD-Test,代碼行數:7,代碼來源:MyApplication.java

示例14: evictUri

import com.facebook.imagepipeline.core.ImagePipeline; //導入依賴的package包/類
/**
 * 清除緩存中的一條url
 *
 * @param uri 需要被清除的url
 */
public void evictUri(Uri uri) {
    ImagePipeline imagePipeline = Fresco.getImagePipeline();
    imagePipeline.evictFromMemoryCache(uri);
    imagePipeline.evictFromDiskCache(uri);
    imagePipeline.evictFromCache(uri);

}
 
開發者ID:zhonglikui,項目名稱:cardinalsSample,代碼行數:13,代碼來源:FrescoManager.java

示例15: clear

import com.facebook.imagepipeline.core.ImagePipeline; //導入依賴的package包/類
/**
 * 清除所有緩存
 */
public void clear() {
    ImagePipeline imagePipeline = Fresco.getImagePipeline();
    imagePipeline.clearMemoryCaches();
    imagePipeline.clearDiskCaches();
    imagePipeline.clearCaches();
}
 
開發者ID:zhonglikui,項目名稱:cardinalsSample,代碼行數:10,代碼來源:FrescoManager.java


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