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


Java SimpleDraweeView.setController方法代码示例

本文整理汇总了Java中com.facebook.drawee.view.SimpleDraweeView.setController方法的典型用法代码示例。如果您正苦于以下问题:Java SimpleDraweeView.setController方法的具体用法?Java SimpleDraweeView.setController怎么用?Java SimpleDraweeView.setController使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.facebook.drawee.view.SimpleDraweeView的用法示例。


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

示例1: onViewCreated

import com.facebook.drawee.view.SimpleDraweeView; //导入方法依赖的package包/类
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
  SimpleDraweeView simpleDraweeView = (SimpleDraweeView) view.findViewById(R.id.drawee_view);

  ImageDecodeOptions imageDecodeOptionsWithCustomDecoder = new ImageDecodeOptionsBuilder()
      .setCustomImageDecoder(CUSTOM_COLOR_DECODER)
      .build();

  AbstractDraweeController controller = Fresco.newDraweeControllerBuilder()
      .setImageRequest(
          ImageRequestBuilder.newBuilderWithResourceId(R.raw.custom_color1)
              .setImageDecodeOptions(imageDecodeOptionsWithCustomDecoder)
              .build())
      .build();
  simpleDraweeView.setController(controller);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:17,代码来源:ImageFormatOverrideExample.java

示例2: initAnimation

import com.facebook.drawee.view.SimpleDraweeView; //导入方法依赖的package包/类
@RequiresApi(api = Build.VERSION_CODES.HONEYCOMB)
private void initAnimation(View view) {
  mSimpleDraweeView = (SimpleDraweeView) view.findViewById(R.id.drawee_view);
  mSimpleDraweeView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
  DraweeController controller = Fresco.newDraweeControllerBuilder()
      .setOldController(mSimpleDraweeView.getController())
      .setUri(URI_KEYFRAMES_ANIMATION)
      .setAutoPlayAnimations(true)
      .build();
  mSimpleDraweeView.setController(controller);

  final SwitchCompat switchBackground = (SwitchCompat) view.findViewById(R.id.switch_background);
  switchBackground.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
    @Override
    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
      mSimpleDraweeView.getHierarchy().setBackgroundImage(isChecked
          ? new CheckerBoardDrawable(getResources())
          : null);
    }
  });
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:22,代码来源:ImageFormatKeyframesFragment.java

示例3: loadThumb

import com.facebook.drawee.view.SimpleDraweeView; //导入方法依赖的package包/类
private void loadThumb(
    SimpleDraweeView draweeView,
    Size size,
    ImageRequest.RequestLevel requestLevel) {
  ImageRequest request = ImageRequestBuilder.newBuilderWithSource(size.uri)
      .setMediaVariations(MediaVariations.newBuilderForMediaId(MEDIA_ID)
          .setForceRequestForSpecifiedUri(true)
          .build())
      .setLowestPermittedRequestLevel(requestLevel)
      .setResizeOptions(new ResizeOptions(draweeView.getWidth(), draweeView.getHeight()))
      .setCacheChoice(size.cacheChoice)
      .build();
  DraweeController controller = Fresco.newDraweeControllerBuilder()
      .setImageRequest(request)
      .setOldController(draweeView.getController())
      .build();
  draweeView.setController(controller);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:19,代码来源:MediaVariationsFragment.java

示例4: displayImage

import com.facebook.drawee.view.SimpleDraweeView; //导入方法依赖的package包/类
private void displayImage(SimpleDraweeView draweeView, String url) {
    GenericDraweeHierarchy hierarchy = draweeView.getHierarchy();
    //设置占位图
    if (hierarchy == null) {
        hierarchy = GenericDraweeHierarchyBuilder.newInstance(getResources())
                .setPlaceholderImage(getResources().getDrawable(R.mipmap.ic_launcher)
                        , ScalingUtils.ScaleType.CENTER).build();
        draweeView.setHierarchy(hierarchy);
    } else {
        hierarchy.setPlaceholderImage(getResources().getDrawable(R.mipmap.ic_launcher)
                , ScalingUtils.ScaleType.CENTER);
    }

    //构建ImageRequestBuilder,传入请求Uri
    ImageRequestBuilder requestBuilder = ImageRequestBuilder.newBuilderWithSource(Uri.parse(url));
    //构建Controller
    DraweeController controller = Fresco.newDraweeControllerBuilder()
            .setOldController(draweeView.getController())
            .setImageRequest(requestBuilder.build())
            .build();
    //设置图片,Fresco设置显示图片都是通过Controller来实现
    draweeView.setController(controller);
}
 
开发者ID:idisfkj,项目名称:Zoomable,代码行数:24,代码来源:MainActivity.java

示例5: layoutChildrenView

import com.facebook.drawee.view.SimpleDraweeView; //导入方法依赖的package包/类
private void layoutChildrenView() {
    int childrenCount = getChildCount();

    for (int i = 0; i < childrenCount; i++) {
        ViewGroup childImageLayout = (ViewGroup) getChildAt(i);
        SimpleDraweeView childImageView = (SimpleDraweeView) childImageLayout.getChildAt(0);
        if (mOnItemClickListener != null) {
            final int finalI = i;
            childImageLayout.setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(View v) {
                    mOnItemClickListener.OnItemClick(finalI);
                }
            });
        }
        ImageRequest request = ImageRequestBuilder.newBuilderWithSource(Uri.parse(mImageUrls.get(i)))
                .setProgressiveRenderingEnabled(true)
                .setResizeOptions(new ResizeOptions(mItemWidth, mItemWidth))
                .build();
        DraweeController controller = Fresco.newDraweeControllerBuilder()
                .setImageRequest(request)
                .setOldController(childImageView.getController())
                .build();
        childImageView.setController(controller);

        int[] position = findPosition(i);
        int itemHeight = mItemWidth;
        int left = (int) (mItemWidth + mHorizontalSpace) * position[1];
        int top = (int) (itemHeight + mVerticalSpace) * position[0];
        int right = left + mItemWidth;
        int bottom = top + itemHeight;

        childImageLayout.layout(left, top, right, bottom);
    }
}
 
开发者ID:ibosong,项目名称:CommentGallery,代码行数:36,代码来源:CommentImageGrid.java

示例6: refreshImageChild

import com.facebook.drawee.view.SimpleDraweeView; //导入方法依赖的package包/类
private void refreshImageChild() {
    int childrenCount = getChildCount();
    if (childrenCount > 0) {
        for (int i = 0; i < childrenCount; i++) {
            ViewGroup childImageLayout = (ViewGroup) getChildAt(i);
            SimpleDraweeView childImageView = (SimpleDraweeView) childImageLayout.getChildAt(0);
            if (mOnItemClickListener != null) {
                final int finalI = i;
                childImageLayout.setOnClickListener(new OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        mOnItemClickListener.OnItemClick(finalI);
                    }
                });
            }
            ImageRequest request = ImageRequestBuilder.newBuilderWithSource(Uri.parse(mImageUrls.get(i)))
                    .setResizeOptions(new ResizeOptions(mItemWidth, mItemWidth))
                    .build();
            DraweeController controller = Fresco.newDraweeControllerBuilder()
                    .setImageRequest(request)
                    .setOldController(childImageView.getController())
                    .build();
            childImageView.setController(controller);
        }
    }
}
 
开发者ID:ibosong,项目名称:CommentGallery,代码行数:27,代码来源:CommentImageGrid.java

示例7: display

import com.facebook.drawee.view.SimpleDraweeView; //导入方法依赖的package包/类
public void display(SimpleDraweeView view, String url, Postprocessor postprocessor) {
    if (!TextUtils.isEmpty(url)) {
        Uri uri;
        if (URLUtil.isNetworkUrl(url)) {
            uri = Uri.parse(url);
        } else {
            uri = Uri.fromFile(new File(url));
        }
        ImageRequest request = ImageRequestBuilder
                .newBuilderWithSource(uri)
                .setPostprocessor(postprocessor)
                .setProgressiveRenderingEnabled(true)
                //.setResizeOptions(new ResizeOptions(100, 100))
                .setLocalThumbnailPreviewsEnabled(true)
                .setRotationOptions(RotationOptions.autoRotateAtRenderTime())
                .build();

        controller = Fresco.newDraweeControllerBuilder()
                .setImageRequest(request)
                .setOldController(view.getController())
                .build();
        view.setController(controller);

    }

}
 
开发者ID:zhonglikui,项目名称:cardinalsSample,代码行数:27,代码来源:FrescoManager.java

示例8: setBlurFrescoController

import com.facebook.drawee.view.SimpleDraweeView; //导入方法依赖的package包/类
public static void setBlurFrescoController(SimpleDraweeView simpleDraweeView, String url, int iterations, int blurRadius) {
    try {
        Uri uri = Uri.parse(url);
        ImageRequest request = ImageRequestBuilder.newBuilderWithSource(uri)
                .setPostprocessor(new IterativeBoxBlurPostProcessor(iterations, blurRadius))
                .build();
        DraweeController controller = Fresco.newDraweeControllerBuilder()
                .setOldController(simpleDraweeView.getController())
                .setImageRequest(request)
                .build();
        simpleDraweeView.setController(controller);
    } catch (Exception e) {
        e.printStackTrace();
    }

}
 
开发者ID:lanyuanxiaoyao,项目名称:PicKing,代码行数:17,代码来源:FrescoUtil.java

示例9: into

import com.facebook.drawee.view.SimpleDraweeView; //导入方法依赖的package包/类
/**
 * 指定控件
 *
 * @param simpleDraweeView
 */
public void into(@NonNull SimpleDraweeView simpleDraweeView) {
    ImageRequestBuilder imageRequestBuilder = ImageRequestBuilder.newBuilderWithSource(uri);

    if (resizeOptions != null) {
        imageRequestBuilder.setResizeOptions(resizeOptions);
    }
    if (postprocessor != null) {
        imageRequestBuilder.setPostprocessor(postprocessor);
    }
    if (priority != null) {
        imageRequestBuilder.setRequestPriority(priority);
    }

    DraweeController controller = Fresco.newDraweeControllerBuilder()
            .setImageRequest(imageRequestBuilder.build())
            .setOldController(simpleDraweeView.getController())
            .build();
    simpleDraweeView.setController(controller);
}
 
开发者ID:senierr,项目名称:ModuleFrame,代码行数:25,代码来源:FrescoUtil.java

示例10: loadImageIntoDrawee

import com.facebook.drawee.view.SimpleDraweeView; //导入方法依赖的package包/类
private void loadImageIntoDrawee(SimpleDraweeView draweeView, @Nullable BytesRange bytesRange) {
  final ImageRequest imageRequest = ImageRequestBuilder.newBuilderWithSource(URI)
      .setMediaVariationsForMediaId("partial")
      .setBytesRange(bytesRange)
      .build();

  final DraweeController draweeController = Fresco.newDraweeControllerBuilder()
      .setOldController(draweeView.getController())
      .setImageRequest(imageRequest)
      .build();

  draweeView.setController(draweeController);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:14,代码来源:PartialRequestFragment.java

示例11: setUri

import com.facebook.drawee.view.SimpleDraweeView; //导入方法依赖的package包/类
private void setUri(SimpleDraweeView draweeView, Uri uri, boolean retryEnabled) {
  draweeView.setController(Fresco.newDraweeControllerBuilder()
      .setOldController(draweeView.getController())
      .setTapToRetryEnabled(retryEnabled)
      .setUri(uri)
      .build());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:DraweeHierarchyFragment.java

示例12: setSimpleDraweeImage

import com.facebook.drawee.view.SimpleDraweeView; //导入方法依赖的package包/类
public void setSimpleDraweeImage(String path, Activity act, SimpleDraweeView imageView) {
    Uri uri = Uri.parse("file://" + path);
    ImageRequest request = ImageRequestBuilder.newBuilderWithSource(uri)
            .setAutoRotateEnabled(true)
            .setResizeOptions(new ResizeOptions(getScreenWidth(act) / 4, getScreenWidth(act) / 4))
            .build();
    DraweeController controller = Fresco.newDraweeControllerBuilder()
            .setOldController(imageView.getController())
            .setImageRequest(request)
            .build();
    imageView.setController(controller);
}
 
开发者ID:gitxuyulin,项目名称:EditorImageAndText,代码行数:13,代码来源:BaseFragmentActivity.java

示例13: setSimpleDrawee

import com.facebook.drawee.view.SimpleDraweeView; //导入方法依赖的package包/类
public void setSimpleDrawee(String path, SimpleDraweeView imageView) {
    DraweeController mDraweeController = Fresco.newDraweeControllerBuilder()
            .setAutoPlayAnimations(true)
            //设置uri,加载本地的gif资源
            .setUri(Uri.parse(path))//设置uri
            .build();
    //设置Controller
    imageView.setController(mDraweeController);
}
 
开发者ID:gitxuyulin,项目名称:EditorImageAndText,代码行数:10,代码来源:BaseFragmentActivity.java

示例14: setImage

import com.facebook.drawee.view.SimpleDraweeView; //导入方法依赖的package包/类
public static void setImage(@NonNull SimpleDraweeView simpleDraweeView, @NonNull String url) {
  Uri uri = Uri.parse(url);
  ImageRequest request = ImageRequestBuilder.newBuilderWithSource(uri)
      .setProgressiveRenderingEnabled(true)
      .build();
  DraweeController controller = Fresco.newDraweeControllerBuilder()
      .setImageRequest(request)
      .setOldController(simpleDraweeView.getController())
      .build();
  simpleDraweeView.setController(controller);


}
 
开发者ID:MixAndroid,项目名称:MixUtils,代码行数:14,代码来源:ImageUtils.java

示例15: setUri

import com.facebook.drawee.view.SimpleDraweeView; //导入方法依赖的package包/类
private void setUri(SimpleDraweeView view, String url) {
    Uri uri = url == null ? Uri.EMPTY : Uri.parse(url);
    DraweeController controller = Fresco.newDraweeControllerBuilder()
            .setOldController(view.getController())
            .setTapToRetryEnabled(true)
            .setAutoPlayAnimations(true)
            .setUri(uri)
            .build();
    view.setController(controller);
}
 
开发者ID:mingdroid,项目名称:tumbviewer,代码行数:11,代码来源:PhotoPostVH.java


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