com.nostra13.universalimageloader.core.imageaware.ImageAware Java Examples

The following examples show how to use com.nostra13.universalimageloader.core.imageaware.ImageAware. 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: UILFillViewportDisplayer.java    From scissors with Apache License 2.0 6 votes vote down vote up
@Override
public void display(Bitmap source, ImageAware imageAware, LoadedFrom loadedFrom) {
    int sourceWidth = source.getWidth();
    int sourceHeight = source.getHeight();

    Rect target = CropViewExtensions.computeTargetSize(sourceWidth, sourceHeight, viewportWidth, viewportHeight);
    final Bitmap result = Bitmap.createScaledBitmap(
            source,
            target.width(),
            target.height(),
            true);

    if (result != source) {
        source.recycle();
    }

    imageAware.setImageBitmap(result);
}
 
Example #2
Source File: FadeInBitmapDisplayer.java    From WliveTV with Apache License 2.0 5 votes vote down vote up
@Override
public void display(Bitmap bitmap, ImageAware imageAware, LoadedFrom loadedFrom) {
	imageAware.setImageBitmap(bitmap);

	if ((animateFromNetwork && loadedFrom == LoadedFrom.NETWORK) ||
			(animateFromDisk && loadedFrom == LoadedFrom.DISC_CACHE) ||
			(animateFromMemory && loadedFrom == LoadedFrom.MEMORY_CACHE)) {
		animate(imageAware.getWrappedView(), durationMillis);
	}
}
 
Example #3
Source File: ImageSizeUtils.java    From letv with Apache License 2.0 5 votes vote down vote up
public static ImageSize defineTargetSizeForView(ImageAware imageAware, ImageSize maxImageSize) {
    int width = imageAware.getWidth();
    if (width <= 0) {
        width = maxImageSize.getWidth();
    }
    int height = imageAware.getHeight();
    if (height <= 0) {
        height = maxImageSize.getHeight();
    }
    return new ImageSize(width, height);
}
 
Example #4
Source File: PickerImageLoadTool.java    From o2oa with GNU Affero General Public License v3.0 5 votes vote down vote up
public static void disPlay(String uri, ImageAware imageAware, int defaultPic){
	DisplayImageOptions options = new DisplayImageOptions.Builder()
	.showImageOnLoading(defaultPic)
	.showImageForEmptyUri(defaultPic)
	.showImageOnFail(defaultPic)
	.cacheInMemory(true)
	.cacheOnDisc(false)
	.bitmapConfig(Bitmap.Config.RGB_565)
	.displayer(new SimpleBitmapDisplayer())
	.build();

	imageLoader.displayImage(uri, imageAware, options);
}
 
Example #5
Source File: ImageLoadingInfo.java    From candybar with Apache License 2.0 5 votes vote down vote up
public ImageLoadingInfo(String uri, ImageAware imageAware, ImageSize targetSize, String memoryCacheKey,
                        DisplayImageOptions options, ImageLoadingListener listener,
                        ImageLoadingProgressListener progressListener, ReentrantLock loadFromUriLock) {
    this.uri = uri;
    this.imageAware = imageAware;
    this.targetSize = targetSize;
    this.options = options;
    this.listener = listener;
    this.progressListener = progressListener;
    this.loadFromUriLock = loadFromUriLock;
    this.memoryCacheKey = memoryCacheKey;
}
 
Example #6
Source File: RoundedVignetteBitmapDisplayer.java    From candybar with Apache License 2.0 5 votes vote down vote up
@Override
public void display(Bitmap bitmap, ImageAware imageAware, LoadedFrom loadedFrom) {
    if (!(imageAware instanceof ImageViewAware)) {
        throw new IllegalArgumentException("ImageAware should wrap ImageView. ImageViewAware is expected.");
    }

    imageAware.setImageDrawable(new RoundedVignetteDrawable(bitmap, cornerRadius, margin));
}
 
Example #7
Source File: RoundedVignetteBitmapDisplayer.java    From Android-Universal-Image-Loader-Modify with Apache License 2.0 5 votes vote down vote up
/**
 * 进行创建合适的圆角进行显示
 * @param bitmap
 * @param imageAware
 * @param loadedFrom
 */
@Override
public void display(Bitmap bitmap, ImageAware imageAware, LoadedFrom loadedFrom) {
	if (!(imageAware instanceof ImageViewAware)) {
		throw new IllegalArgumentException("ImageAware should wrap ImageView. ImageViewAware is expected.");
	}

	imageAware.setImageDrawable(new RoundedVignetteDrawable(bitmap, cornerRadius, margin));
}
 
Example #8
Source File: ImageLoadingInfo.java    From WliveTV with Apache License 2.0 5 votes vote down vote up
public ImageLoadingInfo(String uri, ImageAware imageAware, ImageSize targetSize, String memoryCacheKey,
		DisplayImageOptions options, ImageLoadingListener listener,
		ImageLoadingProgressListener progressListener, ReentrantLock loadFromUriLock) {
	this.uri = uri;
	this.imageAware = imageAware;
	this.targetSize = targetSize;
	this.options = options;
	this.listener = listener;
	this.progressListener = progressListener;
	this.loadFromUriLock = loadFromUriLock;
	this.memoryCacheKey = memoryCacheKey;
}
 
Example #9
Source File: RoundedBitmapDisplayer.java    From letv with Apache License 2.0 5 votes vote down vote up
public void display(Bitmap bitmap, ImageAware imageAware, LoadedFrom loadedFrom) {
    if (imageAware instanceof ImageViewAware) {
        imageAware.setImageDrawable(new RoundedDrawable(bitmap, this.cornerRadius, this.margin));
        return;
    }
    throw new IllegalArgumentException("ImageAware should wrap ImageView. ImageViewAware is expected.");
}
 
Example #10
Source File: RoundedBitmapDisplayer.java    From candybar with Apache License 2.0 5 votes vote down vote up
@Override
public void display(Bitmap bitmap, ImageAware imageAware, LoadedFrom loadedFrom) {
    if (!(imageAware instanceof ImageViewAware)) {
        throw new IllegalArgumentException("ImageAware should wrap ImageView. ImageViewAware is expected.");
    }

    imageAware.setImageDrawable(new RoundedDrawable(bitmap, cornerRadius, margin));
}
 
Example #11
Source File: FadeInBitmapDisplayer.java    From android-open-project-demo with Apache License 2.0 5 votes vote down vote up
@Override
public void display(Bitmap bitmap, ImageAware imageAware, LoadedFrom loadedFrom) {
	imageAware.setImageBitmap(bitmap);

	if ((animateFromNetwork && loadedFrom == LoadedFrom.NETWORK) ||
			(animateFromDisk && loadedFrom == LoadedFrom.DISC_CACHE) ||
			(animateFromMemory && loadedFrom == LoadedFrom.MEMORY_CACHE)) {
		animate(imageAware.getWrappedView(), durationMillis);
	}
}
 
Example #12
Source File: RoundedBitmapDisplayer.java    From android-open-project-demo with Apache License 2.0 5 votes vote down vote up
@Override
public void display(Bitmap bitmap, ImageAware imageAware, LoadedFrom loadedFrom) {
	if (!(imageAware instanceof ImageViewAware)) {
		throw new IllegalArgumentException("ImageAware should wrap ImageView. ImageViewAware is expected.");
	}

	imageAware.setImageDrawable(new RoundedDrawable(bitmap, cornerRadius, margin));
}
 
Example #13
Source File: CircleBitmapDisplayer.java    From Cotable with Apache License 2.0 5 votes vote down vote up
@Override
public void display(Bitmap bitmap, ImageAware imageAware, LoadedFrom loadedFrom) {
    Bitmap output = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), Bitmap.Config.ARGB_4444);

    Canvas canvas = new Canvas(output);

    final int color = 0xff424242;
    final Paint paint = new Paint();
    final Rect rect = new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight());

    paint.setAntiAlias(true);
    canvas.drawARGB(0, 0, 0, 0);
    paint.setColor(color);

    //--CROP THE IMAGE
    canvas.drawCircle(bitmap.getWidth() / 2, bitmap.getHeight() / 2, bitmap.getWidth() / 2 - 1, paint);
    paint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC_IN));
    canvas.drawBitmap(bitmap, rect, rect, paint);

    //--ADD BORDER IF NEEDED
    if (this.borderWidth > 0) {
        final Paint paint2 = new Paint();
        paint2.setAntiAlias(true);
        paint2.setColor(this.borderColor);
        paint2.setStrokeWidth(this.borderWidth);
        paint2.setStyle(Paint.Style.STROKE);
        canvas.drawCircle(bitmap.getWidth() / 2, bitmap.getHeight() / 2, (float) (bitmap.getWidth() / 2 - Math.ceil(this.borderWidth / 2)), paint2);
    }
    imageAware.setImageBitmap(output);
}
 
Example #14
Source File: CircleBitmapDisplayer.java    From WliveTV with Apache License 2.0 5 votes vote down vote up
@Override
public void display(Bitmap bitmap, ImageAware imageAware, LoadedFrom loadedFrom) {
	if (!(imageAware instanceof ImageViewAware)) {
		throw new IllegalArgumentException("ImageAware should wrap ImageView. ImageViewAware is expected.");
	}

	imageAware.setImageDrawable(new CircleDrawable(bitmap, strokeColor, strokeWidth));
}
 
Example #15
Source File: ImageSizeUtils.java    From android-open-project-demo with Apache License 2.0 5 votes vote down vote up
/**
 * Defines target size for image aware view. Size is defined by target
 * {@link com.nostra13.universalimageloader.core.imageaware.ImageAware view} parameters, configuration
 * parameters or device display dimensions.<br />
 */
public static ImageSize defineTargetSizeForView(ImageAware imageAware, ImageSize maxImageSize) {
	int width = imageAware.getWidth();
	if (width <= 0) width = maxImageSize.getWidth();

	int height = imageAware.getHeight();
	if (height <= 0) height = maxImageSize.getHeight();

	return new ImageSize(width, height);
}
 
Example #16
Source File: ImageSizeUtils.java    From Yahala-Messenger with MIT License 5 votes vote down vote up
/**
 * Defines target size for image aware view. Size is defined by target
 * {@link com.nostra13.universalimageloader.core.imageaware.ImageAware view} parameters, configuration
 * parameters or device display dimensions.<br />
 */
public static ImageSize defineTargetSizeForView(ImageAware imageAware, ImageSize maxImageSize) {
    int width = imageAware.getWidth();
    if (width <= 0) width = maxImageSize.getWidth();

    int height = imageAware.getHeight();
    if (height <= 0) height = maxImageSize.getHeight();

    return new ImageSize(width, height);
}
 
Example #17
Source File: RoundedBitmapDisplayer.java    From MiBandDecompiled with Apache License 2.0 5 votes vote down vote up
public void display(Bitmap bitmap, ImageAware imageaware, LoadedFrom loadedfrom)
{
    if (!(imageaware instanceof ImageViewAware))
    {
        throw new IllegalArgumentException("ImageAware should wrap ImageView. ImageViewAware is expected.");
    } else
    {
        imageaware.setImageDrawable(new RoundedDrawable(bitmap, cornerRadius, margin));
        return;
    }
}
 
Example #18
Source File: ImageSizeUtils.java    From candybar with Apache License 2.0 5 votes vote down vote up
/**
 * Defines target size for image aware view. Size is defined by target
 * {@link com.nostra13.universalimageloader.core.imageaware.ImageAware view} parameters, configuration
 * parameters or device display dimensions.<br />
 */
public static ImageSize defineTargetSizeForView(ImageAware imageAware, ImageSize maxImageSize) {
    int width = imageAware.getWidth();
    if (width <= 0) width = maxImageSize.getWidth();

    int height = imageAware.getHeight();
    if (height <= 0) height = maxImageSize.getHeight();

    return new ImageSize(width, height);
}
 
Example #19
Source File: RoundedVignetteBitmapDisplayer.java    From mobile-manager-tool with MIT License 5 votes vote down vote up
@Override
public void display(Bitmap bitmap, ImageAware imageAware, LoadedFrom loadedFrom) {
	if (!(imageAware instanceof ImageViewAware)) {
		throw new IllegalArgumentException("ImageAware should wrap ImageView. ImageViewAware is expected.");
	}

	imageAware.setImageDrawable(new RoundedVignetteDrawable(bitmap, cornerRadius, margin));
}
 
Example #20
Source File: ImageLoadingInfo.java    From mobile-manager-tool with MIT License 5 votes vote down vote up
public ImageLoadingInfo(String uri, ImageAware imageAware, ImageSize targetSize, String memoryCacheKey,
		DisplayImageOptions options, ImageLoadingListener listener,
		ImageLoadingProgressListener progressListener, ReentrantLock loadFromUriLock) {
	this.uri = uri;
	this.imageAware = imageAware;
	this.targetSize = targetSize;
	this.options = options;
	this.listener = listener;
	this.progressListener = progressListener;
	this.loadFromUriLock = loadFromUriLock;
	this.memoryCacheKey = memoryCacheKey;
}
 
Example #21
Source File: RoundedCircleBitmapDisplayer.java    From BigApp_WordPress_Android with Apache License 2.0 5 votes vote down vote up
@Override
public void display(Bitmap bitmap, ImageAware imageAware,
		LoadedFrom loadedFrom) {
	if (!(imageAware instanceof ImageViewAware)) {
		throw new IllegalArgumentException(
				"ImageAware should wrap ImageView. ImageViewAware is expected.");
	}
	imageAware.setImageDrawable(new RoundedDrawable(bitmap, margin));
}
 
Example #22
Source File: FadeInBitmapDisplayer.java    From BigApp_WordPress_Android with Apache License 2.0 5 votes vote down vote up
@Override
public void display(Bitmap bitmap, ImageAware imageAware, LoadedFrom loadedFrom) {
	imageAware.setImageBitmap(bitmap);

	if ((animateFromNetwork && loadedFrom == LoadedFrom.NETWORK) ||
			(animateFromDisk && loadedFrom == LoadedFrom.DISC_CACHE) ||
			(animateFromMemory && loadedFrom == LoadedFrom.MEMORY_CACHE)) {
		animate(imageAware.getWrappedView(), durationMillis);
	}
}
 
Example #23
Source File: CircleBorderBitmapDisplayer.java    From BigApp_WordPress_Android with Apache License 2.0 5 votes vote down vote up
@Override
public void display(Bitmap bitmap, ImageAware imageAware,
		LoadedFrom loadedFrom) {
	if (!(imageAware instanceof ImageViewAware)) {
		throw new IllegalArgumentException(
				"ImageAware should wrap ImageView. ImageViewAware is expected.");
	}
	imageAware
			.setImageDrawable(new RoundedDrawable(bitmap, margin, border));
}
 
Example #24
Source File: CircleBitmapDisplayer.java    From BigApp_WordPress_Android with Apache License 2.0 5 votes vote down vote up
@Override
public void display(Bitmap bitmap, ImageAware imageAware, LoadedFrom loadedFrom) {
	if (!(imageAware instanceof ImageViewAware)) {
		throw new IllegalArgumentException("ImageAware should wrap ImageView. ImageViewAware is expected.");
	}

	imageAware.setImageDrawable(new CircleDrawable(bitmap, strokeColor, strokeWidth));
}
 
Example #25
Source File: RoundedVignetteBitmapDisplayer.java    From android-open-project-demo with Apache License 2.0 5 votes vote down vote up
@Override
public void display(Bitmap bitmap, ImageAware imageAware, LoadedFrom loadedFrom) {
	if (!(imageAware instanceof ImageViewAware)) {
		throw new IllegalArgumentException("ImageAware should wrap ImageView. ImageViewAware is expected.");
	}

	imageAware.setImageDrawable(new RoundedVignetteDrawable(bitmap, cornerRadius, margin));
}
 
Example #26
Source File: ImageSizeUtils.java    From WliveTV with Apache License 2.0 5 votes vote down vote up
/**
 * Defines target size for image aware view. Size is defined by target
 * {@link com.nostra13.universalimageloader.core.imageaware.ImageAware view} parameters, configuration
 * parameters or device display dimensions.<br />
 */
public static ImageSize defineTargetSizeForView(ImageAware imageAware, ImageSize maxImageSize) {
	int width = imageAware.getWidth();
	if (width <= 0) width = maxImageSize.getWidth();

	int height = imageAware.getHeight();
	if (height <= 0) height = maxImageSize.getHeight();

	return new ImageSize(width, height);
}
 
Example #27
Source File: RoundedBitmapDisplayer.java    From WliveTV with Apache License 2.0 5 votes vote down vote up
@Override
public void display(Bitmap bitmap, ImageAware imageAware, LoadedFrom loadedFrom) {
	if (!(imageAware instanceof ImageViewAware)) {
		throw new IllegalArgumentException("ImageAware should wrap ImageView. ImageViewAware is expected.");
	}

	imageAware.setImageDrawable(new RoundedDrawable(bitmap, cornerRadius, margin));
}
 
Example #28
Source File: ImageLoadingInfo.java    From android-open-project-demo with Apache License 2.0 5 votes vote down vote up
public ImageLoadingInfo(String uri, ImageAware imageAware, ImageSize targetSize, String memoryCacheKey,
		DisplayImageOptions options, ImageLoadingListener listener,
		ImageLoadingProgressListener progressListener, ReentrantLock loadFromUriLock) {
	this.uri = uri;
	this.imageAware = imageAware;
	this.targetSize = targetSize;
	this.options = options;
	this.listener = listener;
	this.progressListener = progressListener;
	this.loadFromUriLock = loadFromUriLock;
	this.memoryCacheKey = memoryCacheKey;
}
 
Example #29
Source File: ImageLoadingInfo.java    From Android-Universal-Image-Loader-Modify with Apache License 2.0 5 votes vote down vote up
public ImageLoadingInfo(String uri, ImageAware imageAware, ImageSize targetSize, String memoryCacheKey,
		DisplayImageOptions options, ImageLoadingListener listener,
		ImageLoadingProgressListener progressListener, ReentrantLock loadFromUriLock) {
	this.uri = uri;
	this.imageAware = imageAware;
	this.targetSize = targetSize;
	this.options = options;
	this.listener = listener;
	this.progressListener = progressListener;
	this.loadFromUriLock = loadFromUriLock;
	this.memoryCacheKey = memoryCacheKey;
}
 
Example #30
Source File: ImageLoader.java    From MiBandDecompiled with Apache License 2.0 4 votes vote down vote up
public String getLoadingUriForView(ImageAware imageaware)
{
    return i.a(imageaware);
}