private void fillUI() { mTvTitle.setText(mSoftware.getTitle()); mTvLicense.setText(mSoftware.getLicense()); mTvLanguage.setText(mSoftware.getLanguage()); mTvOs.setText(mSoftware.getOs()); mTvRecordTime.setText(mSoftware.getRecordtime()); DisplayImageOptions options = new DisplayImageOptions.Builder() .cacheInMemory(true).cacheOnDisk(true) .postProcessor(new BitmapProcessor() { @Override public Bitmap process(Bitmap arg0) { return arg0; } }).build(); ImageLoader.getInstance().displayImage(mSoftware.getLogo(), mIvLogo, options); notifyFavorite(mSoftware.getFavorite() == 1); }
private static ImageLoaderConfiguration getStandardOptions(final Context context, final BitmapProcessor processor) { final ImageLoaderConfiguration.Builder config = new ImageLoaderConfiguration.Builder(context); config.defaultDisplayImageOptions(getProcessorDisplayImageOptions(processor)); config.memoryCache(new WeakMemoryCache()); config.taskExecutor(Executors.newCachedThreadPool()); config.threadPriority(Thread.MIN_PRIORITY); config.imageDownloader(new OkHttpDownloader(context)); config.writeDebugLogs(); return config.build(); }
@Override public void run() { L.d(LOG_POSTPROCESS_IMAGE, imageLoadingInfo.memoryCacheKey); BitmapProcessor processor = imageLoadingInfo.options.getPostProcessor(); Bitmap processedBitmap = processor.process(bitmap); DisplayBitmapTask displayBitmapTask = new DisplayBitmapTask(processedBitmap, imageLoadingInfo, engine, LoadedFrom.MEMORY_CACHE); LoadAndDisplayImageTask.runTask(displayBitmapTask, imageLoadingInfo.options.isSyncLoading(), handler, engine); }
public Builder diskCacheExtraOptions(int maxImageWidthForDiskCache, int maxImageHeightForDiskCache, BitmapProcessor processorForDiskCache) { this.maxImageWidthForDiskCache = maxImageWidthForDiskCache; this.maxImageHeightForDiskCache = maxImageHeightForDiskCache; this.processorForDiskCache = processorForDiskCache; return this; }
public View getView(final int position, View convertView, ViewGroup parent){ Holder holder = new Holder(); LayoutInflater li = LayoutInflater.from(context); PlaylistItem current = playlistItems.get(position); View itemView = li.inflate(R.layout.listitem_screeninvader, parent, false); holder.title = (TextView) itemView.findViewById(R.id.view_title); holder.timestamp = (TextView) itemView.findViewById(R.id.view_timestamp); holder.thumbnail = (ImageView) itemView.findViewById(R.id.view_thumbnail); holder.title.setText(current.title); if(current.category == "youtube") {holder.timestamp.setText(getDuration(current.source_url));} current.id = current.url.substring(current.url.length() - 11); String thumbnailUrl = String.format(YOUTUBE_THUMBNAIL_LINK, current.id); DisplayImageOptions options = new DisplayImageOptions.Builder() .showImageForEmptyUri(R.drawable.ic_issues) .postProcessor(new BitmapProcessor() { @Override public Bitmap process(Bitmap bmp) { return Bitmap.createScaledBitmap(bmp, dpToPx(71), dpToPx(40), false); } }) .build(); imageLoader.displayImage(thumbnailUrl, holder.thumbnail, options); itemView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { SIAPI.sendSICommand("/playlist/index", Integer.toString(position)); } }); return itemView; }
@Override public void run() { L.d(LOG_POSTPROCESS_IMAGE, imageLoadingInfo.memoryCacheKey); BitmapProcessor processor = imageLoadingInfo.options.getPostProcessor(); Bitmap processedBitmap = processor.process(bitmap); com.nostra13.universalimageloader.core.DisplayBitmapTask displayBitmapTask = new com.nostra13.universalimageloader.core.DisplayBitmapTask(processedBitmap, imageLoadingInfo, engine, LoadedFrom.MEMORY_CACHE); com.nostra13.universalimageloader.core.LoadAndDisplayImageTask.runTask(displayBitmapTask, imageLoadingInfo.options.isSyncLoading(), handler, engine); }
public Builder diskCacheExtraOptions(int i1, int j1, BitmapProcessor bitmapprocessor) { h = i1; i = j1; j = bitmapprocessor; return this; }
public w diskCacheExtraOptions(int i1, int j1, BitmapProcessor bitmapprocessor) { h = i1; i = j1; j = bitmapprocessor; return this; }
@Override public void run() { L.d(LOG_POSTPROCESS_IMAGE, imageLoadingInfo.memoryCacheKey); //获取图片处理器 然后取得加载的图片 BitmapProcessor processor = imageLoadingInfo.options.getPostProcessor(); Bitmap processedBitmap = processor.process(bitmap); //封装图片显示任务 其中图片来源设置成-来自内存缓存 DisplayBitmapTask displayBitmapTask = new DisplayBitmapTask(processedBitmap, imageLoadingInfo, engine, LoadedFrom.MEMORY_CACHE); //执行任务 LoadAndDisplayImageTask.runTask(displayBitmapTask, imageLoadingInfo.options.isSyncLoading(), handler, engine); }
public UserCenterAdapter(DislayModeChangeListener lis) { mStates.put(DisplayMode.ACTIVE, STATE_LESS_ONE_PAGE); mStates.put(DisplayMode.BLOG, STATE_LESS_ONE_PAGE); mStates.put(DisplayMode.INFOMATION, STATE_LESS_ONE_PAGE); mListener = lis; options = new DisplayImageOptions.Builder().cacheInMemory(true) .cacheOnDisk(true).postProcessor(new BitmapProcessor() { @Override public Bitmap process(Bitmap arg0) { return arg0; } }).build(); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); options = new DisplayImageOptions.Builder().cacheOnDisk(true) .cacheInMemory(true).postProcessor(new BitmapProcessor() { @Override public Bitmap process(Bitmap arg0) { return arg0; } }).build(); }
SamplePagerAdapter(String[] images, OnPagerClickListener lis) { mListener = lis; this.images = images; options = new DisplayImageOptions.Builder().cacheInMemory(true) .postProcessor(new BitmapProcessor() { @Override public Bitmap process(Bitmap arg0) { return arg0; } }).cacheOnDisk(true).build(); }
public static DisplayImageOptions getWeiboImageDisplayImageOptions( BitmapProcessor postProcessor) { return new DisplayImageOptions.Builder() .showImageOnFail(R.drawable.weibo_image_holder) .showImageOnLoading(R.drawable.weibo_image_holder) .cacheOnDisk(true).postProcessor(postProcessor).build(); }
@Override public void run() { if (engine.configuration.writeLogs) L.d(LOG_POSTPROCESS_IMAGE, imageLoadingInfo.memoryCacheKey); BitmapProcessor processor = imageLoadingInfo.options.getPostProcessor(); final Bitmap processedBitmap = processor.process(bitmap); DisplayBitmapTask displayBitmapTask = new DisplayBitmapTask(processedBitmap, imageLoadingInfo, engine, LoadedFrom.MEMORY_CACHE); displayBitmapTask.setLoggingEnabled(engine.configuration.writeLogs); if (imageLoadingInfo.options.isSyncLoading()) { displayBitmapTask.run(); } else { handler.post(displayBitmapTask); } }
public static void downloadImage(String url, int maxHeight, SimpleImageLoadingListener listener, Context context) { AppDeck appDeck = AppDeck.getInstance(); final int height = maxHeight; DisplayImageOptions options = appDeck.getDisplayImageOptionsBuilder() .preProcessor(new BitmapProcessor() { @Override public Bitmap process(Bitmap in) { // TODO Auto-generated method stub int width = in.getWidth() * height / in.getHeight(); if (width > 0 && height > 0) return Bitmap.createScaledBitmap(in, width, height, true); return in; } }) .build(); // Load image, decode it to Bitmap and return Bitmap to callback //appDeck.imageLoader.loadImage(url, options, listener); ImageSize targetSize = new ImageSize(0, 0); ImageView fakeImage = new ImageView(context); fakeImage.setLayoutParams(new LayoutParams(targetSize.getWidth(), targetSize.getHeight())); fakeImage.setScaleType(ScaleType.CENTER_CROP); appDeck.imageLoader.displayImage(url, fakeImage, options, new Utils.FakeImageSimpleImageLoadingListener(fakeImage, listener) {}); }
public static void downloadIcon(String url, final int maxHeight, SimpleImageLoadingListener listener, Context context) { AppDeck appDeck = AppDeck.getInstance(); DisplayImageOptions options = appDeck.getDisplayImageOptionsBuilder() .preProcessor(new BitmapProcessor() { @Override public Bitmap process(Bitmap in) { // TODO Auto-generated method stub int height = maxHeight; int width = in.getWidth() * height / in.getHeight(); if (width > 0 && height > 0) return Bitmap.createScaledBitmap(in, width, height, true); return in; } }) .build(); // Load image, decode it to Bitmap and return Bitmap to callback ImageSize targetSize = new ImageSize(maxHeight, maxHeight); // result Bitmap will be fit to this size //appDeck.imageLoader.loadImage(url, targetSize, options, listener); ImageView fakeImage = new ImageView(context); fakeImage.setLayoutParams(new LayoutParams(targetSize.getWidth(), targetSize.getHeight())); fakeImage.setScaleType(ScaleType.CENTER_CROP); appDeck.imageLoader.displayImage(url, fakeImage, options, new Utils.FakeImageSimpleImageLoadingListener(fakeImage, listener) {}); }
@Override public void run() { if (engine.configuration.loggingEnabled) L.i(LOG_POSTPROCESS_IMAGE, imageLoadingInfo.memoryCacheKey); BitmapProcessor processor = imageLoadingInfo.options.getPostProcessor(); final Bitmap processedBitmap = processor.process(bitmap); if (processedBitmap != bitmap) { bitmap.recycle(); } handler.post(new DisplayBitmapTask(processedBitmap, imageLoadingInfo, engine)); }
private static DisplayImageOptions getProcessorDisplayImageOptions( final BitmapProcessor processor) { final DisplayImageOptions.Builder defaultOptionsBuilder = new DisplayImageOptions.Builder(); return defaultOptionsBuilder.imageScaleType(ImageScaleType.NONE) .postProcessor(processor) .build(); }
public TweetAdapter() { options = new DisplayImageOptions.Builder().cacheInMemory(true) .cacheOnDisk(true).postProcessor(new BitmapProcessor() { @Override public Bitmap process(Bitmap arg0) { return arg0; } }).build(); }
public ActiveAdapter(){ options = new DisplayImageOptions.Builder().cacheInMemory(true) .cacheOnDisk(true).postProcessor(new BitmapProcessor() { @Override public Bitmap process(Bitmap arg0) { return arg0; } }).build(); }
SamplePagerAdapter(String[] images) { this.images = images; options = new DisplayImageOptions.Builder().cacheInMemory(true) .postProcessor(new BitmapProcessor() { @Override public Bitmap process(Bitmap arg0) { return arg0; } }).cacheOnDisk(true).build(); }
public static void initImageLoader(Context context) { DisplayImageOptions displayOptions = new DisplayImageOptions.Builder() .preProcessor(new BitmapProcessor() { @Override public Bitmap process(Bitmap source) { Bitmap target = getRoundedCornerBitmapBig(source); if (source != target) { source.recycle(); } return target; } }).cacheInMemory(true).cacheOnDisk(true) .bitmapConfig(Config.ARGB_8888).build(); // This configuration tuning is custom. You can tune every option, you // may tune some of them, // or you can create default configuration by // ImageLoaderConfiguration.createDefault(this); // method. ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder( context).threadPriority(Thread.NORM_PRIORITY - 2) .denyCacheImageMultipleSizesInMemory() .diskCacheFileNameGenerator(new Md5FileNameGenerator()) .diskCacheSize(50 * 1024 * 1024) // 50 Mb .tasksProcessingOrder(QueueProcessingType.LIFO) .writeDebugLogs() // Remove for release app .defaultDisplayImageOptions(displayOptions).build(); // Initialize ImageLoader with configuration. ImageLoader.getInstance().init(config); }