com.nostra13.universalimageloader.core.assist.ImageScaleType Java Examples
The following examples show how to use
com.nostra13.universalimageloader.core.assist.ImageScaleType.
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: AutoScrollPoster.java From android-auto-scroll-viewpager with Apache License 2.0 | 6 votes |
private void init() { mLayoutInflater = LayoutInflater.from(getContext()); // Get singleton instance mImageLoader = ImageLoader.getInstance(); mDisplayImageOptions = new DisplayImageOptions.Builder() .showImageForEmptyUri(R.drawable.image_loading) .showImageOnFail(R.drawable.image_loading) .cacheOnDisk(true) .cacheInMemory(true) .resetViewBeforeLoading(true) .imageScaleType(ImageScaleType.EXACTLY) .bitmapConfig(Bitmap.Config.ARGB_8888) .considerExifParams(true) .build(); }
Example #2
Source File: MainActivity.java From MutiPhotoChoser with Mozilla Public License 2.0 | 6 votes |
private void initImageLoader() { if (!ImageLoader.getInstance().isInited()) { DisplayImageOptions.Builder displayBuilder = new DisplayImageOptions.Builder(); displayBuilder.cacheInMemory(true); displayBuilder.cacheOnDisk(true); displayBuilder.showImageOnLoading(com.ns.mutiphotochoser.R.drawable.default_photo); displayBuilder.showImageForEmptyUri(com.ns.mutiphotochoser.R.drawable.default_photo); displayBuilder.considerExifParams(true); displayBuilder.bitmapConfig(Bitmap.Config.RGB_565); displayBuilder.imageScaleType(ImageScaleType.EXACTLY); displayBuilder.displayer(new FadeInBitmapDisplayer(300)); ImageLoaderConfiguration.Builder loaderBuilder = new ImageLoaderConfiguration.Builder(getApplication()); loaderBuilder.defaultDisplayImageOptions(displayBuilder.build()); loaderBuilder.memoryCacheSize(getMemoryCacheSize()); try { File cacheDir = new File(getExternalCacheDir() + File.separator + CacheConstant.IMAGE_CACHE_DIRECTORY); loaderBuilder.diskCache(new LruDiscCache(cacheDir, DefaultConfigurationFactory.createFileNameGenerator(), 500 * 1024 * 1024)); } catch (IOException e) { e.printStackTrace(); } ImageLoader.getInstance().init(loaderBuilder.build()); } }
Example #3
Source File: ImageDisplay.java From DroidDLNA with GNU General Public License v3.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.image_display); mContext = this; options = new DisplayImageOptions.Builder() .showImageForEmptyUri(R.drawable.ic_empty) .showImageOnFail(R.drawable.ic_error).resetViewBeforeLoading() .cacheOnDisc().imageScaleType(ImageScaleType.EXACTLY) .bitmapConfig(Bitmap.Config.RGB_565) .displayer(new FadeInBitmapDisplayer(300)).build(); initView(); initData(); showImage(mPlayUri); addShake(); }
Example #4
Source File: App.java From ChatView with MIT License | 6 votes |
@Override public void onCreate() { super.onCreate(); // UNIVERSAL IMAGE LOADER SETUP DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder() .resetViewBeforeLoading(true) .cacheOnDisk(true) .cacheInMemory(true) .imageScaleType(ImageScaleType.EXACTLY) .displayer(new FadeInBitmapDisplayer(300)) .build(); ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getApplicationContext()) .defaultDisplayImageOptions(defaultOptions) .memoryCache(new WeakMemoryCache()) .diskCacheSize(100 * 1024 * 1024) .build(); ImageLoader.getInstance().init(config); // END - UNIVERSAL IMAGE LOADER SETUP }
Example #5
Source File: DisplayConfig.java From TestChat with Apache License 2.0 | 6 votes |
/** * 获取图片加载器的图片的配置 * * @param isRound 是否是加载圆形图片 * @param defaultRes 默认图片ID * @return 返回配置 */ public static DisplayImageOptions getDefaultConfig(boolean isRound,int defaultRes) { DisplayImageOptions.Builder builder=new DisplayImageOptions.Builder(); // 设置缓存到内存和SD卡中,设置图片的解码格式 builder.cacheInMemory(true).cacheOnDisk(true).bitmapConfig(Bitmap.Config.RGB_565); // 考虑JPEG图像EXIF参数(旋转和翻转) builder.imageScaleType(ImageScaleType.EXACTLY_STRETCHED); // 设置圆形图片 if (isRound) { builder.considerExifParams(true).displayer(new RoundedBitmapDisplayer(12)); } // 设置下载前图片重置复位 builder.resetViewBeforeLoading(true); // 设置图片下载失败的时候加载默认的图片 if (defaultRes != 0) { builder.showImageForEmptyUri(defaultRes).showImageOnFail(defaultRes); } return builder.build(); }
Example #6
Source File: LoadAndDisplayImageTask.java From letv with Apache License 2.0 | 6 votes |
private boolean resizeAndSaveImage(int maxWidth, int maxHeight) throws IOException { File targetFile = this.configuration.diskCache.get(this.uri); if (targetFile == null || !targetFile.exists()) { return false; } Bitmap bmp = this.decoder.decode(new ImageDecodingInfo(this.memoryCacheKey, Scheme.FILE.wrap(targetFile.getAbsolutePath()), this.uri, new ImageSize(maxWidth, maxHeight), ViewScaleType.FIT_INSIDE, getDownloader(), new Builder().cloneFrom(this.options).imageScaleType(ImageScaleType.IN_SAMPLE_INT).build())); if (!(bmp == null || this.configuration.processorForDiskCache == null)) { L.d(LOG_PROCESS_IMAGE_BEFORE_CACHE_ON_DISK, this.memoryCacheKey); bmp = this.configuration.processorForDiskCache.process(bmp); if (bmp == null) { L.e(ERROR_PROCESSOR_FOR_DISK_CACHE_NULL, this.memoryCacheKey); } } if (bmp == null) { return false; } boolean saved = this.configuration.diskCache.save(this.uri, bmp); bmp.recycle(); return saved; }
Example #7
Source File: BaseImageDecoder.java From letv with Apache License 2.0 | 6 votes |
protected Options prepareDecodingOptions(ImageSize imageSize, ImageDecodingInfo decodingInfo) { int scale; ImageScaleType scaleType = decodingInfo.getImageScaleType(); if (scaleType == ImageScaleType.NONE) { scale = 1; } else if (scaleType == ImageScaleType.NONE_SAFE) { scale = ImageSizeUtils.computeMinImageSampleSize(imageSize); } else { boolean powerOf2; ImageSize targetSize = decodingInfo.getTargetSize(); if (scaleType == ImageScaleType.IN_SAMPLE_POWER_OF_2) { powerOf2 = true; } else { powerOf2 = false; } scale = ImageSizeUtils.computeImageSampleSize(imageSize, targetSize, decodingInfo.getViewScaleType(), powerOf2); } if (scale > 1 && this.loggingEnabled) { L.d(LOG_SUBSAMPLE_IMAGE, imageSize, imageSize.scaleDown(scale), Integer.valueOf(scale), decodingInfo.getImageKey()); } Options decodingOptions = decodingInfo.getDecodingOptions(); decodingOptions.inSampleSize = scale; return decodingOptions; }
Example #8
Source File: TitlePopupMenu.java From letv with Apache License 2.0 | 6 votes |
@SuppressLint({"InflateParams"}) public TitlePopupMenu(Context context, int width, int height) { this.LIST_PADDING = 10; this.mRect = new Rect(); this.mLocation = new int[2]; this.popupGravity = 0; this.menus = new ArrayList(); this.menusAdapter = new MenusAdapter(); this.mContext = context; this.options = new Builder().showImageOnLoading(R.drawable.lemallsdk_icon_default).showImageForEmptyUri(R.drawable.lemallsdk_icon_default).showImageOnFail(R.drawable.lemallsdk_icon_default).cacheInMemory(true).cacheOnDisc(true).bitmapConfig(Config.RGB_565).imageScaleType(ImageScaleType.IN_SAMPLE_INT).displayer(new SimpleBitmapDisplayer()).build(); setFocusable(true); setTouchable(true); setOutsideTouchable(true); this.mScreenWidth = ScreenUtil.getScreenWidth(this.mContext); this.mScreenHeight = ScreenUtil.getScreenHeight(this.mContext); setWidth(width); setHeight(height); setAnimationStyle(R.style.AnimationPreview); update(); setBackgroundDrawable(new BitmapDrawable()); setContentView(LayoutInflater.from(this.mContext).inflate(R.layout.lemallsdk_title_popup_menu, null)); initUI(); }
Example #9
Source File: SimilarAdapter.java From moviedb-android with Apache License 2.0 | 6 votes |
public SimilarAdapter(Context context, int resource, ArrayList<SimilarModel> objects) { super(context, resource, objects); vi = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); Resource = resource; similarList = objects; imageLoader = ImageLoader.getInstance(); options = new DisplayImageOptions.Builder() // Bitmaps in RGB_565 consume 2 times less memory than in ARGB_8888. Caching images in memory else // flicker while toolbar hiding .bitmapConfig(Bitmap.Config.RGB_565) .imageScaleType(ImageScaleType.EXACTLY) .cacheInMemory(true) .showImageOnLoading(R.drawable.placeholder_default) .showImageForEmptyUri(R.drawable.placeholder_default) .showImageOnFail(R.drawable.placeholder_default) .cacheOnDisk(true) .build(); }
Example #10
Source File: MovieAdapter.java From moviedb-android with Apache License 2.0 | 6 votes |
public MovieAdapter(Context context, int resource, ArrayList<MovieModel> objects) { super(context, resource, objects); vi = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); Resource = resource; moviesList = objects; imageLoader = ImageLoader.getInstance(); options = new DisplayImageOptions.Builder() // Bitmaps in RGB_565 consume 2 times less memory than in ARGB_8888. Caching images in memory else // flicker while toolbar hiding .bitmapConfig(Bitmap.Config.RGB_565) .imageScaleType(ImageScaleType.EXACTLY) .cacheInMemory(true) .showImageOnLoading(R.drawable.placeholder_default) .showImageForEmptyUri(R.drawable.placeholder_default) .showImageOnFail(R.drawable.placeholder_default) .cacheOnDisk(true) .build(); }
Example #11
Source File: ImageLoaders.java From LLApp with Apache License 2.0 | 6 votes |
public static void setdailyfineimg(String url, ImageView imageView, ImageLoadingListener listener) { if (dailyfines == null) { dailyfines = new DisplayImageOptions.Builder() .showImageOnLoading(0) .showImageForEmptyUri(0) .showImageOnFail(0) .cacheInMemory(true) // .cacheOnDisk(true) .considerExifParams(true) .bitmapConfig(Bitmap.Config.RGB_565) .imageScaleType(ImageScaleType.IN_SAMPLE_POWER_OF_2) .build(); } ImageLoader.getInstance().displayImage(url, imageView, dailyfines, listener); }
Example #12
Source File: DisplayImageOptions.java From MiBandDecompiled with Apache License 2.0 | 6 votes |
public Builder() { a = 0; b = 0; c = 0; d = null; e = null; f = null; g = false; h = false; i = false; j = ImageScaleType.IN_SAMPLE_POWER_OF_2; k = new android.graphics.BitmapFactory.Options(); l = 0; m = false; n = null; o = null; p = null; q = DefaultConfigurationFactory.createBitmapDisplayer(); r = null; s = false; k.inPurgeable = true; k.inInputShareable = true; }
Example #13
Source File: BaseDataAdapter.java From WliveTV with Apache License 2.0 | 6 votes |
public BaseDataAdapter(Context context, List<? extends BmobObject> mDatas) { this.context = context; this.mDatas = mDatas; options = new DisplayImageOptions.Builder() .showImageOnLoading(R.mipmap.icon_live_item_default) .showImageForEmptyUri(R.mipmap.icon_live_item_default) .showImageOnFail(R.mipmap.icon_live_item_default) .cacheInMemory(false) .cacheOnDisk(true) .considerExifParams(true) .bitmapConfig(Bitmap.Config.RGB_565) .displayer(new SimpleBitmapDisplayer()) .imageScaleType(ImageScaleType.EXACTLY_STRETCHED) .build(); if (this.context == null) { System.out.println("this.context is null"); } else { mlayoutInflate = LayoutInflater.from(this.context); } }
Example #14
Source File: BaseImageDecoder.java From WliveTV with Apache License 2.0 | 6 votes |
protected Options prepareDecodingOptions(ImageSize imageSize, ImageDecodingInfo decodingInfo) { ImageScaleType scaleType = decodingInfo.getImageScaleType(); int scale; if (scaleType == ImageScaleType.NONE) { scale = 1; } else if (scaleType == ImageScaleType.NONE_SAFE) { scale = ImageSizeUtils.computeMinImageSampleSize(imageSize); } else { ImageSize targetSize = decodingInfo.getTargetSize(); boolean powerOf2 = scaleType == ImageScaleType.IN_SAMPLE_POWER_OF_2; scale = ImageSizeUtils.computeImageSampleSize(imageSize, targetSize, decodingInfo.getViewScaleType(), powerOf2); } if (scale > 1 && loggingEnabled) { L.d(LOG_SUBSAMPLE_IMAGE, imageSize, imageSize.scaleDown(scale), scale, decodingInfo.getImageKey()); } Options decodingOptions = decodingInfo.getDecodingOptions(); decodingOptions.inSampleSize = scale; return decodingOptions; }
Example #15
Source File: MyApp.java From ImageLoadingView with Apache License 2.0 | 6 votes |
private void initImageLoader(Context context) { ImageLoaderConfiguration.Builder config = new ImageLoaderConfiguration.Builder(context); config.denyCacheImageMultipleSizesInMemory(); config.diskCacheSize(50 * 1024 * 1024); config.tasksProcessingOrder(QueueProcessingType.LIFO); ImageLoader.getInstance().init(config.build()); defaultOptions = new DisplayImageOptions.Builder() .cacheInMemory(false) .cacheOnDisk(true) .imageScaleType(ImageScaleType.IN_SAMPLE_INT)//设置图片以如何的编码方式显示 .showImageOnLoading(R.mipmap.loading) .bitmapConfig(Bitmap.Config.RGB_565) .showImageOnFail(R.mipmap.loading) .showImageForEmptyUri(R.mipmap.loading) .build(); ImageLoader.getInstance().clearDiskCache(); ImageLoader.getInstance().clearMemoryCache(); }
Example #16
Source File: DialogShare.java From BigApp_WordPress_Android with Apache License 2.0 | 6 votes |
private void setWeiboImage(Platform.ShareParams sp) { try { ImageLoader.getInstance().loadImageSync(imageUrl, new DisplayImageOptions.Builder() .imageScaleType(ImageScaleType.IN_SAMPLE_INT) .bitmapConfig(Bitmap.Config.RGB_565).considerExifParams(true) .cacheInMemory(false).cacheOnDisk(true).resetViewBeforeLoading(true) .considerExifParams(true).build()); String path = ImageLoader.getInstance().getDiskCache().get(imageUrl).getPath(); if (TextUtils.isEmpty(path)) { return; } sp.setImagePath(path); } catch (Throwable e) { e.printStackTrace(); } }
Example #17
Source File: BaseImageDecoder.java From BigApp_WordPress_Android with Apache License 2.0 | 6 votes |
protected Options prepareDecodingOptions(ImageSize imageSize, ImageDecodingInfo decodingInfo) { ImageScaleType scaleType = decodingInfo.getImageScaleType(); int scale; if (scaleType == ImageScaleType.NONE) { scale = 1; } else if (scaleType == ImageScaleType.NONE_SAFE) { scale = ImageSizeUtils.computeMinImageSampleSize(imageSize); } else { ImageSize targetSize = decodingInfo.getTargetSize(); boolean powerOf2 = scaleType == ImageScaleType.IN_SAMPLE_POWER_OF_2; scale = ImageSizeUtils.computeImageSampleSize(imageSize, targetSize, decodingInfo.getViewScaleType(), powerOf2); } if (scale > 1 && loggingEnabled) { L.d(LOG_SUBSAMPLE_IMAGE, imageSize, imageSize.scaleDown(scale), scale, decodingInfo.getImageKey()); } Options decodingOptions = decodingInfo.getDecodingOptions(); decodingOptions.inSampleSize = scale; return decodingOptions; }
Example #18
Source File: Application.java From v2ex-daily-android with Apache License 2.0 | 6 votes |
private void initiImageLoader() { DisplayImageOptions options = new DisplayImageOptions.Builder() .bitmapConfig(Bitmap.Config.RGB_565) .imageScaleType(ImageScaleType.EXACTLY) .cacheOnDisc(true) .displayer(new FadeInBitmapDisplayer(200)) .showImageOnLoading(R.drawable.ic_launcher) .build(); File cacheDir; if(Environment.getExternalStorageState() == Environment.MEDIA_MOUNTED){ cacheDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES); }else{ cacheDir = getCacheDir(); } ImageLoaderConfiguration.Builder configBuilder = new ImageLoaderConfiguration.Builder(mContext) .threadPoolSize(2) .memoryCache(new WeakMemoryCache()) .denyCacheImageMultipleSizesInMemory() .discCache(new UnlimitedDiscCache(cacheDir)) .defaultDisplayImageOptions(options); if(BuildConfig.DEBUG){ configBuilder.writeDebugLogs(); } ImageLoader.getInstance().init(configBuilder.build()); }
Example #19
Source File: CustomGalleryActivity.java From MultipleImagePicker with Apache License 2.0 | 6 votes |
private void initImageLoader() { try { String CACHE_DIR = Environment.getExternalStorageDirectory() .getAbsolutePath() + "/.temp_tmp"; new File(CACHE_DIR).mkdirs(); File cacheDir = StorageUtils.getOwnCacheDirectory(getBaseContext(), CACHE_DIR); DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder() .cacheOnDisc(true).imageScaleType(ImageScaleType.EXACTLY) .bitmapConfig(Bitmap.Config.RGB_565).build(); ImageLoaderConfiguration.Builder builder = new ImageLoaderConfiguration.Builder( getBaseContext()) .defaultDisplayImageOptions(defaultOptions) .discCache(new UnlimitedDiscCache(cacheDir)) .memoryCache(new WeakMemoryCache()); ImageLoaderConfiguration config = builder.build(); imageLoader = ImageLoader.getInstance(); imageLoader.init(config); } catch (Exception e) { } }
Example #20
Source File: UILKit.java From XRichText with Apache License 2.0 | 6 votes |
/** * 初始化 * * @param context */ private UILKit(Context context) { File cacheDir = getDiskCacheDir(context, "img"); ImageLoaderConfiguration.Builder config = new ImageLoaderConfiguration.Builder(context) .threadPriority(Thread.NORM_PRIORITY - 2) .denyCacheImageMultipleSizesInMemory() .memoryCacheSize(10 * 1024 * 1024) .diskCache(new UnlimitedDiskCache(cacheDir)) .diskCacheFileNameGenerator(new Md5FileNameGenerator()) .diskCacheSize(50 * 1024 * 1024) // 50 MiB .tasksProcessingOrder(QueueProcessingType.LIFO); ImageLoader.getInstance().init(config.build()); picOptions = new DisplayImageOptions.Builder() .imageScaleType(ImageScaleType.EXACTLY) .cacheOnDisk(false).cacheInMemory(false) .resetViewBeforeLoading(true) .displayer(new FadeInBitmapDisplayer(500)).build(); }
Example #21
Source File: ServiceOfflineDownload.java From BigApp_WordPress_Android with Apache License 2.0 | 5 votes |
private void cacheTopicImage(ArrayList<TopicImage> imgList) { if (imgList == null || imgList.size() == 0) { return; } for (TopicImage image : imgList) { if (image == null || TextUtils.isEmpty(image.source)) { continue; } ImageLoader.getInstance().loadImageSync(image.source, new DisplayImageOptions.Builder() .imageScaleType(ImageScaleType.IN_SAMPLE_INT) .bitmapConfig(Bitmap.Config.RGB_565).considerExifParams(true) .cacheInMemory(false).cacheOnDisk(true).resetViewBeforeLoading(true) .considerExifParams(true).build()); } }
Example #22
Source File: ImageUtils.java From BigApp_Discuz_Android with Apache License 2.0 | 5 votes |
/** * 初始化 ImageLoader * * @param context */ public static ImageLoader initNoCacheImageLoader(Context context) { DisplayImageOptions options = new DisplayImageOptions.Builder() .resetViewBeforeLoading(false).delayBeforeLoading(100) .considerExifParams(false) .imageScaleType(ImageScaleType.IN_SAMPLE_INT) .bitmapConfig(Bitmap.Config.RGB_565) .displayer(new SimpleBitmapDisplayer()).handler(new Handler()) .cacheInMemory(false).cacheOnDisk(false) // .showImageForEmptyUri(R.drawable.default_pic) // .showImageOnFail(R.drawable.default_pic) .build(); ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder( context.getApplicationContext()) .threadPoolSize(10) .threadPriority(Thread.NORM_PRIORITY - 2) .tasksProcessingOrder(QueueProcessingType.FIFO) .denyCacheImageMultipleSizesInMemory() .memoryCache(new UsingFreqLimitedMemoryCache(3 * 1024 * 1024)) .imageDownloader( new BaseImageDownloader(context.getApplicationContext())) .defaultDisplayImageOptions(options) // .writeDebugLogs() .build(); ImageLoader imageLoader = ImageLoader.getInstance(); imageLoader.init(config); return imageLoader; }
Example #23
Source File: BaseImageDecoder.java From BigApp_WordPress_Android with Apache License 2.0 | 5 votes |
protected Bitmap considerExactScaleAndOrientatiton(Bitmap subsampledBitmap, ImageDecodingInfo decodingInfo, int rotation, boolean flipHorizontal) { Matrix m = new Matrix(); // Scale to exact size if need ImageScaleType scaleType = decodingInfo.getImageScaleType(); if (scaleType == ImageScaleType.EXACTLY || scaleType == ImageScaleType.EXACTLY_STRETCHED) { ImageSize srcSize = new ImageSize(subsampledBitmap.getWidth(), subsampledBitmap.getHeight(), rotation); float scale = ImageSizeUtils.computeImageScale(srcSize, decodingInfo.getTargetSize(), decodingInfo .getViewScaleType(), scaleType == ImageScaleType.EXACTLY_STRETCHED); if (Float.compare(scale, 1f) != 0) { m.setScale(scale, scale); if (loggingEnabled) { L.d(LOG_SCALE_IMAGE, srcSize, srcSize.scale(scale), scale, decodingInfo.getImageKey()); } } } // Flip bitmap if need if (flipHorizontal) { m.postScale(-1, 1); if (loggingEnabled) L.d(LOG_FLIP_IMAGE, decodingInfo.getImageKey()); } // Rotate bitmap if need if (rotation != 0) { m.postRotate(rotation); if (loggingEnabled) L.d(LOG_ROTATE_IMAGE, rotation, decodingInfo.getImageKey()); } Bitmap finalBitmap = Bitmap.createBitmap(subsampledBitmap, 0, 0, subsampledBitmap.getWidth(), subsampledBitmap .getHeight(), m, true); if (finalBitmap != subsampledBitmap) { subsampledBitmap.recycle(); } return finalBitmap; }
Example #24
Source File: LoadAndDisplayImageTask.java From BigApp_WordPress_Android with Apache License 2.0 | 5 votes |
/** Decodes image file into Bitmap, resize it and save it back */ private boolean resizeAndSaveImage(int maxWidth, int maxHeight) throws IOException { // Decode image file, compress and re-save it boolean saved = false; File targetFile = configuration.diskCache.get(uri); if (targetFile != null && targetFile.exists()) { ImageSize targetImageSize = new ImageSize(maxWidth, maxHeight); DisplayImageOptions specialOptions = new DisplayImageOptions.Builder().cloneFrom(options) .imageScaleType(ImageScaleType.IN_SAMPLE_INT).build(); ImageDecodingInfo decodingInfo = new ImageDecodingInfo(memoryCacheKey, Scheme.FILE.wrap(targetFile.getAbsolutePath()), uri, targetImageSize, ViewScaleType.FIT_INSIDE, getDownloader(), specialOptions); Bitmap bmp = decoder.decode(decodingInfo); if (bmp != null && configuration.processorForDiskCache != null) { L.d(LOG_PROCESS_IMAGE_BEFORE_CACHE_ON_DISK, memoryCacheKey); bmp = configuration.processorForDiskCache.process(bmp); if (bmp == null) { L.e(ERROR_PROCESSOR_FOR_DISK_CACHE_NULL, memoryCacheKey); } } if (bmp != null) { saved = configuration.diskCache.save(uri, bmp); bmp.recycle(); } } return saved; }
Example #25
Source File: BaseImageDecoder.java From mobile-manager-tool with MIT License | 5 votes |
protected Bitmap considerExactScaleAndOrientatiton(Bitmap subsampledBitmap, ImageDecodingInfo decodingInfo, int rotation, boolean flipHorizontal) { Matrix m = new Matrix(); // Scale to exact size if need ImageScaleType scaleType = decodingInfo.getImageScaleType(); if (scaleType == ImageScaleType.EXACTLY || scaleType == ImageScaleType.EXACTLY_STRETCHED) { ImageSize srcSize = new ImageSize(subsampledBitmap.getWidth(), subsampledBitmap.getHeight(), rotation); float scale = ImageSizeUtils.computeImageScale(srcSize, decodingInfo.getTargetSize(), decodingInfo .getViewScaleType(), scaleType == ImageScaleType.EXACTLY_STRETCHED); if (Float.compare(scale, 1f) != 0) { m.setScale(scale, scale); if (loggingEnabled) { L.d(LOG_SCALE_IMAGE, srcSize, srcSize.scale(scale), scale, decodingInfo.getImageKey()); } } } // Flip bitmap if need if (flipHorizontal) { m.postScale(-1, 1); if (loggingEnabled) L.d(LOG_FLIP_IMAGE, decodingInfo.getImageKey()); } // Rotate bitmap if need if (rotation != 0) { m.postRotate(rotation); if (loggingEnabled) L.d(LOG_ROTATE_IMAGE, rotation, decodingInfo.getImageKey()); } Bitmap finalBitmap = Bitmap.createBitmap(subsampledBitmap, 0, 0, subsampledBitmap.getWidth(), subsampledBitmap .getHeight(), m, true); if (finalBitmap != subsampledBitmap) { subsampledBitmap.recycle(); } return finalBitmap; }
Example #26
Source File: ImageConfig.java From candybar with Apache License 2.0 | 5 votes |
public static DisplayImageOptions.Builder getRawDefaultImageOptions() { DisplayImageOptions.Builder options = new DisplayImageOptions.Builder(); options.delayBeforeLoading(10) .bitmapConfig(Bitmap.Config.RGB_565) .imageScaleType(ImageScaleType.EXACTLY); return options; }
Example #27
Source File: UniversalImageLoader.java From UltimateAndroid with Apache License 2.0 | 5 votes |
/** * Return default DisplayImageOptions.Builder * @return */ public static DisplayImageOptions.Builder getDefaultImageOptionsBuilder() { DisplayImageOptions.Builder builder = new DisplayImageOptions.Builder() .resetViewBeforeLoading(false) // default // .delayBeforeLoading(1000) // .showImageOnLoading(R.drawable.titanic_wave_black) .considerExifParams(false) // default .imageScaleType(ImageScaleType.IN_SAMPLE_POWER_OF_2) // default .bitmapConfig(Bitmap.Config.ARGB_8888) // default .displayer(new SimpleBitmapDisplayer()) // default .handler(new Handler()) // default .cacheInMemory(true) .cacheOnDisk(true); return builder; }
Example #28
Source File: ImageBaseUtils.java From BigApp_Discuz_Android with Apache License 2.0 | 5 votes |
public static DisplayImageOptions getDefaultDisplayImageOptions() { DisplayImageOptions options = new DisplayImageOptions.Builder() .resetViewBeforeLoading(false).delayBeforeLoading(100) .considerExifParams(false) .imageScaleType(ImageScaleType.IN_SAMPLE_INT) .bitmapConfig(Bitmap.Config.RGB_565) .displayer(new SimpleBitmapDisplayer()).handler(new Handler()) .cacheInMemory(true).cacheOnDisk(true) // .showImageForEmptyUri(R.drawable.default_pic) // .showImageOnFail(R.drawable.default_pic) .build(); return options; }
Example #29
Source File: Utils.java From fdroidclient with GNU General Public License v3.0 | 5 votes |
/** * Since there have been vulnerabilities in EXIF processing in Android, this * disables all use of EXIF. * * @see <a href="https://securityaffairs.co/wordpress/51043/mobile-2/android-cve-2016-3862-flaw.html">CVE-2016-3862</a> */ public static DisplayImageOptions.Builder getDefaultDisplayImageOptionsBuilder() { if (defaultDisplayImageOptionsBuilder == null) { defaultDisplayImageOptionsBuilder = new DisplayImageOptions.Builder() .cacheInMemory(true) .cacheOnDisk(true) .considerExifParams(false) .bitmapConfig(Bitmap.Config.RGB_565) .imageScaleType(ImageScaleType.EXACTLY); } return defaultDisplayImageOptionsBuilder; }
Example #30
Source File: ImageLibUitls.java From BigApp_Discuz_Android with Apache License 2.0 | 5 votes |
public static DisplayImageOptions getDisplayImageOptions(Drawable drawableEmpty, Drawable drawableFail) { DisplayImageOptions options = new DisplayImageOptions.Builder() .resetViewBeforeLoading(false).delayBeforeLoading(100) .considerExifParams(false) .imageScaleType(ImageScaleType.IN_SAMPLE_INT) .bitmapConfig(Bitmap.Config.RGB_565) .displayer(new SimpleBitmapDisplayer()).handler(new Handler()) .cacheInMemory(true).cacheOnDisk(true) .showImageForEmptyUri(drawableEmpty) .showImageOnFail(drawableFail) .build(); return options; }