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


Java ImageHolder类代码示例

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


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

示例1: onSizeReady

import com.zzhoujay.richtext.ImageHolder; //导入依赖的package包/类
@Override
public int onSizeReady(int width, int height) {
    holder.setImageState(ImageHolder.ImageState.SIZE_READY);
    ImageHolder.SizeHolder sizeHolder = new ImageHolder.SizeHolder(width, height);
    if (config.imageFixCallback != null) {
        config.imageFixCallback.onSizeReady(holder, width, height, sizeHolder);
    }
    int exactSampleSize;
    if (sizeHolder.isInvalidateSize()) {
        exactSampleSize = getSampleSize(width, height, sizeHolder.getWidth(), sizeHolder.getHeight());
    } else {
        exactSampleSize = getSampleSize(width, height, getRealWidth(), Integer.MAX_VALUE);
    }
    int powerOfTwoSampleSize = exactSampleSize == 0 ? 0 : Integer.highestOneBit(exactSampleSize);
    return Math.max(1, powerOfTwoSampleSize);
}
 
开发者ID:nichbar,项目名称:Aequorea,代码行数:17,代码来源:AbstractImageLoader.java

示例2: read

import com.zzhoujay.richtext.ImageHolder; //导入依赖的package包/类
private static SizeCacheHolder read(InputStream fis, String name) {
    try {
        int left = readInt(fis);
        int top = readInt(fis);
        int right = readInt(fis);
        int bottom = readInt(fis);
        int scaleType = readInt(fis);
        boolean showBorder = readBoolean(fis);
        int color = readInt(fis);
        float borderSize = readFloat(fis);
        float borderRadius = readFloat(fis);
        fis.close();
        Rect rect = new Rect(left, top, right, bottom);
        ImageHolder.BorderHolder borderHolder = new ImageHolder.BorderHolder(showBorder, borderSize, color, borderRadius);
        return new SizeCacheHolder(name, rect, getScaleType(scaleType), borderHolder);
    } catch (IOException e) {
        Debug.e(e);
    }
    return null;
}
 
开发者ID:nichbar,项目名称:Aequorea,代码行数:21,代码来源:BitmapWrapper.java

示例3: getScaleType

import com.zzhoujay.richtext.ImageHolder; //导入依赖的package包/类
@ImageHolder.ScaleType
private static int getScaleType(int value) {
    switch (value) {
        case ImageHolder.ScaleType.CENTER:
            return ImageHolder.ScaleType.CENTER;
        case ImageHolder.ScaleType.CENTER_CROP:
            return ImageHolder.ScaleType.CENTER_CROP;
        case ImageHolder.ScaleType.CENTER_INSIDE:
            return ImageHolder.ScaleType.CENTER_INSIDE;
        case ImageHolder.ScaleType.FIT_CENTER:
            return ImageHolder.ScaleType.FIT_CENTER;
        case ImageHolder.ScaleType.FIT_START:
            return ImageHolder.ScaleType.FIT_START;
        case ImageHolder.ScaleType.FIT_END:
            return ImageHolder.ScaleType.FIT_END;
        case ImageHolder.ScaleType.FIT_XY:
            return ImageHolder.ScaleType.FIT_XY;
        case ImageHolder.ScaleType.FIT_AUTO:
            return ImageHolder.ScaleType.FIT_AUTO;
        default:
            return ImageHolder.ScaleType.NONE;
    }
}
 
开发者ID:nichbar,项目名称:Aequorea,代码行数:24,代码来源:BitmapWrapper.java

示例4: read

import com.zzhoujay.richtext.ImageHolder; //导入依赖的package包/类
public static DrawableSizeHolder read(InputStream fis, String name) {
    try {
        float left = readFloat(fis);
        float top = readFloat(fis);
        float right = readFloat(fis);
        float bottom = readFloat(fis);
        int scaleType = readInt(fis);
        boolean showBorder = readBoolean(fis);
        int color = readInt(fis);
        float borderSize = readFloat(fis);
        float borderRadius = readFloat(fis);
        fis.close();
        RectF border = new RectF(left, top, right, bottom);
        DrawableBorderHolder borderHolder = new DrawableBorderHolder(showBorder, borderSize, color, borderRadius);
        return new DrawableSizeHolder(name, border, ImageHolder.ScaleType.valueOf(scaleType), borderHolder);
    } catch (IOException e) {
        Debug.e(e);
    }
    return null;
}
 
开发者ID:zzhoujay,项目名称:RichText,代码行数:21,代码来源:DrawableSizeHolder.java

示例5: setBorderHolder

import com.zzhoujay.richtext.ImageHolder; //导入依赖的package包/类
public void setBorderHolder(ImageHolder.BorderHolder borderHolder) {
    this.borderHolder = borderHolder;
    if (borderHolder != null) {
        paint.setColor(borderHolder.getBorderColor());
        paint.setStrokeWidth(borderHolder.getBorderSize());
        paint.setStyle(Paint.Style.STROKE);
    }
}
 
开发者ID:nichbar,项目名称:Aequorea,代码行数:9,代码来源:DrawableWrapper.java

示例6: errorHandle

import com.zzhoujay.richtext.ImageHolder; //导入依赖的package包/类
private void errorHandle(ImageHolder holder, RichTextConfig config, TextView textView, DrawableWrapper drawableWrapper,
                         BitmapWrapper.SizeCacheHolder sizeCacheHolder, Exception e) {
    AbstractImageLoader imageLoader = new AbstractImageLoader<Object>(holder, config, textView, drawableWrapper, this, null, sizeCacheHolder) {

    };
    imageLoader.onFailure(e);
}
 
开发者ID:nichbar,项目名称:Aequorea,代码行数:8,代码来源:DefaultImageGetter.java

示例7: loadFromLocalDisk

import com.zzhoujay.richtext.ImageHolder; //导入依赖的package包/类
private Drawable loadFromLocalDisk(ImageHolder holder, RichTextConfig config, TextView textView, DrawableWrapper drawableWrapper) {
    Cancelable cancelable;
    AbstractImageLoader imageLoader;
    LocalDiskCachedImageLoader localDiskCachedImageLoader = new LocalDiskCachedImageLoader(holder, config, textView, drawableWrapper, this);
    Future<?> future = getExecutorService().submit(localDiskCachedImageLoader);
    cancelable = new FutureCancelableWrapper(future);
    imageLoader = localDiskCachedImageLoader;
    checkTarget(textView);
    addTask(cancelable, imageLoader);
    return drawableWrapper;
}
 
开发者ID:nichbar,项目名称:Aequorea,代码行数:12,代码来源:DefaultImageGetter.java

示例8: loadFromMemory

import com.zzhoujay.richtext.ImageHolder; //导入依赖的package包/类
@NonNull
private Drawable loadFromMemory(ImageHolder holder, TextView textView, DrawableWrapper drawableWrapper) {
    BitmapWrapper bitmapWrapper = BitmapPool.getPool().get(holder.getKey(), false, true);
    Bitmap bitmap = bitmapWrapper.getBitmap();
    BitmapDrawable bitmapDrawable = new BitmapDrawable(textView.getResources(), bitmap);
    bitmapDrawable.setBounds(0, 0, bitmap.getWidth(), bitmap.getHeight());
    drawableWrapper.setDrawable(bitmapDrawable);
    BitmapWrapper.SizeCacheHolder sizeCacheHolder = bitmapWrapper.getSizeCacheHolder();
    drawableWrapper.setBounds(sizeCacheHolder.rect);
    drawableWrapper.setScaleType(sizeCacheHolder.scaleType);
    drawableWrapper.calculate();
    return drawableWrapper;
}
 
开发者ID:nichbar,项目名称:Aequorea,代码行数:14,代码来源:DefaultImageGetter.java

示例9: AbstractImageLoader

import com.zzhoujay.richtext.ImageHolder; //导入依赖的package包/类
AbstractImageLoader(ImageHolder holder, RichTextConfig config, TextView textView, DrawableWrapper drawableWrapper, ImageLoadNotify iln, SourceDecode<T> sourceDecode, BitmapWrapper.SizeCacheHolder sizeCacheHolder) {
    this.holder = holder;
    this.config = config;
    this.sourceDecode = sourceDecode;
    this.textViewWeakReference = new WeakReference<>(textView);
    this.drawableWrapperWeakReference = new WeakReference<>(drawableWrapper);
    this.notifyWeakReference = new WeakReference<>(iln);
    this.sizeCacheHolder = sizeCacheHolder;
    onLoading();
}
 
开发者ID:nichbar,项目名称:Aequorea,代码行数:11,代码来源:AbstractImageLoader.java

示例10: getHolderWidth

import com.zzhoujay.richtext.ImageHolder; //导入依赖的package包/类
private int getHolderWidth(int width) {
    int w = holder.getWidth();
    if (w == ImageHolder.MATCH_PARENT) {
        w = getRealWidth();
    } else if (w == ImageHolder.WRAP_CONTENT) {
        w = width;
    }
    if (w <= 0) {
        return getRealWidth();
    }
    return w;
}
 
开发者ID:nichbar,项目名称:Aequorea,代码行数:13,代码来源:AbstractImageLoader.java

示例11: getHolderHeight

import com.zzhoujay.richtext.ImageHolder; //导入依赖的package包/类
private int getHolderHeight(int height) {
    int h = holder.getHeight();
    if (h == ImageHolder.MATCH_PARENT) {
        h = getRealHeight();
    } else if (h == ImageHolder.WRAP_CONTENT) {
        h = height;
    }
    if (h <= 0) {
        return getRealWidth() / 2;
    }
    return h;
}
 
开发者ID:nichbar,项目名称:Aequorea,代码行数:13,代码来源:AbstractImageLoader.java

示例12: decode

import com.zzhoujay.richtext.ImageHolder; //导入依赖的package包/类
public ImageWrapper decode(ImageHolder holder, T t, BitmapFactory.Options options) {
    if (holder.isAutoPlay() && (holder.isGif() || isGif(t, options))) {
        holder.setIsGif(true);
        return decodeAsGif(t, options);
    } else {
        return decodeAsBitmap(t, options);
    }
}
 
开发者ID:nichbar,项目名称:Aequorea,代码行数:9,代码来源:SourceDecode.java

示例13: onResourceReady

import com.zzhoujay.richtext.ImageHolder; //导入依赖的package包/类
@Override
public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) {
    if (!activityIsAlive()) {
        return;
    }
    DrawableWrapper drawableWrapper = urlDrawableWeakReference.get();
    if (drawableWrapper == null) {
        return;
    }
    TextView textView = textViewWeakReference.get();
    holder.setImageState(ImageHolder.ImageState.READY);
    holder.setSize(resource.getWidth(), resource.getHeight());
    Drawable drawable = new BitmapDrawable(textView.getContext().getResources(), resource);
    drawableWrapper.setDrawable(drawable);
    if (rect != null) {
        drawableWrapper.setBounds(rect);
    } else {
        if (!config.autoFix && config.imageFixCallback != null) {
            config.imageFixCallback.onImageReady(holder, resource.getWidth(), resource.getHeight());
        }
        if (config.autoFix || holder.isAutoFix() || !holder.isInvalidateSize()) {
            int width = getRealWidth();
            int height = (int) ((float) resource.getHeight() * width / resource.getWidth());
            drawableWrapper.setBounds(0, 0, width, height);
        } else {
            drawableWrapper.setBounds(0, 0, holder.getWidth(), holder.getHeight());
        }
    }
    resetText();
    loadDone();
}
 
开发者ID:zzhoujay,项目名称:RichText,代码行数:32,代码来源:ImageTargetBitmap.java

示例14: onResourceReady

import com.zzhoujay.richtext.ImageHolder; //导入依赖的package包/类
@Override
public void onResourceReady(GifDrawable resource, GlideAnimation<? super GifDrawable> glideAnimation) {
    if (!activityIsAlive()) {
        return;
    }
    DrawableWrapper drawableWrapper = urlDrawableWeakReference.get();
    if (drawableWrapper == null) {
        return;
    }
    holder.setImageState(ImageHolder.ImageState.READY);
    gifDrawableSoftReference = new SoftReference<>(resource);
    Bitmap first = resource.getFirstFrame();
    holder.setSize(first.getWidth(), first.getHeight());
    drawableWrapper.setDrawable(resource);
    if (rect != null) {
        drawableWrapper.setBounds(rect);
    } else {
        if (!config.autoFix && config.imageFixCallback != null) {
            config.imageFixCallback.onImageReady(holder, first.getWidth(), first.getHeight());
        }
        if (config.autoFix || holder.isAutoFix() || !holder.isInvalidateSize()) {
            int width = getRealWidth();
            int height = (int) ((float) first.getHeight() * width / first.getWidth());
            drawableWrapper.setBounds(0, 0, width, height);
        } else {
            drawableWrapper.setBounds(0, 0, holder.getWidth(), holder.getHeight());
        }
        if (holder.isAutoPlay()) {
            resource.setCallback(this);
            resource.start();
            resource.setLoopCount(GlideDrawable.LOOP_FOREVER);
        }
    }
    resetText();
    loadDone();
}
 
开发者ID:zzhoujay,项目名称:RichText,代码行数:37,代码来源:ImageTargetGif.java

示例15: ImageTarget

import com.zzhoujay.richtext.ImageHolder; //导入依赖的package包/类
ImageTarget(TextView textView, DrawableWrapper drawableWrapper, ImageHolder holder, RichTextConfig config, ImageLoadNotify imageLoadNotify, Rect rect) {
    this.textViewWeakReference = new WeakReference<>(textView);
    this.urlDrawableWeakReference = new WeakReference<>(drawableWrapper);
    this.holder = holder;
    this.config = config;
    this.imageLoadNotifyWeakReference = new WeakReference<>(imageLoadNotify);
    this.rect = rect;
}
 
开发者ID:zzhoujay,项目名称:RichText,代码行数:9,代码来源:ImageTarget.java


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