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