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


Java ImageViewTarget类代码示例

本文整理汇总了Java中com.bumptech.glide.request.target.ImageViewTarget的典型用法代码示例。如果您正苦于以下问题:Java ImageViewTarget类的具体用法?Java ImageViewTarget怎么用?Java ImageViewTarget使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: onLoadFailed

import com.bumptech.glide.request.target.ImageViewTarget; //导入依赖的package包/类
@Override
public boolean onLoadFailed(GlideException e, Object model, Target<PictureDrawable> target,
    boolean isFirstResource) {
  ImageView view = ((ImageViewTarget<?>) target).getView();
  view.setLayerType(ImageView.LAYER_TYPE_NONE, null);
  return false;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:SvgSoftwareLayerSetter.java

示例2: onResourceReady

import com.bumptech.glide.request.target.ImageViewTarget; //导入依赖的package包/类
@Override
public boolean onResourceReady(PictureDrawable resource, Object model,
    Target<PictureDrawable> target, DataSource dataSource, boolean isFirstResource) {
  ImageView view = ((ImageViewTarget<?>) target).getView();
  view.setLayerType(ImageView.LAYER_TYPE_SOFTWARE, null);
  return false;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:SvgSoftwareLayerSetter.java

示例3: displayVideoThumbnail

import com.bumptech.glide.request.target.ImageViewTarget; //导入依赖的package包/类
private void displayVideoThumbnail(ViewHolder h, Video v) {
    Glide.with(h.mThumbnail.getContext())
            .load(v.getThumbnailUrl())
            .centerCrop()
            .crossFade()
            .into(new ImageViewTarget<GlideDrawable>(h.mThumbnail) {
                @Override
                protected void setResource(GlideDrawable resource) {
                    view.setImageDrawable(resource);
                }

                public void onLoadFailed(Exception e, Drawable errorDrawable) {
                    view.setImageResource(R.drawable.ic_photo_grey600_48dp);
                }
            });
}
 
开发者ID:aprochukhan,项目名称:Android-MVVM-Example,代码行数:17,代码来源:VideoListAdapter.java

示例4: onException

import com.bumptech.glide.request.target.ImageViewTarget; //导入依赖的package包/类
@Override
public boolean onException(
        Exception e,
        GlideUrl uri,
        Target<GlideDrawable> target,
        boolean isFirstResource
) {
    OkHttpProgressGlideModule.forget(uri.toStringUrl());
    if (!(target instanceof ImageViewTarget)) {
        return false;
    }
    ImageViewWithUrl view = (ImageViewWithUrl) ((ImageViewTarget) target).getView();
    ThemedReactContext context = (ThemedReactContext) view.getContext();
    RCTEventEmitter eventEmitter = context.getJSModule(RCTEventEmitter.class);
    int viewId = view.getId();
    eventEmitter.receiveEvent(viewId, REACT_ON_ERROR_EVENT, new WritableNativeMap());
    eventEmitter.receiveEvent(viewId, REACT_ON_LOAD_END_EVENT, new WritableNativeMap());
    return false;
}
 
开发者ID:DylanVann,项目名称:react-native-fast-image,代码行数:20,代码来源:FastImageViewManager.java

示例5: onResourceReady

import com.bumptech.glide.request.target.ImageViewTarget; //导入依赖的package包/类
@Override
public boolean onResourceReady(
        GlideDrawable resource,
        GlideUrl uri,
        Target<GlideDrawable> target,
        boolean isFromMemoryCache,
        boolean isFirstResource
) {
    if (!(target instanceof ImageViewTarget)) {
        return false;
    }
    ImageViewWithUrl view = (ImageViewWithUrl) ((ImageViewTarget) target).getView();
    ThemedReactContext context = (ThemedReactContext) view.getContext();
    RCTEventEmitter eventEmitter = context.getJSModule(RCTEventEmitter.class);
    int viewId = view.getId();
    eventEmitter.receiveEvent(viewId, REACT_ON_LOAD_EVENT, new WritableNativeMap());
    eventEmitter.receiveEvent(viewId, REACT_ON_LOAD_END_EVENT, new WritableNativeMap());
    return false;
}
 
开发者ID:DylanVann,项目名称:react-native-fast-image,代码行数:20,代码来源:FastImageViewManager.java

示例6: load

import com.bumptech.glide.request.target.ImageViewTarget; //导入依赖的package包/类
private void load(int position) {
    Glide.with(this).load(testPhoto.get(position))
            .asBitmap()
            .diskCacheStrategy(DiskCacheStrategy.ALL)
            .into(new ImageViewTarget<Bitmap>(photoView) {


                @Override
                public void onLoadFailed(Exception e, Drawable errorDrawable) {
                    super.onLoadFailed(e, errorDrawable);
                    Toast.makeText(TestPhotoViewActivity.this, "load fail", Toast.LENGTH_SHORT).show();
                }


                @Override
                protected void setResource(Bitmap resource) {
                    getView().setImageBitmap(resource);
                }
            });

}
 
开发者ID:leobert-lan,项目名称:UiLib,代码行数:22,代码来源:TestPhotoViewActivity.java

示例7: showAvatar

import com.bumptech.glide.request.target.ImageViewTarget; //导入依赖的package包/类
@Override
public void showAvatar(String avatarUrl) {
    this.avatarUrl=avatarUrl;
    Glide.with(getContext())
            .load(avatarUrl)
            .asBitmap()
            .priority(Priority.IMMEDIATE)
            .into(new ImageViewTarget<Bitmap>(avatar) {
                @Override
                protected void setResource(Bitmap resource) {
                    avatar.setImageBitmap(resource);
                    avatar.post(()->{
                        media.post(()->{
                            View blank = adapter.getBlank();
                            ViewGroup.LayoutParams params = blank.getLayoutParams();
                            params.height = followers.getTop()+followers.getHeight()
                                    +2*getResources().getDimensionPixelOffset(R.dimen.spacing_large);
                            blank.setLayoutParams(params);
                        });
                        media.setVisibility(View.INVISIBLE);
                        getActivity().supportStartPostponedEnterTransition();
                        presenter.start(id);
                    });
                }
            });
}
 
开发者ID:vpaliyX,项目名称:Melophile,代码行数:27,代码来源:PersonFragment.java

示例8: instantiateItem

import com.bumptech.glide.request.target.ImageViewTarget; //导入依赖的package包/类
@Override
public View instantiateItem(ViewGroup container, int position) {
    View view=inflater.inflate(R.layout.adapter_album,container,false);
    ImageView image= ButterKnife.findById(view,R.id.image);

    Glide.with(container.getContext())
            .load(albums.get(position).getArtworkUrl())
            .asBitmap()
            .priority(Priority.IMMEDIATE)
            .diskCacheStrategy(DiskCacheStrategy.RESULT)
            .into(new ImageViewTarget<Bitmap>(image) {
                @Override
                protected void setResource(Bitmap resource) {
                    image.setImageBitmap(resource);
                    if (position == current && !isLoaded) {
                        isLoaded = true;
                        if (callback != null) {
                            callback.onTransitionImageLoaded(image,resource);
                        }
                    }
                }
            });
    container.addView(view);
    return view;
}
 
开发者ID:vpaliyX,项目名称:Melophile,代码行数:26,代码来源:AlbumAdapter.java

示例9: showArt

import com.bumptech.glide.request.target.ImageViewTarget; //导入依赖的package包/类
public void showArt(String artUrl){
    if(!TextUtils.equals(lastArtUrl,artUrl)) {
        lastArtUrl=artUrl;
        Glide.with(getContext())
                .load(artUrl)
                .asBitmap()
                .priority(Priority.IMMEDIATE)
                .into(new ImageViewTarget<Bitmap>(smallImage) {
                    @Override
                    protected void setResource(Bitmap resource) {
                        smallImage.setImageBitmap(resource);
                        smallImage.post(()->{
                            Blurry.with(getContext())
                                    .async(bitmap->{
                                        background.setImageDrawable(bitmap);
                                        getActivity().supportStartPostponedEnterTransition();
                                    })
                                    .from(resource)
                                    .into(background);
                        });
                    }
                });
    }
}
 
开发者ID:vpaliyX,项目名称:Melophile,代码行数:25,代码来源:TrackFragment.java

示例10: showPlaylistArt

import com.bumptech.glide.request.target.ImageViewTarget; //导入依赖的package包/类
@Override
public void showPlaylistArt(String artUrl) {
    if(!loaded) {
        loaded=true;
        Glide.with(getContext())
                .load(artUrl)
                .asBitmap()
                .priority(Priority.IMMEDIATE)
                .into(new ImageViewTarget<Bitmap>(playlistArt) {
                    @Override
                    protected void setResource(Bitmap resource) {
                        final int imageHeight=playlistArt.getHeight();
                        playlistArt.setImageBitmap(resource);
                        parent.setStaticOffset(imageHeight);
                        parent.setOffset(imageHeight);
                        toggle.setStaticOffset(imageHeight- toggle.getHeight()/2);
                        toggle.setOffset(imageHeight- toggle.getHeight()/2);
                        toggle.setMinOffset(ViewCompat.getMinimumHeight(playlistArt)- toggle.getHeight()/2);
                        tracks.addOnScrollListener(listener);
                        tracks.setOnFlingListener(flingListener);
                        new Palette.Builder(resource).generate(PlaylistFragment.this::applyPalette);
                        getActivity().supportStartPostponedEnterTransition();
                    }
                });
    }
}
 
开发者ID:vpaliyX,项目名称:Melophile,代码行数:27,代码来源:PlaylistFragment.java

示例11: onBindViewHolder

import com.bumptech.glide.request.target.ImageViewTarget; //导入依赖的package包/类
@Override
public void onBindViewHolder(final ViewHolder holder, int position) {
    if(!(sponsorItemArrayList.get(position).sponsor_name.isEmpty())){
        holder.sponsorname.setText(sponsorItemArrayList.get(position).sponsor_name);
    }

    if(!(sponsorItemArrayList.get(position).image_id==null)){
       // holder.sponsorimage.setImageResource(sponsorItemArrayList.get(position).image_id);
        Glide.with(context).load(sponsorItemArrayList.get(position).image_id).asBitmap().diskCacheStrategy(DiskCacheStrategy.ALL).into(new ImageViewTarget<Bitmap>(holder.sponsorimage) {
            @Override
            protected void setResource(Bitmap resource) {
                RoundedBitmapDrawable drawable= RoundedBitmapDrawableFactory.create(context.getResources(),resource);
                drawable.setCircular(false);
                holder.sponsorimage.setImageDrawable(drawable);
            }
        });
    }
}
 
开发者ID:appteam-nith,项目名称:Hillffair,代码行数:19,代码来源:SponsorAdapter.java

示例12: convert

import com.bumptech.glide.request.target.ImageViewTarget; //导入依赖的package包/类
@Override
    protected void convert(final BaseAdapterHelper helper, T item, int position) {
        final RadioImageView story_img = (RadioImageView) helper.getView(R.id.story_img);
        TextView story_title = helper.getTextView(R.id.story_item_title);

        story_title.setText(item.getStory_title());
        Glide.with(helper.itemView.getContext())
                .load(item.getImgUrl())
//                                //设置占位图或者加载错误图:
//                        .placeholder(R.drawable.ic_sun_smile)
//                        .error(R.drawable.ic_cloud_sad)
                .diskCacheStrategy(DiskCacheStrategy.ALL)
                .into(new ImageViewTarget<GlideDrawable>(story_img) {
                    @Override
                    protected void setResource(GlideDrawable resource) {

                        story_img.setOriginalSize(resource.getIntrinsicWidth(), resource.getIntrinsicHeight());
                        story_img.setImageDrawable(resource);
                    }
                });

        helper.itemView.setTag(position);
    }
 
开发者ID:qq137712630,项目名称:MeiZiNews,代码行数:24,代码来源:ImageAdapter.java

示例13: initData

import com.bumptech.glide.request.target.ImageViewTarget; //导入依赖的package包/类
private void initData() {
    if (mPlayBean!=null){
        livePlayerPresenterImpl.enterRoom(mPlayBean.uid);
    }

    Glide.with(this)
            .load(mPlayBean.love_cover)
            .into(new ImageViewTarget<GlideDrawable>(bgImg) {
                @Override
                protected void setResource(GlideDrawable resource) {
                    bgImg.setImageDrawable(resource);
                    Blurry.with(VerFullLiveUI.this)
                            .animate()
                            .radius(10)
                            .sampling(8)
                            .capture(bgImg)
                            .into(bgImg);
                }
            });
}
 
开发者ID:a371166028,项目名称:likequanmintv,代码行数:21,代码来源:VerFullLiveUI.java

示例14: displayImage

import com.bumptech.glide.request.target.ImageViewTarget; //导入依赖的package包/类
@Override
public void displayImage(Activity activity, String path, final GFImageView imageView, Drawable defaultDrawable, int width, int height) {
    Glide.with(activity)
            .load("file://" + path)
            .placeholder(defaultDrawable)
            .error(defaultDrawable)
            .override(width, height)
            .diskCacheStrategy(DiskCacheStrategy.NONE) //不缓存到SD卡
            .skipMemoryCache(true)
            //.centerCrop()
            .into(new ImageViewTarget<GlideDrawable>(imageView) {
                @Override
                protected void setResource(GlideDrawable resource) {
                    imageView.setImageDrawable(resource);
                }

                @Override
                public void setRequest(Request request) {
                }
            });
}
 
开发者ID:Liar1995,项目名称:GeneqiaoGallery,代码行数:22,代码来源:GlideImageLoader.java

示例15: loadAndCompressImage

import com.bumptech.glide.request.target.ImageViewTarget; //导入依赖的package包/类
protected void loadAndCompressImage(String url, ImageView view) {
    getRequestManager()
            .load(url)
            .downloadOnly(new ImageViewTarget<File>(view) {
                @Override
                protected void setResource(File resource) {
                    Bitmap bitmap = ImageUtils.resizeBitmap(resource, view.getWidth(), view.getHeight());
                    view.setImageBitmap(bitmap);
                }
            });
}
 
开发者ID:HanyeeWang,项目名称:GeekZone,代码行数:12,代码来源:BaseAdapter.java


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