當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。