当前位置: 首页>>代码示例>>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;未经允许,请勿转载。