com.bumptech.glide.request.target.SizeReadyCallback Java Examples

The following examples show how to use com.bumptech.glide.request.target.SizeReadyCallback. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ViewListAdapter.java    From GankDaily with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onBindViewHolder(final ViewHolder holder,final int position) {
    Girl entity = mListData.get(position);

    Glide.with(mContext)
            .load(entity.url)
            .centerCrop()
            .diskCacheStrategy(DiskCacheStrategy.ALL)
            .dontAnimate()
            .into(holder.mIvIndexPhoto)
            .getSize(new SizeReadyCallback() {
                @Override
                public void onSizeReady(int width, int height) {
                    //holder.mIvIndexPhoto.setColorFilter(mColorFilter);
                }
            });
    holder.mTvTime.setText(DateUtil.toDate(entity.publishedAt));
    if(mIClickItem!=null){
        holder.mIvIndexPhoto.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                mIClickItem.onClickPhoto(position, holder.mIvIndexPhoto,holder.mTvTime);
            }
        });
    }
}
 
Example #2
Source File: ImageTarget.java    From RichText with MIT License 5 votes vote down vote up
@Override
public void getSize(SizeReadyCallback cb) {
    int maxWidth = getRealWidth(), maxHeight = Integer.MAX_VALUE;
    if (config.imageFixCallback != null) {
        holder.setImageState(ImageHolder.ImageState.SIZE_READY);
        ImageHolder.SizeHolder sizeHolder = new ImageHolder.SizeHolder(0, 0);
        config.imageFixCallback.onSizeReady(holder, 0, 0, sizeHolder);
        if (sizeHolder.isInvalidateSize()) {
            maxWidth = sizeHolder.getWidth();
            maxHeight = sizeHolder.getHeight();
        }
    }
    cb.onSizeReady(maxWidth, maxHeight);
}
 
Example #3
Source File: BindingUtil.java    From CompositionAvatar with MIT License 5 votes vote down vote up
@Override
public void getSize(SizeReadyCallback cb) {
    // FIXME 这里为了图方面,直接加载原图了,生产环境上应该是高和宽都取mView.getDrawableSize()。
    // 但是这里直接取的话也不一定能取到正确的值,所以建义在
    // android.view.ViewTreeObserver.OnPreDrawListener中做处理。
    // 另外,DrawableSize会因图片数量改变而改变,所以建义异步加载图像之前
    // 应当先设置占位图。如果图片的数量是动态可变的的话,也建义做针对性处理。
    cb.onSizeReady(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL);
}
 
Example #4
Source File: VinylSimpleTarget.java    From VinylMusicPlayer with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void getSize(@NonNull SizeReadyCallback cb) {
    if (!Util.isValidDimensions(width, height)) {
        throw new IllegalArgumentException(
                "Width and height must both be > 0 or Target#SIZE_ORIGINAL, but given" + " width: "
                        + width + " and height: " + height + ", either provide dimensions in the constructor"
                        + " or call override()");
    }
    cb.onSizeReady(width, height);
}
 
Example #5
Source File: CustomTarget.java    From Simple-Dilbert with Apache License 2.0 4 votes vote down vote up
@Override
public final void removeCallback(@NonNull SizeReadyCallback cb) {
    // Do nothing, this class does not retain SizeReadyCallbacks.
}
 
Example #6
Source File: RequestFutureTarget.java    From giffun with Apache License 2.0 4 votes vote down vote up
/**
 * A callback that should never be invoked directly.
 */
@Override
public void getSize(SizeReadyCallback cb) {
    cb.onSizeReady(width, height);
}
 
Example #7
Source File: CustomTarget.java    From Simple-Dilbert with Apache License 2.0 4 votes vote down vote up
@Override
public final void getSize(@NonNull SizeReadyCallback cb) {
    cb.onSizeReady(width, height);
}
 
Example #8
Source File: WrappingTarget.java    From VideoListPlayer with MIT License 4 votes vote down vote up
@Override
public void getSize(SizeReadyCallback cb) {
    target.getSize(cb);
}
 
Example #9
Source File: VideoLoadTarget.java    From VideoListPlayer with MIT License 4 votes vote down vote up
@Override
public void getSize(SizeReadyCallback cb) {
    cb.onSizeReady(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL);
}
 
Example #10
Source File: AbstractIconTarget.java    From GeometricWeather with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public void getSize(SizeReadyCallback cb) {
    cb.onSizeReady(size, size);
}
 
Example #11
Source File: DemoFragment.java    From static-maps-api with Apache License 2.0 4 votes vote down vote up
@Override
public void getSize(SizeReadyCallback cb) {
    cb.onSizeReady(dpToPx(ICON_SIZE), dpToPx(ICON_SIZE));
}
 
Example #12
Source File: WrappingTarget.java    From StatusStories with Apache License 2.0 4 votes vote down vote up
@Override public void getSize(SizeReadyCallback cb) {
    target.getSize(cb);
}
 
Example #13
Source File: GlideImageGetter.java    From Infinity-For-Reddit with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public void removeCallback(@NonNull SizeReadyCallback cb) {}
 
Example #14
Source File: GlideImageGetter.java    From Infinity-For-Reddit with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public void getSize(@NonNull SizeReadyCallback cb) {
    cb.onSizeReady(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL);
}
 
Example #15
Source File: WrappingTarget.java    From imsdk-android with MIT License 4 votes vote down vote up
@Override
public void getSize(SizeReadyCallback cb) {
    if (target != null) target.getSize(cb);
}
 
Example #16
Source File: SimpleFileTarget.java    From imsdk-android with MIT License 4 votes vote down vote up
@Override
public void getSize(SizeReadyCallback cb) {
    cb.onSizeReady(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL);
}
 
Example #17
Source File: ListPreloader.java    From giffun with Apache License 2.0 4 votes vote down vote up
@Override
public void getSize(SizeReadyCallback cb) {
    cb.onSizeReady(photoWidth, photoHeight);
}
 
Example #18
Source File: ViewPreloadSizeProvider.java    From giffun with Apache License 2.0 4 votes vote down vote up
public SizeViewTarget(View view, SizeReadyCallback callback) {
    super(view);
    getSize(callback);
}
 
Example #19
Source File: VinylSimpleTarget.java    From VinylMusicPlayer with GNU General Public License v3.0 2 votes vote down vote up
@Override
public void removeCallback(@NonNull SizeReadyCallback cb) {

}