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 Project: GankDaily   Author: maoruibin   File: ViewListAdapter.java    License: 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 Project: CompositionAvatar   Author: YiiGuxing   File: BindingUtil.java    License: 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 #3
Source Project: VinylMusicPlayer   Author: AdrienPoupa   File: VinylSimpleTarget.java    License: 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 #4
Source Project: RichText   Author: zzhoujay   File: ImageTarget.java    License: 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 #5
Source Project: giffun   Author: guolindev   File: RequestFutureTarget.java    License: 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 #6
Source Project: giffun   Author: guolindev   File: ViewPreloadSizeProvider.java    License: Apache License 2.0 4 votes vote down vote up
public SizeViewTarget(View view, SizeReadyCallback callback) {
    super(view);
    getSize(callback);
}
 
Example #7
Source Project: giffun   Author: guolindev   File: ListPreloader.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void getSize(SizeReadyCallback cb) {
    cb.onSizeReady(photoWidth, photoHeight);
}
 
Example #8
Source Project: imsdk-android   Author: qunarcorp   File: SimpleFileTarget.java    License: MIT License 4 votes vote down vote up
@Override
public void getSize(SizeReadyCallback cb) {
    cb.onSizeReady(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL);
}
 
Example #9
Source Project: imsdk-android   Author: qunarcorp   File: WrappingTarget.java    License: MIT License 4 votes vote down vote up
@Override
public void getSize(SizeReadyCallback cb) {
    if (target != null) target.getSize(cb);
}
 
Example #10
Source Project: Infinity-For-Reddit   Author: Docile-Alligator   File: GlideImageGetter.java    License: 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 #11
Source Project: Infinity-For-Reddit   Author: Docile-Alligator   File: GlideImageGetter.java    License: GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public void removeCallback(@NonNull SizeReadyCallback cb) {}
 
Example #12
Source Project: StatusStories   Author: RahulJanagouda   File: WrappingTarget.java    License: Apache License 2.0 4 votes vote down vote up
@Override public void getSize(SizeReadyCallback cb) {
    target.getSize(cb);
}
 
Example #13
Source Project: static-maps-api   Author: renaudcerrato   File: DemoFragment.java    License: 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 #14
Source Project: GeometricWeather   Author: WangDaYeeeeee   File: AbstractIconTarget.java    License: GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public void getSize(SizeReadyCallback cb) {
    cb.onSizeReady(size, size);
}
 
Example #15
Source Project: VideoListPlayer   Author: waynell   File: VideoLoadTarget.java    License: MIT License 4 votes vote down vote up
@Override
public void getSize(SizeReadyCallback cb) {
    cb.onSizeReady(Target.SIZE_ORIGINAL, Target.SIZE_ORIGINAL);
}
 
Example #16
Source Project: VideoListPlayer   Author: waynell   File: WrappingTarget.java    License: MIT License 4 votes vote down vote up
@Override
public void getSize(SizeReadyCallback cb) {
    target.getSize(cb);
}
 
Example #17
Source Project: Simple-Dilbert   Author: smarek   File: CustomTarget.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public final void getSize(@NonNull SizeReadyCallback cb) {
    cb.onSizeReady(width, height);
}
 
Example #18
Source Project: Simple-Dilbert   Author: smarek   File: CustomTarget.java    License: 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 #19
Source Project: VinylMusicPlayer   Author: AdrienPoupa   File: VinylSimpleTarget.java    License: GNU General Public License v3.0 2 votes vote down vote up
@Override
public void removeCallback(@NonNull SizeReadyCallback cb) {

}