public RoundBorderDrawable(ImageAware imageAware, Bitmap bitmap, int margin, int radius, int borderColor, int borderWidth) { this.imageAware = imageAware; this.margin = margin; this.oBitmap = bitmap; this.radius=radius; this.borderColor=borderColor; this.borderWidth=borderWidth; bitmapShader = new BitmapShader(bitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP); imagePaint = new Paint(); imagePaint.setAntiAlias(true); imagePaint.setShader(bitmapShader); borderPaint = new Paint(); borderPaint.setStyle(Paint.Style.STROKE); borderPaint.setAntiAlias(true); borderPaint.setColor(borderColor); // borderPaint.setAlpha(Float.valueOf(borderAlpha * ALPHA_MAX).intValue()); borderPaint.setStrokeWidth(borderWidth*2); }
@Override public void load(String path, int defaultRes, ImageView iv, final AbsImageLoader.ImageLoadingListener listener) { if(!TextUtils.isEmpty(path)) { if (!path.equals(iv.getTag())) { iv.setTag(path); ImageAware imageAware = new ImageViewAware(iv, false); ImageLoader.getInstance().displayImage(path, imageAware, getDefaultOptions(false, defaultRes), new SimpleImageLoadingListener() { @Override public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) { if(listener!=null){ listener.onSuccess(imageUri, view); } } }); } }else{ iv.setImageResource(defaultRes); } }
@Override public void display(Bitmap bitmap, ImageAware imageAware, LoadedFrom loadedFrom) { if (!(imageAware instanceof ImageViewAware)) { throw new IllegalArgumentException("ImageAware should wrap ImageView. ImageViewAware is expected."); } Bitmap roundedBitmap = roundCorners(bitmap, (ImageViewAware) imageAware, roundPixels); imageAware.setImageBitmap(roundedBitmap); }
/** * 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); }
@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)); }
@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)); }
@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); } }
@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)); }
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; }
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); }
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."); }
public void display(Bitmap bitmap, ImageAware imageAware, LoadedFrom loadedFrom) { if (imageAware instanceof ImageViewAware) { imageAware.setImageDrawable(new RoundedVignetteDrawable(bitmap, this.cornerRadius, this.margin)); return; } throw new IllegalArgumentException("ImageAware should wrap ImageView. ImageViewAware is expected."); }
@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(getImageDrawable(imageAware,bitmap)); }
@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, margin)); }
@Override public void display(Bitmap bitmap, ImageAware imageAware, LoadedFrom loadedFrom, int fileTypeStatus, String filepath) { if (!(imageAware instanceof ImageViewAware)) { throw new IllegalArgumentException("ImageAware should wrap ImageView. ImageViewAware is expected."); } Bitmap roundedBitmap = roundCorners(bitmap, (ImageViewAware) imageAware, roundPixels); imageAware.setImageBitmap(roundedBitmap); }
@Override public void display(Bitmap bitmap, ImageAware imageAware, LoadedFrom loadedFrom, int fileTypeStatus, String filepath) { if (!(imageAware instanceof ImageViewAware)) { throw new IllegalArgumentException("ImageAware should wrap ImageView. ImageViewAware is expected."); } imageAware.setImageDrawable(new RoundedDrawable(bitmap, cornerRadius, margin)); }
@Override public void display(Bitmap bitmap, ImageAware imageAware, LoadedFrom loadedFrom, int fileTypeStatus, String filepath) { if (!(imageAware instanceof ImageViewAware)) { throw new IllegalArgumentException("ImageAware should wrap ImageView. ImageViewAware is expected."); } imageAware.setImageDrawable(new RoundedVignetteDrawable(bitmap, cornerRadius, margin)); }
@Override public void display(Bitmap bitmap, ImageAware imageAware, LoadedFrom loadedFrom, int fileTypeStatus, String filepath) { imageAware.setImageBitmap(bitmap); if ((animateFromNetwork && loadedFrom == LoadedFrom.NETWORK) || (animateFromDisk && loadedFrom == LoadedFrom.DISC_CACHE) || (animateFromMemory && loadedFrom == LoadedFrom.MEMORY_CACHE)) { animate(imageAware.getWrappedView(), durationMillis); } }
@Override public void display(Bitmap bitmap, ImageAware imageAware, LoadedFrom loadedFrom, int fileTypeStatus, String filepath) { if (fileTypeStatus == BitmapDisplayer.FILE_TYPE_GIF_IMAGE && !TextUtils.isEmpty(filepath)) { try { imageAware.setImageDrawable(new GifDrawable(filepath)); } catch (IOException e) { imageAware.setImageBitmap(bitmap); } } else { imageAware.setImageBitmap(bitmap); } }
@Override public void display(Bitmap bitmap, ImageAware imageAware, LoadedFrom loadedFrom, int fileTypeStatus, String filepath) { if (!(imageAware instanceof ImageViewAware)) { throw new IllegalArgumentException("ImageAware should wrap ImageView. ImageViewAware is expected."); } imageAware.setImageDrawable(new CircleDrawable(bitmap, strokeColor, strokeWidth)); }
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; mFileTypeStatus = BitmapDisplayer.FILE_TYPE_UNDEFINE; mFilePath = null; }
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."); }
public void display(Bitmap bitmap, ImageAware imageAware, LoadedFrom loadedFrom) { if (imageAware instanceof ImageViewAware) { imageAware.setImageDrawable(new RoundedVignetteDrawable(bitmap, this.cornerRadius, this.margin)); return; } throw new IllegalArgumentException("ImageAware should wrap ImageView. ImageViewAware is " + "expected."); }
public void display(Bitmap bitmap, ImageAware imageAware, LoadedFrom loadedFrom) { imageAware.setImageBitmap(bitmap); if ((this.animateFromNetwork && loadedFrom == LoadedFrom.NETWORK) || ((this .animateFromDisk && loadedFrom == LoadedFrom.DISC_CACHE) || (this .animateFromMemory && loadedFrom == LoadedFrom.MEMORY_CACHE))) { animate(imageAware.getWrappedView(), this.durationMillis); } }
public void display(Bitmap bitmap, ImageAware imageAware, LoadedFrom loadedFrom) { if (imageAware instanceof ImageViewAware) { imageAware.setImageDrawable(new CircleDrawable(bitmap, this.strokeColor, this .strokeWidth)); return; } throw new IllegalArgumentException("ImageAware should wrap ImageView. ImageViewAware is expected."); }
@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); }
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); }
/** * Defines target size for image aware view. Size is defined by target * {@link 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); }