Java 类com.facebook.drawee.drawable.ProgressBarDrawable 实例源码

项目:PicKing    文件:PicDialog.java   
public void show(final PicInfo picInfo) {
    if (picInfo != null && !"".equals(picInfo.getPicUrl())) {
        this.picInfo = picInfo;
        photoDraweeView.getHierarchy().setProgressBarImage(new ProgressBarDrawable());
        photoDraweeView.setPhotoUri(Uri.parse(picInfo.getPicUrl()));
    }
    if (picInfo.getTitle() != null)
        picTitle.setText(picInfo.getTitle());
    if (picInfo.getTime() != null)
        picTime.setText(picInfo.getTime());
    if (picInfo.getTags() != null) {
        tags.removeAllViews();
        for (String s : picInfo.getTags()) {
            TextView t = new TextView(getOwnerActivity());
            t.setText(s);
            ViewGroup.MarginLayoutParams layoutParams = new ViewGroup.MarginLayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
            layoutParams.setMarginEnd(15);
            t.setLayoutParams(layoutParams);
            t.setPadding(10, 10, 10, 10);
            t.setBackgroundColor(Color.GRAY);
            t.setTextColor(Color.WHITE);
            tags.addView(t);
        }
    }
    this.show();
}
项目:Li-MVPArms    文件:ConfigConstants.java   
public static GenericDraweeHierarchy getGenericDraweeHierarchy(Context context){
      GenericDraweeHierarchy gdh = new GenericDraweeHierarchyBuilder(context.getResources())
//            .reset()//重置
//            .setActualImageColorFilter(colorFilter)//颜色过滤
//            .setActualImageFocusPoint(focusPoint)//focusCrop, 需要指定一个居中点
//            .setActualImageMatrix(actualImageMatrix)
//            .setActualImageScaleType(actualImageScaleType)//fresco:actualImageScaleType="focusCrop"缩放类型
//            .setBackground(background)//fresco:backgroundImage="@color/blue"背景图片
//            .setBackgrounds(backgrounds)
//            .setFadeDuration(fadeDuration)//fresco:fadeDuration="300"加载图片动画时间
              .setFailureImage(ConfigConstants.sErrorDrawable)//fresco:failureImage="@drawable/error"失败图
//            .setFailureImage(failureDrawable, failureImageScaleType)//fresco:failureImageScaleType="centerInside"失败图缩放类型
//            .setOverlay(overlay)//fresco:overlayImage="@drawable/watermark"叠加图
//            .setOverlays(overlays)
              .setPlaceholderImage(ConfigConstants.sPlaceholderDrawable)//fresco:placeholderImage="@color/wait_color"占位图
//            .setPlaceholderImage(placeholderDrawable, placeholderImageScaleType)//fresco:placeholderImageScaleType="fitCenter"占位图缩放类型
//            .setPressedStateOverlay(drawable)//fresco:pressedStateOverlayImage="@color/red"按压状态下的叠加图
              .setProgressBarImage(new ProgressBarDrawable())//进度条fresco:progressBarImage="@drawable/progress_bar"进度条
//            .setProgressBarImage(progressBarImage, progressBarImageScaleType)//fresco:progressBarImageScaleType="centerInside"进度条类型
//            .setRetryImage(retryDrawable)//fresco:retryImage="@drawable/retrying"点击重新加载
//            .setRetryImage(retryDrawable, retryImageScaleType)//fresco:retryImageScaleType="centerCrop"点击重新加载缩放类型
              .setRoundingParams(RoundingParams.asCircle())//圆形/圆角fresco:roundAsCircle="true"圆形
              .build();
      return gdh;
  }
项目:ZoomableDraweeView-sample    文件:ViewPagerActivity.java   
@Override
public Object instantiateItem(ViewGroup container, int position) {
    ZoomableDraweeView view = new ZoomableDraweeView(container.getContext());
    view.setController(
            Fresco.newDraweeControllerBuilder()
                    .setUri(Uri.parse(items[position]))
                    .build());

    GenericDraweeHierarchy hierarchy =
            new GenericDraweeHierarchyBuilder(container.getResources())
                    .setActualImageScaleType(ScalingUtils.ScaleType.FIT_CENTER)
                    .setProgressBarImage(new ProgressBarDrawable())
                    .build();

    view.setHierarchy(hierarchy);

    container.addView(view,
            ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);

    return view;
}
项目:android-support-learn    文件:PApplication.java   
public static GenericDraweeHierarchy getGenericDraweeHierarchy(Context context){
        GenericDraweeHierarchy gdh = new GenericDraweeHierarchyBuilder(context.getResources())
//            .reset()//重置
//            .setActualImageColorFilter(colorFilter)//颜色过滤
//            .setActualImageFocusPoint(focusPoint)//focusCrop, 需要指定一个居中点
//            .setActualImageMatrix(actualImageMatrix)
//            .setActualImageScaleType(actualImageScaleType)//fresco:actualImageScaleType="focusCrop"缩放类型
//            .setBackground(background)//fresco:backgroundImage="@color/blue"背景图片
//            .setBackgrounds(backgrounds)
//            .setFadeDuration(fadeDuration)//fresco:fadeDuration="300"加载图片动画时间
         //       .setFailureImage(ConfigConstants.sErrorDrawable)//fresco:failureImage="@drawable/error"失败图
//            .setFailureImage(failureDrawable, failureImageScaleType)//fresco:failureImageScaleType="centerInside"失败图缩放类型
//            .setOverlay(overlay)//fresco:overlayImage="@drawable/watermark"叠加图
//            .setOverlays(overlays)
            //    .setPlaceholderImage(ConfigConstants.sPlaceholderDrawable)//fresco:placeholderImage="@color/wait_color"占位图
//            .setPlaceholderImage(placeholderDrawable, placeholderImageScaleType)//fresco:placeholderImageScaleType="fitCenter"占位图缩放类型
//            .setPressedStateOverlay(drawable)//fresco:pressedStateOverlayImage="@color/red"按压状态下的叠加图
                .setProgressBarImage(new ProgressBarDrawable())//进度条fresco:progressBarImage="@drawable/progress_bar"进度条
//            .setProgressBarImage(progressBarImage, progressBarImageScaleType)//fresco:progressBarImageScaleType="centerInside"进度条类型
//            .setRetryImage(retryDrawable)//fresco:retryImage="@drawable/retrying"点击重新加载
//            .setRetryImage(retryDrawable, retryImageScaleType)//fresco:retryImageScaleType="centerCrop"点击重新加载缩放类型
                .setRoundingParams(RoundingParams.asCircle())//圆形/圆角fresco:roundAsCircle="true"圆形
                .build();
        return gdh;
    }
项目:BlueBoard    文件:FrescoConfig.java   
public static GenericDraweeHierarchy getGenericDraweeHierarchy(Context context) {
        GenericDraweeHierarchy gdh = new GenericDraweeHierarchyBuilder(context.getResources())
//            .reset()//重置
//            .setActualImageColorFilter(colorFilter)//颜色过滤
//            .setActualImageFocusPoint(focusPoint)//focusCrop, 需要指定一个居中点
//            .setActualImageMatrix(actualImageMatrix)
//            .setActualImageScaleType(actualImageScaleType)//fresco:actualImageScaleType="focusCrop"缩放类型
//            .setBackground(background)//fresco:backgroundImage="@color/blue"背景图片
//            .setBackgrounds(backgrounds)
//            .setFadeDuration(fadeDuration)//fresco:fadeDuration="300"加载图片动画时间
                .setFailureImage(FrescoConfig.sErrorDrawable)//fresco:failureImage="@drawable/error"失败图
//            .setFailureImage(failureDrawable, failureImageScaleType)//fresco:failureImageScaleType="centerInside"失败图缩放类型
//            .setOverlay(overlay)//fresco:overlayImage="@drawable/watermark"叠加图
//            .setOverlays(overlays)
                .setPlaceholderImage(FrescoConfig.sPlaceholderDrawable)//fresco:placeholderImage="@color/wait_color"占位图
//            .setPlaceholderImage(placeholderDrawable, placeholderImageScaleType)//fresco:placeholderImageScaleType="fitCenter"占位图缩放类型
//            .setPressedStateOverlay(drawable)//fresco:pressedStateOverlayImage="@color/red"按压状态下的叠加图
                .setProgressBarImage(new ProgressBarDrawable())//进度条fresco:progressBarImage="@drawable/progress_bar"进度条
//            .setProgressBarImage(progressBarImage, progressBarImageScaleType)//fresco:progressBarImageScaleType="centerInside"进度条类型
//            .setRetryImage(retryDrawable)//fresco:retryImage="@drawable/retrying"点击重新加载
//            .setRetryImage(retryDrawable, retryImageScaleType)//fresco:retryImageScaleType="centerCrop"点击重新加载缩放类型
                .setRoundingParams(RoundingParams.asCircle())//圆形/圆角fresco:roundAsCircle="true"圆形
                .build();
        return gdh;
    }
项目:GitHub    文件:FrescoAdapter.java   
@Override
public FrescoHolder onCreateViewHolder(ViewGroup parent, int viewType) {
  GenericDraweeHierarchy gdh = new GenericDraweeHierarchyBuilder(getContext().getResources())
      .setPlaceholderImage(Drawables.sPlaceholderDrawable)
      .setFailureImage(Drawables.sErrorDrawable)
      .setProgressBarImage(new ProgressBarDrawable())
      .setActualImageScaleType(ScalingUtils.ScaleType.FIT_CENTER)
      .build();
  final InstrumentedDraweeView instrView = new InstrumentedDraweeView(getContext(), gdh);

  return new FrescoHolder(getContext(), parent, instrView, getPerfListener());
}
项目:Viajes    文件:CardViewAdapter.java   
@Override
    public void onBindViewHolder(CardViewAdapter.ViewHolder viewHolder, int i) {

        final Hotel fp = dataSet.get(i);
        String imageUrl = fp.getImagesUrls().get("image1");

        viewHolder.tvVersionName.setText(fp.getName());
        if (imageUrl != null) {
            int width = 120, height = 120;
            ImageRequest request = ImageRequestBuilder.newBuilderWithSource(Uri.parse(imageUrl))
                    .setResizeOptions(new ResizeOptions(width, height))
                    .build();
            DraweeController controller = Fresco.newDraweeControllerBuilder()
                    .setImageRequest(request)
                    .setTapToRetryEnabled(true)
                    .setOldController(viewHolder.img.getController())
                    .build();
            viewHolder.img.setController(controller);
            viewHolder.img.getHierarchy().setProgressBarImage(new ProgressBarDrawable());
        }
        viewHolder.lay.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                liAction.onHotelClick(fp);
            }
        });
//        viewHolder.explor.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View view) {
//                liAction.onHotelClick(fp);
//            }
//        });
//        viewHolder.iconView.setImageResource(fp.getThumbnail());
       // viewHolder.iconView.setBackgroundResource(fp.getThumbnail());

    }
项目:GalleryFinal-master    文件:FrescoImageLoader.java   
@Override
public void displayImage(Activity activity, String path, GFImageView imageView, Drawable defaultDrawable, int width, int height) {
    Resources resources = context.getResources();
    GenericDraweeHierarchy hierarchy = new GenericDraweeHierarchyBuilder(resources)
            .setFadeDuration(300)
            .setPlaceholderImage(defaultDrawable)
            .setFailureImage(defaultDrawable)
            .setProgressBarImage(new ProgressBarDrawable())
            .build();
    final DraweeHolder<GenericDraweeHierarchy> draweeHolder = DraweeHolder.create(hierarchy, context);
    imageView.setOnImageViewListener(new GFImageView.OnImageViewListener() {
        @Override
        public void onDetach() {
            draweeHolder.onDetach();
        }

        @Override
        public void onAttach() {
            draweeHolder.onAttach();
        }

        @Override
        public boolean verifyDrawable(Drawable dr) {
            if (dr == draweeHolder.getHierarchy().getTopLevelDrawable()) {
                return true;
            }
            return false;
        }
    });
    Uri uri = new Uri.Builder()
            .scheme(UriUtil.LOCAL_FILE_SCHEME)
            .path(path)
            .build();
    displayImage(uri, new ResizeOptions(width, height), imageView, draweeHolder);
}
项目:materialup    文件:FrescoUtils.java   
public static final void setShotHierarchy(Context context, DraweeView view, ScalingUtils.ScaleType type, int bg) {
    final Resources res = context.getResources();
    final int color = ThemeUtil.getThemeColor(context, R.attr.colorAccent);
    final ProgressBarDrawable progress = new ProgressBarDrawable();
    progress.setBackgroundColor(Color.parseColor("#33000000"));
    progress.setColor(color);
    GenericDraweeHierarchy gdh = new GenericDraweeHierarchyBuilder(res)
            .setPlaceholderImage(res.getDrawable(R.drawable.ic_holder))
            .setProgressBarImage(progress)
            .setBackground(new ColorDrawable(bg))
            .setActualImageScaleType(type)
            .build();
    view.setHierarchy(gdh);
}
项目:wechat-gallery    文件:FrescoImageLoader.java   
public void displayImage(Context context, String path, GFImageView imageView, int width, int height) {
        Resources resources = context.getResources();
        Drawable defaultDrawable = ContextCompat.getDrawable(context, R.drawable.common_crop_image_placeholder);
//        imageView.setImageDrawable(defaultDrawable);
        imageView.setImageDrawable(null);
        GenericDraweeHierarchy hierarchy = new GenericDraweeHierarchyBuilder(resources)
                .setFadeDuration(300)
                .setPlaceholderImage(defaultDrawable)
                .setFailureImage(defaultDrawable)
                .setProgressBarImage(new ProgressBarDrawable())
                .build();
        final DraweeHolder<GenericDraweeHierarchy> draweeHolder = DraweeHolder.create(hierarchy, context);
        imageView.setOnImageViewListener(new GFImageView.OnImageViewListener() {
            @Override
            public void onDetach() {
                draweeHolder.onDetach();
            }

            @Override
            public void onAttach() {
                draweeHolder.onAttach();
            }

            @Override
            public boolean verifyDrawable(Drawable dr) {
                if (dr == draweeHolder.getHierarchy().getTopLevelDrawable()) {
                    return true;
                }
                return false;
            }
        });
        Uri uri = new Uri.Builder()
                .scheme(UriUtil.LOCAL_FILE_SCHEME)
                .path(path)
                .build();
        displayImage(uri, new ResizeOptions(width, height), imageView, draweeHolder);
    }
项目:droidddle    文件:FrescoUtils.java   
public static final void setShotHierarchy(Context context, DraweeView view, ScalingUtils.ScaleType type) {
    final Resources res = context.getResources();
    final int color = ThemeUtil.getThemeColor(context, R.attr.colorAccent);
    final ProgressBarDrawable progress = new ProgressBarDrawable();
    progress.setBackgroundColor(Color.parseColor("#33000000"));
    progress.setColor(color);
    GenericDraweeHierarchy gdh = new GenericDraweeHierarchyBuilder(res)
            .setPlaceholderImage(res.getDrawable(R.drawable.placeholder))
            .setProgressBarImage(progress)
            .setActualImageScaleType(type)
            .build();
    view.setHierarchy(gdh);
}
项目:coderfun    文件:ImageActivity.java   
private void initSimpleDraweeView() {
    simpleDraweeView = (SimpleDraweeView) findViewById(R.id.draweeview);
    GenericDraweeHierarchy hierarchy = simpleDraweeView.getHierarchy();
    hierarchy.setProgressBarImage(new ProgressBarDrawable());
    Uri uri = Uri.parse(url);
    simpleDraweeView.setImageURI(uri);
}
项目:ZoomableDraweeView-sample    文件:ZoomableActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Uri data = getIntent().getData();
    if (null == data) {
        throw new IllegalArgumentException("No data to display");
    }

    String title = getIntent().getStringExtra(KEY_TITLE);
    if (title != null) {
        setTitle(title);
    }

    Fresco.initialize(this);
    setContentView(R.layout.activity_zoomable);

    ZoomableDraweeView view = (ZoomableDraweeView) findViewById(R.id.zoomable);

    DraweeController ctrl = Fresco.newDraweeControllerBuilder().setUri(
            data).setTapToRetryEnabled(true).build();
    GenericDraweeHierarchy hierarchy = new GenericDraweeHierarchyBuilder(getResources())
            .setActualImageScaleType(ScalingUtils.ScaleType.FIT_CENTER)
            .setProgressBarImage(new ProgressBarDrawable())
            .build();

    view.setController(ctrl);
    view.setHierarchy(hierarchy);
}
项目:redgram-for-reddit    文件:ImageManager.java   
private static GenericDraweeHierarchy buildGenericDraweesHierarchy(Context context) {
    GenericDraweeHierarchyBuilder builder =
            new GenericDraweeHierarchyBuilder(context.getResources());
    GenericDraweeHierarchy hierarchy = builder
            .setFadeDuration(300)
            .setActualImageFocusPoint(new PointF(0.5f, 0f))
            .setProgressBarImage(new ProgressBarDrawable())
            .build();
    return hierarchy;
}
项目:fresco    文件:FrescoAdapter.java   
@Override
public FrescoHolder onCreateViewHolder(ViewGroup parent, int viewType) {
  GenericDraweeHierarchy gdh = new GenericDraweeHierarchyBuilder(getContext().getResources())
      .setPlaceholderImage(Drawables.sPlaceholderDrawable)
      .setFailureImage(Drawables.sErrorDrawable)
      .setProgressBarImage(new ProgressBarDrawable())
      .setActualImageScaleType(ScalingUtils.ScaleType.FIT_CENTER)
      .build();
  final InstrumentedDraweeView instrView = new InstrumentedDraweeView(getContext(), gdh);

  return new FrescoHolder(getContext(), parent, instrView, getPerfListener());
}
项目:PicKing    文件:FavoriteAdapter.java   
public MyViewHolder(View itemView) {
    super(itemView);
    simpleDraweeView = (SimpleDraweeView) itemView.findViewById(R.id.fresco);
    simpleDraweeView.getHierarchy().setProgressBarImage(new ProgressBarDrawable());
    imageButton = (AppCompatImageButton) itemView.findViewById(R.id.love_button);
}
项目:PicKing    文件:DetailAdapter.java   
public MyViewHolder(View itemView) {
    super(itemView);
    simpleDraweeView = (SimpleDraweeView) itemView.findViewById(R.id.fresco);
    simpleDraweeView.getHierarchy().setProgressBarImage(new ProgressBarDrawable());
    imageButton = (AppCompatImageButton) itemView.findViewById(R.id.love_button);
}
项目:GalleryFinal    文件:FrescoImageLoader.java   
@Override
public void displayImage(Activity activity, String path, final GFImageView imageView, final Drawable defaultDrawable, int width, int height) {
    Resources resources = context.getResources();
    GenericDraweeHierarchy hierarchy = new GenericDraweeHierarchyBuilder(resources)
            .setFadeDuration(300)
            .setPlaceholderImage(defaultDrawable)
            .setFailureImage(defaultDrawable)
            .setProgressBarImage(new ProgressBarDrawable())
            .build();

    final DraweeHolder<GenericDraweeHierarchy> draweeHolder = DraweeHolder.create(hierarchy, context);
    imageView.setOnImageViewListener(new GFImageView.OnImageViewListener() {
        @Override
        public void onDetach() {
            draweeHolder.onDetach();
        }

        @Override
        public void onAttach() {
            draweeHolder.onAttach();
        }

        @Override
        public boolean verifyDrawable(Drawable dr) {
            if (dr == draweeHolder.getHierarchy().getTopLevelDrawable()) {
                return true;
            }
            return false;
        }

        @Override
        public void onDraw(Canvas canvas) {
            Drawable drawable = draweeHolder.getHierarchy().getTopLevelDrawable();
            if (drawable == null) {
                imageView.setImageDrawable(defaultDrawable);
            } else {
                imageView.setImageDrawable(drawable);
            }
        }
    });
    Uri uri = new Uri.Builder()
            .scheme(UriUtil.LOCAL_FILE_SCHEME)
            .path(path)
            .build();
    ImageRequest imageRequest = ImageRequestBuilder
            .newBuilderWithSource(uri)
            .setResizeOptions(new ResizeOptions(width, height))//图片目标大小
            .build();
    DraweeController controller = Fresco.newDraweeControllerBuilder()
            .setOldController(draweeHolder.getController())
            .setImageRequest(imageRequest)
            .build();
    draweeHolder.setController(controller);
}