当前位置: 首页>>代码示例>>Java>>正文


Java ControllerListener类代码示例

本文整理汇总了Java中com.facebook.drawee.controller.ControllerListener的典型用法代码示例。如果您正苦于以下问题:Java ControllerListener类的具体用法?Java ControllerListener怎么用?Java ControllerListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ControllerListener类属于com.facebook.drawee.controller包,在下文中一共展示了ControllerListener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: stubControllerListener

import com.facebook.drawee.controller.ControllerListener; //导入依赖的package包/类
/**
 * Stubs addControllerListener
 * @param controller
 * @return forwarding listener
 */
public static ControllerListener stubControllerListener(
    final DraweeController controller) {
  final ForwardingControllerListener forwardingListener = new ForwardingControllerListener();
  if (!(controller instanceof AbstractDraweeController)) {
    return null;
  }
  AbstractDraweeController abstractController = (AbstractDraweeController) controller;
  doAnswer(
      new Answer() {
        @Override
        public Object answer(InvocationOnMock invocation) throws Throwable {
          forwardingListener.addListener((ControllerListener) invocation.getArguments()[0]);
          return null;
        }
      }).when(abstractController).addControllerListener(any(ControllerListener.class));
  return forwardingListener;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:23,代码来源:DraweeMocks.java

示例2: DraweeRequestHelper

import com.facebook.drawee.controller.ControllerListener; //导入依赖的package包/类
DraweeRequestHelper(
    ImageRequest imageRequest,
    @Nullable ImageRequest cachedImageRequest,
    ControllerListener listener) {
  AbstractDraweeControllerBuilder controllerBuilder = sControllerBuilder
      .setImageRequest(imageRequest)
      .setCallerContext(RCTImageView.getCallerContext())
      .setControllerListener(listener);

  if (cachedImageRequest != null) {
    controllerBuilder.setLowResImageRequest(cachedImageRequest);
  }
  DraweeController controller = controllerBuilder.build();

  controller.setHierarchy(sHierarchyBuilder.build());

  mDraweeController = controller;
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:19,代码来源:DraweeRequestHelper.java

示例3: getImageViewController

import com.facebook.drawee.controller.ControllerListener; //导入依赖的package包/类
/**
	 * 图像选项类
	 * @param uri 图片路径
	 * @param oldController DraweeView.getoldcontroller
	 * @param controllerListener 监听
	 * @return
	 */
	public static DraweeController getImageViewController(String uri, DraweeController oldController,
			ControllerListener<ImageInfo> controllerListener) {
		PipelineDraweeControllerBuilder builder = Fresco.newDraweeControllerBuilder();
		if (!TextUtils.isEmpty(uri)) {
//			Logger.d("StringUtils.utf8Encode(uri)"+StringUtils.utf8Encode(uri));
			builder.setUri(Uri.parse(uri));
		}
		if (oldController != null) {
			builder.setOldController(oldController);
		}
		if (controllerListener != null) {
			builder.setControllerListener(controllerListener);
		}
		return builder.build();
	}
 
开发者ID:lizubing1992,项目名称:Li-MVPArms,代码行数:23,代码来源:FrescoHelper.java

示例4: showResGif

import com.facebook.drawee.controller.ControllerListener; //导入依赖的package包/类
public static DraweeController showResGif(int resourceId, SimpleDraweeView simpleDraweeView) {
    ControllerListener controllerListener = new BaseControllerListener<ImageInfo>() {
        @Override
        public void onFinalImageSet(
                String id,
                @Nullable ImageInfo imageInfo,
                @Nullable Animatable anim) {
            if (anim != null) {
                anim.start();
            }
        }
    };

    Uri uri = Uri.parse("res://com.blinnnk.gaia/" + resourceId);
    DraweeController draweeController = Fresco.newDraweeControllerBuilder()
            .setUri(uri)
            .setControllerListener(controllerListener)
            .build();
    simpleDraweeView.setController(draweeController);
    return draweeController;
}
 
开发者ID:XueyanLiu,项目名称:miku,代码行数:22,代码来源:ImageUtils.java

示例5: createDraweeController

import com.facebook.drawee.controller.ControllerListener; //导入依赖的package包/类
private DraweeController createDraweeController(
        DraweeView draweeView, Uri uri, ControllerListener<ImageInfo> listener) {

    JungleSize size = ImageLoaderUtils.getAppropriateSize(draweeView);
    ImageRequest request = ImageRequestBuilder
            .newBuilderWithSource(uri)
            .setResizeOptions(new ResizeOptions(size.mWidth, size.mHeight))
            .setAutoRotateEnabled(true)
            .build();

    return Fresco.newDraweeControllerBuilder()
            .setUri(uri)
            .setImageRequest(request)
            .setControllerListener(listener)
            .setAutoPlayAnimations(true)
            .setOldController(draweeView.getController())
            .build();
}
 
开发者ID:Android-Jungle,项目名称:android-jungle-framework,代码行数:19,代码来源:FrescoImageLoaderEngine.java

示例6: loadByFresco

import com.facebook.drawee.controller.ControllerListener; //导入依赖的package包/类
private void loadByFresco(String url) {
    Uri uri = Uri.parse(url);
    ControllerListener listener = new BaseControllerListener<ImageInfo>() {
        @Override
        public void onFinalImageSet(String id, ImageInfo imageInfo, Animatable animatable) {
            super.onFinalImageSet(id, imageInfo, animatable);
            Log.d(TAG, "Fresco----->onFinalImageSet: " + LogTime.getElapsedMillis(startTimeFresco) + "ms");
            textFresco.setText(getString(R.string.text_load_time, "Fresco", String.format("%.6f", LogTime.getElapsedMillis(startTimeFresco))));

        }
    };
    DraweeController controller = Fresco.newDraweeControllerBuilder()
            .setControllerListener(listener)
            .setUri(uri)
            .build();
    imgFresco.setController(controller);
}
 
开发者ID:Alluretears,项目名称:ImageLoaders,代码行数:18,代码来源:MainActivity.java

示例7: PipelineDraweeControllerBuilderSupplier

import com.facebook.drawee.controller.ControllerListener; //导入依赖的package包/类
public PipelineDraweeControllerBuilderSupplier(
    Context context,
    ImagePipelineFactory imagePipelineFactory,
    Set<ControllerListener> boundControllerListeners,
    @Nullable DraweeConfig draweeConfig) {
  mContext = context;
  mImagePipeline = imagePipelineFactory.getImagePipeline();

  if (draweeConfig != null && draweeConfig.getPipelineDraweeControllerFactory() != null) {
    mPipelineDraweeControllerFactory = draweeConfig.getPipelineDraweeControllerFactory();
  } else {
    mPipelineDraweeControllerFactory = new PipelineDraweeControllerFactory();
  }
  mPipelineDraweeControllerFactory.init(
      context.getResources(),
      DeferredReleaser.getInstance(),
      imagePipelineFactory.getAnimatedDrawableFactory(context),
      UiThreadImmediateExecutorService.getInstance(),
      mImagePipeline.getBitmapMemoryCache(),
      draweeConfig != null
          ? draweeConfig.getCustomDrawableFactories()
          : null,
      draweeConfig != null
          ? draweeConfig.getDebugOverlayEnabledSupplier()
          : null);
  mBoundControllerListeners = boundControllerListeners;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:28,代码来源:PipelineDraweeControllerBuilderSupplier.java

示例8: PipelineDraweeControllerBuilder

import com.facebook.drawee.controller.ControllerListener; //导入依赖的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

示例9: VolleyDraweeControllerBuilderSupplier

import com.facebook.drawee.controller.ControllerListener; //导入依赖的package包/类
public VolleyDraweeControllerBuilderSupplier(
    Context context,
    ImageLoader imageLoader,
    Set<ControllerListener> boundControllerListeners) {
  mContext = context;
  mImageLoader = imageLoader;
  mVolleyDraweeControllerFactory = new VolleyDraweeControllerFactory(
      context.getResources(),
      DeferredReleaser.getInstance(),
      UiThreadImmediateExecutorService.getInstance());
  mBoundControllerListeners = boundControllerListeners;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:13,代码来源:VolleyDraweeControllerBuilderSupplier.java

示例10: VolleyDraweeControllerBuilder

import com.facebook.drawee.controller.ControllerListener; //导入依赖的package包/类
public VolleyDraweeControllerBuilder(
    Context context,
    ImageLoader imageLoader,
    VolleyDraweeControllerFactory volleyDraweeControllerFactory,
    Set<ControllerListener> boundControllerListeners) {
  super(context, boundControllerListeners);
  mImageLoader = imageLoader;
  mVolleyDraweeControllerFactory = volleyDraweeControllerFactory;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:10,代码来源:VolleyDraweeControllerBuilder.java

示例11: disPlay

import com.facebook.drawee.controller.ControllerListener; //导入依赖的package包/类
/**
     * 自定义控件调用该方法显示
     * @param draweeView
     * @param uri
     * @param resizeOptions
     * @param defaultDrawable
     * @param scaleType
     */
    public void disPlay(DraweeView draweeView, Uri uri, String lowResUri, ResizeOptions resizeOptions, Drawable defaultDrawable, ScalingUtils.ScaleType scaleType, ControllerListener controllerListener) {
//        System.out.println(draweeView.hasHierarchy());
        if (!draweeView.hasHierarchy()) {
            setDefaultHierarchy(draweeView,defaultDrawable,scaleType);
        }
        ImageRequestBuilder imageRequestBuilder =
                ImageRequestBuilder.newBuilderWithSource(uri);
        if (UriUtil.isNetworkUri(uri)) {
            imageRequestBuilder.setProgressiveRenderingEnabled(true);
        }
        else {
            imageRequestBuilder.setLocalThumbnailPreviewsEnabled(true);
            imageRequestBuilder.setProgressiveRenderingEnabled(false);
            if ( resizeOptions != null ) {
                imageRequestBuilder.setResizeOptions(resizeOptions);
            }
        }
//        imageRequestBuilder.setAutoRotateEnabled(true);
//        imageRequestBuilder.setLowestPermittedRequestLevel(ImageRequest.RequestLevel.FULL_FETCH);
        DraweeController draweeController = Fresco.newDraweeControllerBuilder()
                .setImageRequest(imageRequestBuilder.build())
                .setOldController(draweeView.getController())
                .setLowResImageRequest(ImageRequest.fromUri(lowResUri))
                .setControllerListener(controllerListener)
                .build();
        draweeView.setController(draweeController);
    }
 
开发者ID:ebridfighter,项目名称:GongXianSheng,代码行数:36,代码来源:FrecoFactory.java

示例12: setController

import com.facebook.drawee.controller.ControllerListener; //导入依赖的package包/类
public void setController(@NonNull SimpleDraweeView draweeView, @Nullable String uri,@Nullable ControllerListener<ImageInfo> controllerListener){
    DraweeController draweeController =  initControllerBuilder()
            .setOldController(draweeView.getController())
            .setUri(uri)
            .setControllerListener(controllerListener)
            .build();
    draweeView.setController(draweeController);
}
 
开发者ID:niyueming,项目名称:NApply,代码行数:9,代码来源:FrescoImageLoader.java

示例13: setImageRequest

import com.facebook.drawee.controller.ControllerListener; //导入依赖的package包/类
public void setImageRequest(@NonNull SimpleDraweeView draweeView, @Nullable ImageRequest imageRequest, @Nullable ControllerListener<ImageInfo> controllerListener){
    DraweeController draweeController =  initControllerBuilder()
            .setOldController(draweeView.getController())
            .setImageRequest(imageRequest)
            .setControllerListener(controllerListener)
            .build();
    draweeView.setController(draweeController);
}
 
开发者ID:niyueming,项目名称:NApply,代码行数:9,代码来源:FrescoImageLoader.java

示例14: getDraweeController

import com.facebook.drawee.controller.ControllerListener; //导入依赖的package包/类
/**
 * 获取DraweeController
 *
 * @param imageRequest 设置单个图片请求~~~不可与setFirstAvailableImageRequests共用,配合setLowResImageRequest为高分辨率的图
 * @param lowResImageRequest 先下载显示低分辨率的图
 * @param firstAvailableImageRequests 本地图片复用,可加入ImageRequest数组
 * @param controllerListener 监听图片下载完毕等
 * @param tapToRetryEnabled 点击重新加载图
 */
public static PipelineDraweeControllerBuilder getDraweeController(SimpleDraweeView view, @Nullable ImageRequest imageRequest, ImageRequest lowResImageRequest, @Nullable ImageRequest[] firstAvailableImageRequests, @Nullable ControllerListener<ImageInfo> controllerListener, boolean tapToRetryEnabled) {
    PipelineDraweeControllerBuilder builder = Fresco
            .newDraweeControllerBuilder();
    //自动播放图片动画
    builder.setAutoPlayAnimations(true);
    //点击重新加载图
    builder.setTapToRetryEnabled(tapToRetryEnabled);
    if (firstAvailableImageRequests != null &&
            firstAvailableImageRequests.length > 0) {
        //本地图片复用,可加入ImageRequest数组
        builder.setFirstAvailableImageRequests(firstAvailableImageRequests);
    } else if (imageRequest != null) {
        //设置单个图片请求~~~不可与setFirstAvailableImageRequests共用,配合setLowResImageRequest为高分辨率的图
        builder.setImageRequest(imageRequest);
        if (lowResImageRequest != null) {
            //先下载显示低分辨率的图
            builder.setLowResImageRequest(lowResImageRequest);
        }
    }
    if (controllerListener != null) {
        //监听图片下载完毕等
        builder.setControllerListener(controllerListener);
    }
    //DraweeController复用
    builder.setOldController(view.getController());
    return builder;
}
 
开发者ID:imliujun,项目名称:FrescoCustomCacheKey,代码行数:37,代码来源:FrescoImageLoader.java

示例15: loadImageFromUrl

import com.facebook.drawee.controller.ControllerListener; //导入依赖的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


注:本文中的com.facebook.drawee.controller.ControllerListener类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。