com.nostra13.universalimageloader.core.download.ImageDownloader Java Examples

The following examples show how to use com.nostra13.universalimageloader.core.download.ImageDownloader. 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: ImageDecodingInfo.java    From WliveTV with Apache License 2.0 6 votes vote down vote up
public ImageDecodingInfo(String imageKey, String imageUri, String originalImageUri, ImageSize targetSize, ViewScaleType viewScaleType,
						 ImageDownloader downloader, DisplayImageOptions displayOptions) {
	this.imageKey = imageKey;
	this.imageUri = imageUri;
	this.originalImageUri = originalImageUri;
	this.targetSize = targetSize;

	this.imageScaleType = displayOptions.getImageScaleType();
	this.viewScaleType = viewScaleType;

	this.downloader = downloader;
	this.extraForDownloader = displayOptions.getExtraForDownloader();

	considerExifParams = displayOptions.isConsiderExifParams();
	decodingOptions = new Options();
	copyOptions(displayOptions.getDecodingOptions(), decodingOptions);
}
 
Example #2
Source File: ImageDecodingInfo.java    From candybar with Apache License 2.0 6 votes vote down vote up
public ImageDecodingInfo(String imageKey, String imageUri, String originalImageUri, ImageSize targetSize, ViewScaleType viewScaleType,
                         ImageDownloader downloader, DisplayImageOptions displayOptions) {
    this.imageKey = imageKey;
    this.imageUri = imageUri;
    this.originalImageUri = originalImageUri;
    this.targetSize = targetSize;

    this.imageScaleType = displayOptions.getImageScaleType();
    this.viewScaleType = viewScaleType;

    this.downloader = downloader;
    this.extraForDownloader = displayOptions.getExtraForDownloader();

    considerExifParams = displayOptions.isConsiderExifParams();
    decodingOptions = new Options();
    copyOptions(displayOptions.getDecodingOptions(), decodingOptions);
}
 
Example #3
Source File: ImageDecodingInfo.java    From android-open-project-demo with Apache License 2.0 6 votes vote down vote up
public ImageDecodingInfo(String imageKey, String imageUri, String originalImageUri, ImageSize targetSize, ViewScaleType viewScaleType,
						 ImageDownloader downloader, DisplayImageOptions displayOptions) {
	this.imageKey = imageKey;
	this.imageUri = imageUri;
	this.originalImageUri = originalImageUri;
	this.targetSize = targetSize;

	this.imageScaleType = displayOptions.getImageScaleType();
	this.viewScaleType = viewScaleType;

	this.downloader = downloader;
	this.extraForDownloader = displayOptions.getExtraForDownloader();

	considerExifParams = displayOptions.isConsiderExifParams();
	decodingOptions = new Options();
	copyOptions(displayOptions.getDecodingOptions(), decodingOptions);
}
 
Example #4
Source File: ImageDecodingInfo.java    From BigApp_WordPress_Android with Apache License 2.0 6 votes vote down vote up
public ImageDecodingInfo(String imageKey, String imageUri, String originalImageUri, ImageSize targetSize, ViewScaleType viewScaleType,
						 ImageDownloader downloader, DisplayImageOptions displayOptions) {
	this.imageKey = imageKey;
	this.imageUri = imageUri;
	this.originalImageUri = originalImageUri;
	this.targetSize = targetSize;

	this.imageScaleType = displayOptions.getImageScaleType();
	this.viewScaleType = viewScaleType;

	this.downloader = downloader;
	this.extraForDownloader = displayOptions.getExtraForDownloader();

	considerExifParams = displayOptions.isConsiderExifParams();
	decodingOptions = new Options();
	copyOptions(displayOptions.getDecodingOptions(), decodingOptions);
}
 
Example #5
Source File: VideoRow.java    From talk-android with MIT License 6 votes vote down vote up
Bitmap tryLoadBitmap(ImageViewAware imageAware) {
    Bitmap bitmap = null;
    try {
        java.io.File imageFile = diskCache.get(getMessage().get_id());
        if (imageFile != null && imageFile.exists() && imageFile.length() > 0) {
            ViewScaleType viewScaleType = imageAware.getScaleType();
            ImageSize imageSize = ImageSizeUtils.defineTargetSizeForView(imageAware, new ImageSize(MainApp.CONTEXT.getResources().getDisplayMetrics().widthPixels, MainApp.CONTEXT.getResources().getDisplayMetrics().heightPixels));
            ImageDecodingInfo decodingInfo = new ImageDecodingInfo(getMessage().get_id(),
                    ImageDownloader.Scheme.FILE.wrap(imageFile.getAbsolutePath()), getMessage().get_id(), imageSize, viewScaleType,
                    new BaseImageDownloader(MainApp.CONTEXT), options);
            bitmap = decoder.decode(decodingInfo);
            MainApp.memoryCache.put(getMessage().get_id(), bitmap);
        }
    } catch (Exception ignored) {
        ignored.printStackTrace();
    }
    return bitmap;
}
 
Example #6
Source File: ImageDecodingInfo.java    From Android-Universal-Image-Loader-Modify with Apache License 2.0 6 votes vote down vote up
public ImageDecodingInfo(String imageKey, String imageUri, String originalImageUri, ImageSize targetSize, ViewScaleType viewScaleType,
						 ImageDownloader downloader, DisplayImageOptions displayOptions) {
	this.imageKey = imageKey;
	this.imageUri = imageUri;
	this.originalImageUri = originalImageUri;
	this.targetSize = targetSize;

	this.imageScaleType = displayOptions.getImageScaleType();
	this.viewScaleType = viewScaleType;

	this.downloader = downloader;
	this.extraForDownloader = displayOptions.getExtraForDownloader();

	considerExifParams = displayOptions.isConsiderExifParams();
	decodingOptions = new Options();
	copyOptions(displayOptions.getDecodingOptions(), decodingOptions);
}
 
Example #7
Source File: ImageDecodingInfo.java    From mobile-manager-tool with MIT License 6 votes vote down vote up
public ImageDecodingInfo(String imageKey, String imageUri, String originalImageUri, ImageSize targetSize, ViewScaleType viewScaleType,
						 ImageDownloader downloader, DisplayImageOptions displayOptions) {
	this.imageKey = imageKey;
	this.imageUri = imageUri;
	this.originalImageUri = originalImageUri;
	this.targetSize = targetSize;

	this.imageScaleType = displayOptions.getImageScaleType();
	this.viewScaleType = viewScaleType;

	this.downloader = downloader;
	this.extraForDownloader = displayOptions.getExtraForDownloader();

	considerExifParams = displayOptions.isConsiderExifParams();
	decodingOptions = new Options();
	copyOptions(displayOptions.getDecodingOptions(), decodingOptions);
}
 
Example #8
Source File: ImageDecodingInfo.java    From MiBandDecompiled with Apache License 2.0 5 votes vote down vote up
public ImageDecodingInfo(String s, String s1, String s2, ImageSize imagesize, ViewScaleType viewscaletype, ImageDownloader imagedownloader, DisplayImageOptions displayimageoptions)
{
    a = s;
    b = s1;
    c = s2;
    d = imagesize;
    e = displayimageoptions.getImageScaleType();
    f = viewscaletype;
    g = imagedownloader;
    h = displayimageoptions.getExtraForDownloader();
    i = displayimageoptions.isConsiderExifParams();
    a(displayimageoptions.getDecodingOptions(), j);
}
 
Example #9
Source File: g.java    From MiBandDecompiled with Apache License 2.0 5 votes vote down vote up
public InputStream getStream(String s, Object obj)
{
    switch (f.a[com.nostra13.universalimageloader.core.download.ImageDownloader.Scheme.ofUri(s).ordinal()])
    {
    default:
        return a.getStream(s, obj);

    case 1: // '\001'
    case 2: // '\002'
        throw new IllegalStateException();
    }
}
 
Example #10
Source File: LoadAndDisplayImageTask.java    From WliveTV with Apache License 2.0 5 votes vote down vote up
private ImageDownloader getDownloader() {
	ImageDownloader d;
	if (engine.isNetworkDenied()) {
		d = networkDeniedDownloader;
	} else if (engine.isSlowNetwork()) {
		d = slowNetworkDownloader;
	} else {
		d = downloader;
	}
	return d;
}
 
Example #11
Source File: CommonUtils.java    From BigApp_WordPress_Android with Apache License 2.0 5 votes vote down vote up
public static byte[] getImageByteByPath(String imagePath, ImageSize imageSize) {
    try {
        DisplayImageOptions options = new DisplayImageOptions.Builder()
                .cacheInMemory(false).cacheOnDisk(false)
                .considerExifParams(true).bitmapConfig(Bitmap.Config.RGB_565)
                .imageScaleType(ImageScaleType.EXACTLY).build();
        Bitmap upbitmap = ImageLoader.getInstance().loadImageSync(ImageDownloader.Scheme.FILE.wrap(imagePath), imageSize, options);
        if (upbitmap == null) {
            return null;
        }
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        upbitmap.compress(Bitmap.CompressFormat.JPEG, 100, baos);
        int option = 100;
        while (baos.toByteArray().length / 1024 > 120) {
            baos.reset();
            option -= 10;
            upbitmap.compress(Bitmap.CompressFormat.JPEG, option, baos);
        }
        byte[] result = baos.toByteArray();
        IoUtils.closeSilently(baos);
        upbitmap.recycle();
        return result;
    } catch (Throwable e) {
        e.printStackTrace();
    }
    return null;
}
 
Example #12
Source File: h.java    From MiBandDecompiled with Apache License 2.0 5 votes vote down vote up
public InputStream getStream(String s, Object obj)
{
    InputStream inputstream = a.getStream(s, obj);
    switch (f.a[com.nostra13.universalimageloader.core.download.ImageDownloader.Scheme.ofUri(s).ordinal()])
    {
    default:
        return inputstream;

    case 1: // '\001'
    case 2: // '\002'
        return new FlushedInputStream(inputstream);
    }
}
 
Example #13
Source File: LoadAndDisplayImageTask.java    From BigApp_WordPress_Android with Apache License 2.0 5 votes vote down vote up
private ImageDownloader getDownloader() {
	ImageDownloader d;
	if (engine.isNetworkDenied()) {
		d = networkDeniedDownloader;
	} else if (engine.isSlowNetwork()) {
		d = slowNetworkDownloader;
	} else {
		d = downloader;
	}
	return d;
}
 
Example #14
Source File: l.java    From MiBandDecompiled with Apache License 2.0 5 votes vote down vote up
private boolean a(int i1, int j1)
{
    File file = C.o.get(a);
    if (file != null && file.exists())
    {
        ImageSize imagesize = new ImageSize(i1, j1);
        DisplayImageOptions displayimageoptions = (new DisplayImageOptions.Builder()).cloneFrom(c).imageScaleType(ImageScaleType.IN_SAMPLE_INT).build();
        ImageDecodingInfo imagedecodinginfo = new ImageDecodingInfo(H, com.nostra13.universalimageloader.core.download.ImageDownloader.Scheme.FILE.wrap(file.getAbsolutePath()), a, imagesize, ViewScaleType.FIT_INSIDE, h(), displayimageoptions);
        Bitmap bitmap = G.decode(imagedecodinginfo);
        if (bitmap != null && C.f != null)
        {
            Object aobj[] = new Object[1];
            aobj[0] = H;
            L.d("Process image before cache on disk [%s]", aobj);
            bitmap = C.f.process(bitmap);
            if (bitmap == null)
            {
                Object aobj1[] = new Object[1];
                aobj1[0] = H;
                L.e("Bitmap processor for disk cache returned null [%s]", aobj1);
            }
        }
        Bitmap bitmap1 = bitmap;
        if (bitmap1 != null)
        {
            boolean flag = C.o.save(a, bitmap1);
            bitmap1.recycle();
            return flag;
        }
    }
    return false;
}
 
Example #15
Source File: l.java    From MiBandDecompiled with Apache License 2.0 5 votes vote down vote up
private ImageDownloader h()
{
    if (z.f())
    {
        return E;
    }
    if (z.g())
    {
        return F;
    } else
    {
        return D;
    }
}
 
Example #16
Source File: LoadAndDisplayImageTask.java    From mobile-manager-tool with MIT License 5 votes vote down vote up
private ImageDownloader getDownloader() {
	ImageDownloader d;
	if (engine.isNetworkDenied()) {
		d = networkDeniedDownloader;
	} else if (engine.isSlowNetwork()) {
		d = slowNetworkDownloader;
	} else {
		d = downloader;
	}
	return d;
}
 
Example #17
Source File: LoadAndDisplayImageTask.java    From Android-Universal-Image-Loader-Modify with Apache License 2.0 5 votes vote down vote up
/**
 * 获取下载加载器
 * @return
 */
private ImageDownloader getDownloader() {
	ImageDownloader d;
	if (engine.isNetworkDenied()) {
		d = networkDeniedDownloader;
	} else if (engine.isSlowNetwork()) {
		d = slowNetworkDownloader;
	} else {
		d = downloader;
	}
	return d;
}
 
Example #18
Source File: DiskDecoder.java    From talk-android with MIT License 5 votes vote down vote up
protected ExifInfo defineExifOrientation(String imageUri) {
    int rotation = 0;
    boolean flip = false;
    try {
        ExifInterface exif = new ExifInterface(ImageDownloader.Scheme.FILE.crop(imageUri));
        int exifOrientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION, ExifInterface.ORIENTATION_NORMAL);
        switch (exifOrientation) {
            case ExifInterface.ORIENTATION_FLIP_HORIZONTAL:
                flip = true;
            case ExifInterface.ORIENTATION_NORMAL:
                rotation = 0;
                break;
            case ExifInterface.ORIENTATION_TRANSVERSE:
                flip = true;
            case ExifInterface.ORIENTATION_ROTATE_90:
                rotation = 90;
                break;
            case ExifInterface.ORIENTATION_FLIP_VERTICAL:
                flip = true;
            case ExifInterface.ORIENTATION_ROTATE_180:
                rotation = 180;
                break;
            case ExifInterface.ORIENTATION_TRANSPOSE:
                flip = true;
            case ExifInterface.ORIENTATION_ROTATE_270:
                rotation = 270;
                break;
        }
    } catch (IOException e) {
        L.w("Can't read EXIF tags from file [%s]", imageUri);
    }
    return new ExifInfo(rotation, flip);
}
 
Example #19
Source File: ImageDecodingInfo.java    From letv with Apache License 2.0 5 votes vote down vote up
public ImageDecodingInfo(String imageKey, String imageUri, String originalImageUri, ImageSize targetSize, ViewScaleType viewScaleType, ImageDownloader downloader, DisplayImageOptions displayOptions) {
    this.imageKey = imageKey;
    this.imageUri = imageUri;
    this.originalImageUri = originalImageUri;
    this.targetSize = targetSize;
    this.imageScaleType = displayOptions.getImageScaleType();
    this.viewScaleType = viewScaleType;
    this.downloader = downloader;
    this.extraForDownloader = displayOptions.getExtraForDownloader();
    this.considerExifParams = displayOptions.isConsiderExifParams();
    copyOptions(displayOptions.getDecodingOptions(), this.decodingOptions);
}
 
Example #20
Source File: LoadAndDisplayImageTask.java    From letv with Apache License 2.0 5 votes vote down vote up
private ImageDownloader getDownloader() {
    if (this.engine.isNetworkDenied()) {
        return this.networkDeniedDownloader;
    }
    if (this.engine.isSlowNetwork()) {
        return this.slowNetworkDownloader;
    }
    return this.downloader;
}
 
Example #21
Source File: LoadAndDisplayImageTask.java    From candybar with Apache License 2.0 5 votes vote down vote up
private ImageDownloader getDownloader() {
    ImageDownloader d;
    if (engine.isNetworkDenied()) {
        d = networkDeniedDownloader;
    } else if (engine.isSlowNetwork()) {
        d = slowNetworkDownloader;
    } else {
        d = downloader;
    }
    return d;
}
 
Example #22
Source File: LoadAndDisplayImageTask.java    From android-open-project-demo with Apache License 2.0 5 votes vote down vote up
private ImageDownloader getDownloader() {
	ImageDownloader d;
	if (engine.isNetworkDenied()) {
		d = networkDeniedDownloader;
	} else if (engine.isSlowNetwork()) {
		d = slowNetworkDownloader;
	} else {
		d = downloader;
	}
	return d;
}
 
Example #23
Source File: DefaultConfigurationFactory.java    From android-open-project-demo with Apache License 2.0 4 votes vote down vote up
/** Creates default implementation of {@link ImageDownloader} - {@link BaseImageDownloader} */
public static ImageDownloader createImageDownloader(Context context) {
	return new BaseImageDownloader(context);
}
 
Example #24
Source File: ImageLoaderConfiguration.java    From Android-Universal-Image-Loader-Modify with Apache License 2.0 4 votes vote down vote up
public SlowNetworkImageDownloader(ImageDownloader wrappedDownloader) {
	this.wrappedDownloader = wrappedDownloader;
}
 
Example #25
Source File: ImageDecodingInfo.java    From MiBandDecompiled with Apache License 2.0 4 votes vote down vote up
public ImageDownloader getDownloader()
{
    return g;
}
 
Example #26
Source File: BaseImageDecoder.java    From MiBandDecompiled with Apache License 2.0 4 votes vote down vote up
private boolean a(String s, String s1)
{
    return android.os.Build.VERSION.SDK_INT >= 5 && "image/jpeg".equalsIgnoreCase(s1) && com.nostra13.universalimageloader.core.download.ImageDownloader.Scheme.ofUri(s) == com.nostra13.universalimageloader.core.download.ImageDownloader.Scheme.FILE;
}
 
Example #27
Source File: g.java    From MiBandDecompiled with Apache License 2.0 4 votes vote down vote up
public g(ImageDownloader imagedownloader)
{
    a = imagedownloader;
}
 
Example #28
Source File: ImageLoaderConfiguration.java    From candybar with Apache License 2.0 4 votes vote down vote up
public NetworkDeniedImageDownloader(ImageDownloader wrappedDownloader) {
    this.wrappedDownloader = wrappedDownloader;
}
 
Example #29
Source File: ImageDecodingInfo.java    From android-open-project-demo with Apache License 2.0 4 votes vote down vote up
/** @return Downloader for image loading */
public ImageDownloader getDownloader() {
	return downloader;
}
 
Example #30
Source File: ImageLoaderConfiguration$Builder.java    From MiBandDecompiled with Apache License 2.0 4 votes vote down vote up
static ImageDownloader o(A a1)
{
    return a1.y;
}