Java Code Examples for com.bumptech.glide.request.target.SizeReadyCallback#onSizeReady()

The following examples show how to use com.bumptech.glide.request.target.SizeReadyCallback#onSizeReady() . 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: 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 2
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 3
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 4
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 5
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 6
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 7
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 8
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 9
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 10
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 11
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);
}