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


Java BaseControllerListener類代碼示例

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


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

示例1: init

import com.facebook.drawee.controller.BaseControllerListener; //導入依賴的package包/類
private void init() {
  mInstrumentation = new Instrumentation(this);
  mListener = new BaseControllerListener<Object>() {
    @Override
    public void onSubmit(String id, Object callerContext) {
      mInstrumentation.onStart();
    }
    @Override
    public void onFinalImageSet(
      String id,
      @Nullable Object imageInfo,
      @Nullable Animatable animatable) {
      mInstrumentation.onSuccess();
    }
    @Override
    public void onFailure(String id, Throwable throwable) {
      mInstrumentation.onFailure();
    }
    @Override
    public void onRelease(String id) {
      mInstrumentation.onCancellation();
    }
  };
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:25,代碼來源:InstrumentedDraweeView.java

示例2: onCreate

import com.facebook.drawee.controller.BaseControllerListener; //導入依賴的package包/類
@Override
public void onCreate(final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_splash);
    ButterKnife.bind(this);
    Uri uri = Uri.parse("asset:///splash.webp");
    mSplashPresenter = new SplashPresenterImpl(this);
    DraweeController controller = Fresco.newDraweeControllerBuilder()
            .setUri(uri)
            .setAutoPlayAnimations(true)
            .setControllerListener(new BaseControllerListener<ImageInfo>(){
                @Override
                public void onFinalImageSet(String id, @Nullable ImageInfo imageInfo, @Nullable Animatable animatable) {
                    super.onFinalImageSet(id, imageInfo, animatable);
                    mSplashPresenter.startCountDown(1);
                }
            })
            .build();
    splashDraweee.setController(controller);
}
 
開發者ID:stdnull,項目名稱:RunMap,代碼行數:21,代碼來源:SplashActivity.java

示例3: loadImage

import com.facebook.drawee.controller.BaseControllerListener; //導入依賴的package包/類
public static void loadImage(final PhotoDraweeView mPhotoDraweeView,
                             Uri uri) {
    PipelineDraweeControllerBuilder controller = Fresco.newDraweeControllerBuilder();
    controller.setUri(uri);
    controller.setAutoPlayAnimations(true);
    controller.setOldController(mPhotoDraweeView.getController());
    controller.setControllerListener(new BaseControllerListener<ImageInfo>() {
        @Override
        public void onFinalImageSet(String id, ImageInfo imageInfo, Animatable animatable) {
            super.onFinalImageSet(id, imageInfo, animatable);
            if (imageInfo == null || mPhotoDraweeView == null) {
                return;
            }
            mPhotoDraweeView.update(imageInfo.getWidth(), imageInfo.getHeight());
        }
    });
    mPhotoDraweeView.setController(controller.build());
}
 
開發者ID:lennyup,項目名稱:react-native-udesk,代碼行數:19,代碼來源:UdeskUtil.java

示例4: loadImage

import com.facebook.drawee.controller.BaseControllerListener; //導入依賴的package包/類
public void loadImage(String url,String lowurl, int placeHolderResId, int errorResId,ScalingUtils.ScaleType scaleType){
    final boolean isHttp = url.startsWith("http");
    Uri uri = isHttp ? Uri.parse(url) :  Uri.fromFile(new File(url));
    PipelineDraweeControllerBuilder controller = Fresco.newDraweeControllerBuilder()
         .setImageRequest(ImageRequest.fromUri(uri));
    if(lowurl!=null &&  lowurl.startsWith("http")) {
        controller .setLowResImageRequest(ImageRequest.fromUri(lowurl));
    }
    getHierarchy().setActualImageScaleType(scaleType);
                    // controller.setUri(URI);
    getHierarchy().setPlaceholderImage(getResources().getDrawable( placeHolderResId ),scaleType);
    getHierarchy().setFailureImage(getResources().getDrawable(errorResId),scaleType);
    controller.setOldController(this.getController())
         .setControllerListener(new BaseControllerListener<ImageInfo>() {
             @Override
             public void onFinalImageSet(String id, ImageInfo imageInfo, Animatable animatable) {
                 if (imageInfo == null) {
                     return;
                 }
                 PhotoDraweeView.this.update(imageInfo.getWidth(), imageInfo.getHeight());
             }
         });
    this.setController(controller.build());
}
 
開發者ID:LightSun,項目名稱:android-photo-picker,代碼行數:25,代碼來源:PhotoDraweeView.java

示例5: load

import com.facebook.drawee.controller.BaseControllerListener; //導入依賴的package包/類
public static void load(Uri uri,SimpleDraweeView draweeView,BasePostprocessor processor,int width,int height,
                        BaseControllerListener listener){
    ImageRequest request =
            ImageRequestBuilder.newBuilderWithSource(uri)
                    .setPostprocessor(processor)
                    .setResizeOptions(new ResizeOptions(width,height))
                    //縮放,在解碼前修改內存中的圖片大小, 配合Downsampling可以處理所有圖片,否則隻能處理jpg,
                    // 開啟Downsampling:在初始化時設置.setDownsampleEnabled(true)
                    .setProgressiveRenderingEnabled(true)//支持圖片漸進式加載
                    .setAutoRotateEnabled(true) //如果圖片是側著,可以自動旋轉
                    .build();

    PipelineDraweeController controller =
            (PipelineDraweeController) Fresco.newDraweeControllerBuilder()
                    .setImageRequest(request)
                    .setControllerListener(listener)
                    .setOldController(draweeView.getController())
                    .setAutoPlayAnimations(true) //自動播放gif動畫
                    .build();

    draweeView.setController(controller);
}
 
開發者ID:glassLake,項目名稱:fastDev,代碼行數:23,代碼來源:FrescoUtils.java

示例6: showThumb

import com.facebook.drawee.controller.BaseControllerListener; //導入依賴的package包/類
/**
 * showThumb
 *
 * @param draweeView     draweeView
 * @param url            url
 * @param resizeWidthDp  resizeWidth
 * @param resizeHeightDp resizeHeight
 */
public static void showThumb(SimpleDraweeView draweeView, String url, int resizeWidthDp, int resizeHeightDp) {
    try {
        if (!isInit)
            return;
        if (url == null || "".equals(url))
            return;
        if (draweeView == null)
            return;
        initialize(draweeView.getContext());
        ImageRequest request = ImageRequestBuilder.newBuilderWithSource(Uri.parse(url))
                .setResizeOptions(new ResizeOptions(DimenUtils.dip2px(draweeView.getContext(), resizeWidthDp), DimenUtils.dip2px(draweeView.getContext(), resizeHeightDp)))
                .build();
        DraweeController controller = Fresco.newDraweeControllerBuilder()
                .setImageRequest(request)
                .setOldController(draweeView.getController())
                .setControllerListener(new BaseControllerListener<ImageInfo>())
                .build();
        draweeView.setController(controller);
    } catch (Exception e) {
    }
}
 
開發者ID:LiangMaYong,項目名稱:android-base,代碼行數:30,代碼來源:FrescoUtils.java

示例7: showResGif

import com.facebook.drawee.controller.BaseControllerListener; //導入依賴的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

示例8: initLoad

import com.facebook.drawee.controller.BaseControllerListener; //導入依賴的package包/類
@Override
public void initLoad() {
    super.initLoad();

    if (!TextUtils.isEmpty(mImageUrl)) {
        PipelineDraweeControllerBuilder controller = Fresco.newDraweeControllerBuilder();
        controller.setUri(mImageUrl);
        controller.setOldController(mPhotoIv.getController());
        controller.setControllerListener(new BaseControllerListener<ImageInfo>() {
            @Override
            public void onFinalImageSet(String id, ImageInfo imageInfo, Animatable animatable) {
                super.onFinalImageSet(id, imageInfo, animatable);
                if (imageInfo == null || mPhotoIv == null) {
                    return;
                }
                mPhotoIv.update(imageInfo.getWidth(), imageInfo.getHeight());
            }
        });
        mPhotoIv.setController(controller.build());
    }
}
 
開發者ID:Freelander,項目名稱:Elephant,代碼行數:22,代碼來源:PhotoShowActivity.java

示例9: loadByFresco

import com.facebook.drawee.controller.BaseControllerListener; //導入依賴的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

示例10: display

import com.facebook.drawee.controller.BaseControllerListener; //導入依賴的package包/類
public static void display(final PhotoDraweeView draweeView, Uri uri) {
    PipelineDraweeControllerBuilder controller = Fresco.newDraweeControllerBuilder();
    controller.setUri(uri);
    controller.setOldController(draweeView.getController());
    controller.setControllerListener(new BaseControllerListener<ImageInfo>() {
        @Override
        public void onFinalImageSet(String id, ImageInfo imageInfo, Animatable animatable) {
            super.onFinalImageSet(id, imageInfo, animatable);
            if (imageInfo == null || draweeView == null) {
                return;
            }
            draweeView.update(imageInfo.getWidth(), imageInfo.getHeight());
        }
    });
    draweeView.setController(controller.build());
}
 
開發者ID:iKnown,項目名稱:AndroidImageSelect,代碼行數:17,代碼來源:PhotoDraweeViewUtil.java

示例11: onCreate

import com.facebook.drawee.controller.BaseControllerListener; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    String imageUrl = getIntent().getStringExtra(IMAGE_URL);
    if (!TextUtils.isEmpty(imageUrl)) {
        PipelineDraweeControllerBuilder builder = Fresco.newDraweeControllerBuilder();
        builder.setUri(Uri.parse(imageUrl));
        builder.setOldController(photoView.getController());
        builder.setControllerListener(new BaseControllerListener<ImageInfo>() {
            @Override
            public void onFinalImageSet(String id, ImageInfo imageInfo, Animatable animatable) {
                super.onFinalImageSet(id, imageInfo, animatable);
                if (imageInfo == null || photoView == null) {
                    return;
                }
                photoView.update(imageInfo.getWidth(), imageInfo.getHeight());
            }
        });
        photoView.setController(builder.build());
    }
}
 
開發者ID:CycloneAxe,項目名稱:phphub-android,代碼行數:23,代碼來源:GalleryActivity.java

示例12: onBindItemViewHolder

import com.facebook.drawee.controller.BaseControllerListener; //導入依賴的package包/類
@Override
public void onBindItemViewHolder(final ViewHolder holder, final int position) {
    MediaEntity entity = getItem(position);
    holder.mImageViewCover.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            onItemClickListener.onItemClick(getItem(position));
        }
    });
    holder.mTextViewLikesCount.setTextImageStart(18, R.mipmap.ic_thumb_up_gray_18dp, " " + entity.getLikes_count());
    holder.mTextViewRecommendCaption.setText(entity.getCaption());

    String url = entity.getCover_pic().replace("!thumb320", "");
    DraweeController controller = Fresco.newDraweeControllerBuilder()
            .setControllerListener(new BaseControllerListener<ImageInfo>() {
                @Override
                public void onFinalImageSet(String id, ImageInfo imageInfo, Animatable animatable) {
                    float aspectRatio = (float)imageInfo.getWidth() / (float)imageInfo.getHeight();
                    holder.mImageViewCover.setAspectRatio(aspectRatio);
                }
            })
            .setUri(Uri.parse(url))
            .build();
    holder.mImageViewCover.setController(controller);
    AppUtils.loadSmallUserAvata(getItem(position).getUser(), holder.mImageViewAvatar);
}
 
開發者ID:sungerk,項目名稱:meiShi,代碼行數:27,代碼來源:MediasAdapter.java

示例13: init

import com.facebook.drawee.controller.BaseControllerListener; //導入依賴的package包/類
private void init() {
  mInstrumentation = new Instrumentation(this);
  if (mConfig.instrumentationEnabled) {
    mListener = new BaseControllerListener<Object>() {
      @Override
      public void onSubmit(String id, Object callerContext) {
        mInstrumentation.onStart();
      }
      @Override
      public void onFinalImageSet(
          String id,
          @Nullable Object imageInfo,
          @Nullable Animatable animatable) {
        mInstrumentation.onSuccess();
      }
      @Override
      public void onFailure(String id, Throwable throwable) {
        mInstrumentation.onFailure();
      }
      @Override
      public void onRelease(String id) {
        mInstrumentation.onCancellation();
      }
    };
  }
  DraweeUtil.setBgColor(this, mConfig);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:28,代碼來源:InstrumentedDraweeView.java

示例14: init

import com.facebook.drawee.controller.BaseControllerListener; //導入依賴的package包/類
@Override
protected void init() {
    super.init();
    transparentStatusBar();
    ButterKnife.bind(this);
    url = getIntent().getStringExtra("url");
    PipelineDraweeControllerBuilder controller = Fresco.newDraweeControllerBuilder();
    controller.setUri(Uri.parse(url));
    controller.setAutoPlayAnimations(true);
    controller.setOldController(photoDraweeView.getController());
    controller.setControllerListener(new BaseControllerListener<ImageInfo>() {
        @Override
        public void onFinalImageSet(String id, ImageInfo imageInfo, Animatable animatable) {
            super.onFinalImageSet(id, imageInfo, animatable);
            if (imageInfo == null || photoDraweeView == null) {
                return;
            }
            photoDraweeView.update(imageInfo.getWidth(), imageInfo.getHeight());
            normalScale = photoDraweeView.getScale();
        }
    });
    photoDraweeView.setController(controller.build());
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){
        String name = getIntent().getStringExtra("transition_name");
        photoDraweeView.setTransitionName(name);
        getWindow().setSharedElementEnterTransition(DraweeTransition.createTransitionSet(
                ScalingUtils.ScaleType.CENTER_CROP, ScalingUtils.ScaleType.FIT_CENTER));
        getWindow().setSharedElementReturnTransition(DraweeTransition.createTransitionSet(
                ScalingUtils.ScaleType.FIT_CENTER, ScalingUtils.ScaleType.CENTER_CROP));
    }
}
 
開發者ID:HStanN,項目名稱:TakeRest,代碼行數:32,代碼來源:PhotoViewActivity.java

示例15: loadFileFromSdcard

import com.facebook.drawee.controller.BaseControllerListener; //導入依賴的package包/類
public static void loadFileFromSdcard(final Context context, final SimpleDraweeView draweeView, Uri loackUri, final int reqWidth, final int reqHeight) {
    ImageRequest request = ImageRequestBuilder.newBuilderWithSource(loackUri)
            .setRotationOptions(RotationOptions.autoRotate())
            .setLocalThumbnailPreviewsEnabled(true)
            .setResizeOptions(new ResizeOptions(dip2px(context, 140), dip2px(context, 220)))
            .build();
    DraweeController controller = Fresco.newDraweeControllerBuilder()
            .setImageRequest(request)
            .setOldController(draweeView.getController())
            .setTapToRetryEnabled(true)
            .setControllerListener(new BaseControllerListener<ImageInfo>() {
                @Override
                public void onFinalImageSet(String id, ImageInfo imageInfo, Animatable anim) {
                    if (imageInfo == null) {
                        return;
                    }

                    ViewGroup.LayoutParams layoutParams = draweeView.getLayoutParams();
                    int width = reqWidth;
                    int height = reqHeight;
                    int imgWidth = dip2px(context, 140);
                    int imgHight = dip2px(context, 220);
                    int bitScalew = getRatioSize(width, height, imgHight, imgWidth);
                    layoutParams.height = height / bitScalew;
                    layoutParams.width = width / bitScalew;
                    draweeView.requestLayout();
                }
            })
            .setAutoPlayAnimations(true)
            .build();
    draweeView.setController(controller);
}
 
開發者ID:lennyup,項目名稱:react-native-udesk,代碼行數:33,代碼來源:UdeskUtil.java


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