public void loadImage(String s, ImageSize imagesize, DisplayImageOptions displayimageoptions, ImageLoadingListener imageloadinglistener, ImageLoadingProgressListener imageloadingprogresslistener) { a(); if (imagesize == null) { imagesize = h.a(); } DisplayImageOptions displayimageoptions1; if (displayimageoptions == null) { displayimageoptions1 = h.r; } else { displayimageoptions1 = displayimageoptions; } displayImage(s, new NonViewAware(s, imagesize, ViewScaleType.CROP), displayimageoptions1, imageloadinglistener, imageloadingprogresslistener); }
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 void loadImage(String uri, ImageSize targetImageSize, DisplayImageOptions options, ImageLoadingListener listener, ImageLoadingProgressListener progressListener) { checkConfiguration(); if (targetImageSize == null) { targetImageSize = this.configuration.getMaxImageSize(); } if (options == null) { options = this.configuration.defaultDisplayImageOptions; } displayImage(uri, new NonViewAware(uri, targetImageSize, ViewScaleType.CROP), options, listener, progressListener); }
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 k(String s, ImageAware imageaware, ImageSize imagesize, String s1, DisplayImageOptions displayimageoptions, ImageLoadingListener imageloadinglistener, ImageLoadingProgressListener imageloadingprogresslistener, ReentrantLock reentrantlock) { a = s; c = imageaware; d = imagesize; e = displayimageoptions; f = imageloadinglistener; g = imageloadingprogresslistener; h = reentrantlock; b = s1; }
/** * 添加图片加载任务到执行线程池中。图片会通过回调方法返回 * @param uri 图片URL地址 * @param targetImageSize 期望目标图片大小尺寸 * @param options 图片配置项 * @param listener 图片加载监听器 * @param progressListener 图片下载进度监听器 */ public void loadImage(String uri, ImageSize targetImageSize, DisplayImageOptions options, ImageLoadingListener listener, ImageLoadingProgressListener progressListener) { checkConfiguration(); if (targetImageSize == null) { targetImageSize = configuration.getMaxImageSize(); } if (options == null) { options = configuration.defaultDisplayImageOptions; } NonViewAware imageAware = new NonViewAware(uri, targetImageSize, ViewScaleType.CROP); displayImage(uri, imageAware, options, listener, progressListener); }
public void displayImage(String uri, ImageAware imageAware, DisplayImageOptions options, ImageLoadingListener listener, ImageLoadingProgressListener progressListener) { checkConfiguration(); if (imageAware == null) { throw new IllegalArgumentException(ERROR_WRONG_ARGUMENTS); } if (listener == null) { listener = this.emptyListener; } if (options == null) { options = this.configuration.defaultDisplayImageOptions; } if (TextUtils.isEmpty(uri)) { this.engine.cancelDisplayTaskFor(imageAware); listener.onLoadingStarted(uri, imageAware.getWrappedView()); if (options.shouldShowImageForEmptyUri()) { imageAware.setImageDrawable(options.getImageForEmptyUri(this.configuration.resources)); } else { imageAware.setImageDrawable(null); } listener.onLoadingComplete(uri, imageAware.getWrappedView(), null); return; } ImageSize targetSize = ImageSizeUtils.defineTargetSizeForView(imageAware, this.configuration.getMaxImageSize()); String memoryCacheKey = MemoryCacheUtils.generateKey(uri, targetSize); this.engine.prepareDisplayTaskFor(imageAware, memoryCacheKey); listener.onLoadingStarted(uri, imageAware.getWrappedView()); Bitmap bmp = (Bitmap) this.configuration.memoryCache.get(memoryCacheKey); if (bmp == null || bmp.isRecycled()) { if (options.shouldShowImageOnLoading()) { imageAware.setImageDrawable(options.getImageOnLoading(this.configuration.resources)); } else if (options.isResetViewBeforeLoading()) { imageAware.setImageDrawable(null); } LoadAndDisplayImageTask displayTask = new LoadAndDisplayImageTask(this.engine, new ImageLoadingInfo(uri, imageAware, targetSize, memoryCacheKey, options, listener, progressListener, this.engine.getLockForUri(uri)), defineHandler(options)); if (options.isSyncLoading()) { displayTask.run(); return; } else { this.engine.submit(displayTask); return; } } L.d(LOG_LOAD_IMAGE_FROM_MEMORY_CACHE, memoryCacheKey); if (options.shouldPostProcess()) { ProcessAndDisplayImageTask displayTask2 = new ProcessAndDisplayImageTask(this.engine, bmp, new ImageLoadingInfo(uri, imageAware, targetSize, memoryCacheKey, options, listener, progressListener, this.engine.getLockForUri(uri)), defineHandler(options)); if (options.isSyncLoading()) { displayTask2.run(); return; } else { this.engine.submit(displayTask2); return; } } options.getDisplayer().display(bmp, imageAware, LoadedFrom.MEMORY_CACHE); listener.onLoadingComplete(uri, imageAware.getWrappedView(), bmp); }
public void displayImage(String uri, ImageView imageView, DisplayImageOptions options, ImageLoadingListener listener, ImageLoadingProgressListener progressListener) { displayImage(uri, new ImageViewAware(imageView), options, listener, progressListener); }
public void displayImage(String uri, ImageAware imageAware, DisplayImageOptions options, ImageLoadingListener listener, ImageLoadingProgressListener progressListener) { displayImage(uri, imageAware, options, null, listener, progressListener); }
public void displayImage(String uri, ImageAware imageAware, DisplayImageOptions options, ImageSize targetSize, ImageLoadingListener listener, ImageLoadingProgressListener progressListener) { checkConfiguration(); if (imageAware == null) { throw new IllegalArgumentException(ERROR_WRONG_ARGUMENTS); } if (listener == null) { listener = this.defaultListener; } if (options == null) { options = this.configuration.defaultDisplayImageOptions; } if (TextUtils.isEmpty(uri)) { this.engine.cancelDisplayTaskFor(imageAware); listener.onLoadingStarted(uri, imageAware.getWrappedView()); if (options.shouldShowImageForEmptyUri()) { imageAware.setImageDrawable(options.getImageForEmptyUri(this.configuration .resources)); } else { imageAware.setImageDrawable(null); } listener.onLoadingComplete(uri, imageAware.getWrappedView(), null); return; } if (targetSize == null) { targetSize = ImageSizeUtils.defineTargetSizeForView(imageAware, this.configuration .getMaxImageSize()); } String memoryCacheKey = MemoryCacheUtils.generateKey(uri, targetSize); this.engine.prepareDisplayTaskFor(imageAware, memoryCacheKey); listener.onLoadingStarted(uri, imageAware.getWrappedView()); Bitmap bmp = this.configuration.memoryCache.get(memoryCacheKey); if (bmp == null || bmp.isRecycled()) { if (options.shouldShowImageOnLoading()) { imageAware.setImageDrawable(options.getImageOnLoading(this.configuration .resources)); } else if (options.isResetViewBeforeLoading()) { imageAware.setImageDrawable(null); } LoadAndDisplayImageTask displayTask = new LoadAndDisplayImageTask(this.engine, new ImageLoadingInfo(uri, imageAware, targetSize, memoryCacheKey, options, listener, progressListener, this.engine.getLockForUri(uri)), defineHandler (options)); if (options.isSyncLoading()) { displayTask.run(); return; } else { this.engine.submit(displayTask); return; } } L.d(LOG_LOAD_IMAGE_FROM_MEMORY_CACHE, memoryCacheKey); if (options.shouldPostProcess()) { ProcessAndDisplayImageTask displayTask2 = new ProcessAndDisplayImageTask(this.engine, bmp, new ImageLoadingInfo(uri, imageAware, targetSize, memoryCacheKey, options, listener, progressListener, this.engine.getLockForUri(uri)), defineHandler(options)); if (options.isSyncLoading()) { displayTask2.run(); return; } else { this.engine.submit(displayTask2); return; } } options.getDisplayer().display(bmp, imageAware, LoadedFrom.MEMORY_CACHE); listener.onLoadingComplete(uri, imageAware.getWrappedView(), bmp); }
@Override public View getView(int position, View convertView, ViewGroup parent) { ViewHolder viewHolder = null; if(convertView == null) { viewHolder = new ViewHolder(); convertView = mLayoutInflater.inflate(R.layout.frag_item_listview , null); viewHolder.tv_Manhua_Name = (TextView) convertView.findViewById(R.id.id_manhua_name); viewHolder.tv_Manhua_lastUpdate = (TextView) convertView.findViewById(R.id.id_manhua_lastUpdate); viewHolder.iv_Manhua_Cover = (ImageView) convertView.findViewById(R.id.id_manhua_Cover); convertView.setTag(viewHolder); } else { viewHolder = (ViewHolder) convertView.getTag(); viewHolder.iv_Manhua_Cover.setImageResource(R.drawable.empty_photo); } Manhua manhua = getItem(position); viewHolder.tv_Manhua_Name.setText(manhua.getmName()); int manhuaLastUpdate = manhua.getmLastUpdate(); int year = manhuaLastUpdate / 10000; int month = manhuaLastUpdate / 100 % 100; int day = manhuaLastUpdate % 100; viewHolder.tv_Manhua_lastUpdate.setText("������� : " + year + "��" + month + "��" + day + "��"); String imageURL = manhua.getmCoverImg(); mImageLoader.displayImage(imageURL , viewHolder.iv_Manhua_Cover , mOptions , new SimpleImageLoadingListener() , new ImageLoadingProgressListener() { @Override public void onProgressUpdate(String imageUri, View view, int current, int total) { } }); return convertView; }
/** * ÿ������Ҫ��ʾ����������������getView()���� */ @Override public View getView(int position, View convertView, ViewGroup parent) { Manhua manhua = getItem(position); String imageUrl = manhua.getmCoverImg(); String manhuaName = manhua.getmName(); ViewHolder viewHolder = null; if(convertView == null) { viewHolder = new ViewHolder(); convertView = mLayoutInflater.inflate(R.layout.photo_layout, null); viewHolder.imageView = (ImageView) convertView.findViewById(R.id.id_photo); viewHolder.textView = (TextView) convertView.findViewById(R.id.id_firsttab_manhua_name); convertView.setTag(viewHolder); } else { viewHolder = (ViewHolder) convertView.getTag(); viewHolder.imageView.setImageResource(R.drawable.empty_photo); } if(viewHolder.imageView.getLayoutParams().height != mItemHeight) { viewHolder.imageView.getLayoutParams().height = mItemHeight; } viewHolder.textView.setText(manhuaName); mImageLoader.displayImage(imageUrl , viewHolder.imageView , mOptions , new SimpleImageLoadingListener() , new ImageLoadingProgressListener() { @Override public void onProgressUpdate(String imageUri, View view, int current, int total) { } }); return convertView; }
public void displayImage(String s, ImageView imageview, DisplayImageOptions displayimageoptions, ImageLoadingListener imageloadinglistener, ImageLoadingProgressListener imageloadingprogresslistener) { displayImage(s, ((ImageAware) (new ImageViewAware(imageview))), displayimageoptions, imageloadinglistener, imageloadingprogresslistener); }
/** * Adds load image task to execution pool. Image will be returned with * {@link ImageLoadingListener#onLoadingComplete(String, android.view.View, android.graphics.Bitmap)} callback}. * <br /> * <b>NOTE:</b> {@link #init(ImageLoaderConfiguration)} method must be called before this method call * * @param uri Image URI (i.e. "http://site.com/image.png", "file:///mnt/sdcard/image.png") * @param targetImageSize Minimal size for {@link Bitmap} which will be returned in * {@linkplain ImageLoadingListener#onLoadingComplete(String, android.view.View, * android.graphics.Bitmap)} callback}. Downloaded image will be decoded * and scaled to {@link Bitmap} of the size which is <b>equal or larger</b> (usually a bit * larger) than incoming targetImageSize. * @param options {@linkplain com.nostra13.universalimageloader.core.DisplayImageOptions Options} for image * decoding and displaying. If <b>null</b> - default display image options * {@linkplain ImageLoaderConfiguration.Builder#defaultDisplayImageOptions(DisplayImageOptions) * from configuration} will be used.<br /> * @param listener {@linkplain ImageLoadingListener Listener} for image loading process. Listener fires * events on UI thread if this method is called on UI thread. * @param progressListener {@linkplain com.nostra13.universalimageloader.core.listener.ImageLoadingProgressListener * Listener} for image loading progress. Listener fires events on UI thread if this method * is called on UI thread. Caching on disk should be enabled in * {@linkplain com.nostra13.universalimageloader.core.DisplayImageOptions options} to make * this listener work. * @throws IllegalStateException if {@link #init(ImageLoaderConfiguration)} method wasn't called before */ public void loadImage(String uri, ImageSize targetImageSize, DisplayImageOptions options, ImageLoadingListener listener, ImageLoadingProgressListener progressListener) { checkConfiguration(); if (targetImageSize == null) { targetImageSize = configuration.getMaxImageSize(); } if (options == null) { options = configuration.defaultDisplayImageOptions; } NonViewAware imageAware = new NonViewAware(uri, targetImageSize, ViewScaleType.CROP); displayImage(uri, imageAware, options, listener, progressListener); }
/** * Adds load image task to execution pool. Image will be returned with * {@link ImageLoadingListener#onLoadingComplete(String, View, Bitmap)} callback}. * <br /> * <b>NOTE:</b> {@link #init(ImageLoaderConfiguration)} method must be called before this method call * * @param uri Image URI (i.e. "http://site.com/image.png", "file:///mnt/sdcard/image.png") * @param targetImageSize Minimal size for {@link Bitmap} which will be returned in * {@linkplain ImageLoadingListener#onLoadingComplete(String, View, * Bitmap)} callback}. Downloaded image will be decoded * and scaled to {@link Bitmap} of the size which is <b>equal or larger</b> (usually a bit * larger) than incoming targetImageSize. * @param options {@linkplain com.nostra13.universalimageloader.core.DisplayImageOptions Options} for image * decoding and displaying. If <b>null</b> - default display image options * {@linkplain ImageLoaderConfiguration.Builder#defaultDisplayImageOptions(DisplayImageOptions) * from configuration} will be used.<br /> * @param listener {@linkplain ImageLoadingListener Listener} for image loading process. Listener fires * events on UI thread if this method is called on UI thread. * @param progressListener {@linkplain ImageLoadingProgressListener * Listener} for image loading progress. Listener fires events on UI thread if this method * is called on UI thread. Caching on disk should be enabled in * {@linkplain com.nostra13.universalimageloader.core.DisplayImageOptions options} to make * this listener work. * @throws IllegalStateException if {@link #init(ImageLoaderConfiguration)} method wasn't called before */ public void loadImage(String uri,String access_token, ImageSize targetImageSize, DisplayImageOptions options, ImageLoadingListener listener, ImageLoadingProgressListener progressListener) { checkConfiguration(); if (targetImageSize == null) { targetImageSize = configuration.getMaxImageSize(); } if (options == null) { options = configuration.defaultDisplayImageOptions; } NonViewAware imageAware = new NonViewAware(uri, targetImageSize, ViewScaleType.CROP); displayImage(uri,access_token, imageAware, options, listener, progressListener); }
/** * Adds load image task to execution pool. Image will be returned with * {@link com.nostra13.universalimageloader.core.listener.ImageLoadingListener#onLoadingComplete(String, android.view.View, android.graphics.Bitmap)} callback}. * <br /> * <b>NOTE:</b> {@link #init(com.nostra13.universalimageloader.core.ImageLoaderConfiguration)} method must be called before this method call * * @param uri Image URI (i.e. "http://site.com/image.png", "file:///mnt/sdcard/image.png") * @param targetImageSize Minimal size for {@link android.graphics.Bitmap} which will be returned in * {@linkplain com.nostra13.universalimageloader.core.listener.ImageLoadingListener#onLoadingComplete(String, android.view.View, * android.graphics.Bitmap)} callback}. Downloaded image will be decoded * and scaled to {@link android.graphics.Bitmap} of the size which is <b>equal or larger</b> (usually a bit * larger) than incoming targetImageSize. * @param options {@linkplain com.nostra13.universalimageloader.core.DisplayImageOptions Options} for image * decoding and displaying. If <b>null</b> - default display image options * {@linkplain com.nostra13.universalimageloader.core.ImageLoaderConfiguration.Builder#defaultDisplayImageOptions(com.nostra13.universalimageloader.core.DisplayImageOptions) * from configuration} will be used.<br /> * @param listener {@linkplain com.nostra13.universalimageloader.core.listener.ImageLoadingListener Listener} for image loading process. Listener fires * events on UI thread if this method is called on UI thread. * @param progressListener {@linkplain com.nostra13.universalimageloader.core.listener.ImageLoadingProgressListener * Listener} for image loading progress. Listener fires events on UI thread if this method * is called on UI thread. Caching on disk should be enabled in * {@linkplain com.nostra13.universalimageloader.core.DisplayImageOptions options} to make * this listener work. * @throws IllegalStateException if {@link #init(com.nostra13.universalimageloader.core.ImageLoaderConfiguration)} method wasn't called before */ public void loadImage(String uri, ImageSize targetImageSize, DisplayImageOptions options, ImageLoadingListener listener, ImageLoadingProgressListener progressListener) { checkConfiguration(); if (targetImageSize == null) { targetImageSize = configuration.getMaxImageSize(); } if (options == null) { options = configuration.defaultDisplayImageOptions; } NonViewAware imageAware = new NonViewAware(uri, targetImageSize, ViewScaleType.CROP); displayImage(uri, imageAware, options, listener, progressListener); }