com.nostra13.universalimageloader.core.DisplayImageOptions Java Examples
The following examples show how to use
com.nostra13.universalimageloader.core.DisplayImageOptions.
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: Utils.java From fdroidclient with GNU General Public License v3.0 | 7 votes |
/** * If app has an iconUrl we feed that to UIL, otherwise we ask the PackageManager which will * return the app's icon directly when the app is installed. * We fall back to the placeholder icon otherwise. */ public static void setIconFromRepoOrPM(@NonNull App app, ImageView iv, Context context) { if (app.getIconUrl(iv.getContext()) == null) { try { iv.setImageDrawable(context.getPackageManager().getApplicationIcon(app.packageName)); } catch (PackageManager.NameNotFoundException e) { DisplayImageOptions options = Utils.getRepoAppDisplayImageOptions(); iv.setImageDrawable(options.shouldShowImageForEmptyUri() ? options.getImageForEmptyUri(FDroidApp.getInstance().getResources()) : null); } } else { ImageLoader.getInstance().displayImage( app.getIconUrl(iv.getContext()), iv, Utils.getRepoAppDisplayImageOptions()); } }
Example #2
Source File: SampleUilFactory.java From fresco with MIT License | 6 votes |
public static ImageLoader getImageLoader(Context context) { if (sImageLoader == null) { DisplayImageOptions displayImageOptions = new DisplayImageOptions.Builder() .showImageOnLoading(Drawables.sPlaceholderDrawable) .showImageOnFail(Drawables.sErrorDrawable) .cacheInMemory(true) .cacheOnDisk(true) .build(); ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context) .defaultDisplayImageOptions(displayImageOptions) .diskCacheSize(ConfigConstants.MAX_DISK_CACHE_SIZE) .memoryCacheSize(ConfigConstants.MAX_MEMORY_CACHE_SIZE) .build(); sImageLoader = ImageLoader.getInstance(); sImageLoader.init(config); } return sImageLoader; }
Example #3
Source File: ImageLoaderTools.java From Social with Apache License 2.0 | 6 votes |
private static ImageLoader initImageLoader(Context context) { DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder() .cacheInMemory(true) .cacheOnDisc(true) .showStubImage(R.drawable.image_holder) .showImageForEmptyUri(R.drawable.image_holder) .showImageOnFail(R.drawable.image_holder) .build(); ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context) .defaultDisplayImageOptions(defaultOptions)// .discCacheSize(DISK_CACHE_SIZE_BYTES) .memoryCacheSize(MEMORY_CACHE_SIZE_BYTES) .build(); ImageLoader tmpIL = ImageLoader.getInstance(); tmpIL.init(config); return tmpIL; }
Example #4
Source File: MyMessageFragment.java From foodie-app with Apache License 2.0 | 6 votes |
@Override public void onBindViewHolder(final ViewHolder holder, int position) { // //显示作品图片的配置 // if(holder.mViewType==IS_HEADER){ // return; // }else if (holder.mViewType==IS_NORMAL){ // position=position-1; // } DisplayImageOptions worksImageOptions = new DisplayImageOptions.Builder() .showImageOnLoading(R.drawable.loading_large) .showImageOnFail(R.drawable.recipe) .cacheInMemory(true) .cacheOnDisk(true) .bitmapConfig(Bitmap.Config.RGB_565) .build(); ImageLoader.getInstance().displayImage(worksList.get(position).getThumbnail(), holder.mWorksImageView, worksImageOptions); holder.mIntroductionView.setText(worksList.get(position).getIntroduction()); holder.mPostTimeView.setText(worksList.get(position).getCreateTime()); }
Example #5
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 #6
Source File: ImageLoaderTools.java From Social with Apache License 2.0 | 6 votes |
private static ImageLoader initImageLoader(Context context) { DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder() .cacheInMemory(true) .cacheOnDisc(true) .showStubImage(R.drawable.image_holder) .showImageForEmptyUri(R.drawable.image_holder) .showImageOnFail(R.drawable.image_holder) .build(); ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context) .defaultDisplayImageOptions(defaultOptions)// .discCacheSize(DISK_CACHE_SIZE_BYTES) .memoryCacheSize(MEMORY_CACHE_SIZE_BYTES) .build(); ImageLoader tmpIL = ImageLoader.getInstance(); tmpIL.init(config); return tmpIL; }
Example #7
Source File: ItemsDetailActivity.java From tup.dota2recipe with Apache License 2.0 | 6 votes |
/** * 绑定视图-物品简单数据信息 * * @param v * @param cItem * @param cImageLoadOptions */ public static void bindItemsItemSimpleView(final View v, final ItemsItem cItem, final DisplayImageOptions cImageLoadOptions) { if (v == null || cItem == null || cImageLoadOptions == null) { return; } ImageLoader.getInstance().displayImage( Utils.getItemsImageUri(cItem.keyName), ((ImageView) v.findViewById(R.id.image_items)), cImageLoadOptions); ((TextView) v.findViewById(R.id.text_items_dname)).setText(cItem.dname); ((TextView) v.findViewById(R.id.text_items_dname_l)).setText(cItem.dname_l); ((TextView) v.findViewById(R.id.text_items_cost)).setText(String.valueOf(cItem.cost)); }
Example #8
Source File: ImageDecodingInfo.java From mobile-manager-tool with MIT License | 6 votes |
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 #9
Source File: AsyncImageView.java From GithubTrends with Apache License 2.0 | 6 votes |
protected void executeLoadImage() { if (TextUtils.isEmpty(url)) { setImageResource(R.drawable.image_loading_resource); } else { DisplayImageOptions.Builder builder = new DisplayImageOptions.Builder() .showImageOnLoading(R.drawable.image_loading_resource) .cacheInMemory(true) .cacheOnDisk(true) .displayer(new SimpleBitmapDisplayer()); DisplayImageOptions options = builder.build(); ImageLoader.getInstance().displayImage(url, this, options, imageLoadingListener); } }
Example #10
Source File: ImageLoaderUtils.java From DevUtils with Apache License 2.0 | 6 votes |
/** * 初始化 ImageLoader 加载配置 * @param context {@link Context} */ public static void init(final Context context) { DisplayImageOptions options = DF_OPTIONS; // 针对图片缓存的全局加载配置 ( 主要有线程类、缓存大小、磁盘大小、图片下载与解析、日志方面的配置 ) ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context) .defaultDisplayImageOptions(options) // 加载 DisplayImageOptions 参数 .threadPriority(Thread.NORM_PRIORITY - 2) // 线程池内加载的数量 .denyCacheImageMultipleSizesInMemory() // 加载同一 URL 图片时 imageView 从小变大时从内存缓存中加载 //.memoryCache(new UsingFreqLimitedMemoryCache(1024 * 1024)) // 通过自己的内存缓存实现 .memoryCacheSize(2 * 1024 * 1024) // 内存缓存最大值 .memoryCacheSizePercentage(13) //.diskCacheSize(50 * 1024 * 1024) // SDCard 缓存最大值 50mb //.discCacheFileNameGenerator(new Md5FileNameGenerator()) // 将保存的时候的 URI 名称用 MD5 加密 //.diskCacheFileCount(100) // 缓存的文件数量 //.memoryCache(new WeakMemoryCache()).diskCacheFileNameGenerator(new HashCodeFileNameGenerator()) .imageDownloader(new BaseImageDownloader(context)) // default .tasksProcessingOrder(QueueProcessingType.LIFO).build(); ImageLoader.getInstance().init(config); }
Example #11
Source File: ImageLoaderManager.java From Focus with GNU General Public License v3.0 | 6 votes |
public static DisplayImageOptions getSubsciptionIconOptions(Context context) { Drawable defaultDrawable; Drawable errorDrawable = context.getResources().getDrawable(R.drawable.loading_error); defaultDrawable = context.getResources().getDrawable(R.drawable.ic_loading); /* if (SkinPreference.getInstance().getSkinName().equals("night")) { defaultDrawable = context.getResources().getDrawable(R.drawable.ic_night_loading); } else { defaultDrawable = context.getResources().getDrawable(R.drawable.ic_day_loading); }*/ DisplayImageOptions options = new DisplayImageOptions.Builder() .showImageOnLoading(defaultDrawable) .showImageForEmptyUri(defaultDrawable) .showImageOnFail(errorDrawable) .cacheInMemory(true) .cacheOnDisk(true) .build(); return options; }
Example #12
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 #13
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 #14
Source File: App.java From VideoMeeting with Apache License 2.0 | 6 votes |
private void initLib() { // 初始化日志功能, 开启/关闭 日志输出 L.setLogOpen(AppConstant.LOG_OPEN); // 初始化自定义异常捕获 CrashHandler.getInstance().init(this); // 初始化ImageLoader // 设置图片显示选项 DisplayImageOptions displayOp = new DisplayImageOptions.Builder() .showImageOnLoading(0)// 图片正在加载时显示的背景 .cacheInMemory(true)// 缓存在内存中 .cacheOnDisk(true)// 缓存在磁盘中 .displayer(new FadeInBitmapDisplayer(300))// 显示渐变动画 .bitmapConfig(Bitmap.Config.RGB_565) // 设置图片的解码类型 .considerExifParams(true)// 考虑旋转角 .build(); ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder( getApplicationContext()).defaultDisplayImageOptions(displayOp) .denyCacheImageMultipleSizesInMemory()// 不解析多种尺寸 .build(); ImageLoader.getInstance().init(config); }
Example #15
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 #16
Source File: ImageLoaderOptions.java From BigApp_WordPress_Android with Apache License 2.0 | 5 votes |
private static DisplayImageOptions.Builder getBaseOptionsUser() { return new DisplayImageOptions.Builder() .showImageForEmptyUri(R.drawable.z_iv_default_user) .showImageOnFail(R.drawable.z_iv_default_user) .showImageOnLoading(R.drawable.z_iv_default_user) .imageScaleType(ImageScaleType.IN_SAMPLE_INT) .displayer(new RoundedCircleBitmapDisplayer()) .bitmapConfig(Bitmap.Config.RGB_565).considerExifParams(true); }
Example #17
Source File: DemoActivity.java From Masaccio with Apache License 2.0 | 5 votes |
private static DisplayImageOptions getProcessorDisplayImageOptions( final BitmapProcessor processor) { final DisplayImageOptions.Builder defaultOptionsBuilder = new DisplayImageOptions.Builder(); return defaultOptionsBuilder.imageScaleType(ImageScaleType.NONE) .postProcessor(processor) .build(); }
Example #18
Source File: ImageLoaderOptions.java From BigApp_WordPress_Android with Apache License 2.0 | 5 votes |
private static DisplayImageOptions.Builder getBaseOptions() { return new DisplayImageOptions.Builder() .showImageForEmptyUri(BaseApplication.sDefaultImageDrawable) .showImageOnFail(BaseApplication.sDefaultImageDrawable) .showImageOnLoading(BaseApplication.sDefaultImageDrawable) .imageScaleType(ImageScaleType.IN_SAMPLE_INT) .bitmapConfig(Bitmap.Config.RGB_565).considerExifParams(true) .displayer(new FadeInBitmapDisplayer(300)); }
Example #19
Source File: ImageLoadProxy.java From JianDan with Apache License 2.0 | 5 votes |
/** * 设置图片放缩类型为模式EXACTLY,用于图片详情页的缩放 * * @return */ public static DisplayImageOptions getOption4ExactlyType() { return new DisplayImageOptions.Builder() .cacheInMemory(true) .cacheOnDisk(true) .bitmapConfig(Bitmap.Config.RGB_565) .resetViewBeforeLoading(true) .considerExifParams(true) .imageScaleType(ImageScaleType.EXACTLY) .build(); }
Example #20
Source File: MyApplication.java From zhangshangwuda with Apache License 2.0 | 5 votes |
private void initImageLoader() { DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder() .cacheInMemory(true).cacheOnDisc(true).build(); File cacheDir = StorageUtils.getCacheDirectory(this); File cacheImg = new File(cacheDir, "IMG"); ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder( getApplicationContext()) .defaultDisplayImageOptions(defaultOptions) .discCache(new UnlimitedDiscCache(cacheImg)) .discCacheSize(30 * 1024 * 1024) // .writeDebugLogs() .build(); mImageLoader = ImageLoader.getInstance(); mImageLoader.init(config); }
Example #21
Source File: ImageConfig.java From candybar-library with Apache License 2.0 | 5 votes |
public static DisplayImageOptions getDefaultImageOptions(boolean cacheOnDisk) { DisplayImageOptions.Builder options = new DisplayImageOptions.Builder(); options.delayBeforeLoading(10) .resetViewBeforeLoading(true) .bitmapConfig(Bitmap.Config.RGB_565) .imageScaleType(ImageScaleType.EXACTLY) .displayer(new FadeInBitmapDisplayer(700)) .cacheOnDisk(cacheOnDisk) .cacheInMemory(false); return options.build(); }
Example #22
Source File: ImageLoaders.java From LLApp with Apache License 2.0 | 5 votes |
public static void setsendimg(String url, ImageView imageView) { if (sendoptions == null) { sendoptions = 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, sendoptions); }
Example #23
Source File: ChannelAdapterHelper.java From buddycloud-android with Apache License 2.0 | 5 votes |
private static void loadAvatar(Context parent, ViewHolder holder, String channelJid) { String avatarURL = AvatarUtils.avatarURL(parent, channelJid); DisplayImageOptions dio = new DisplayImageOptions.Builder() .cloneFrom(ImageHelper.defaultImageOptions()) .showImageOnFail(R.drawable.personal_50px) .showImageOnLoading(R.drawable.personal_50px) .build(); ImageLoader.getInstance().displayImage(avatarURL, holder.avatar, dio); }
Example #24
Source File: LetvCacheMannager.java From letv with Apache License 2.0 | 5 votes |
public synchronized void loadImage(String url, ImageView imageView, DisplayImageOptions options, ImageLoadingListener loadingListener) { if (ImageLoader.getInstance().isInited()) { if (!(TextUtils.isEmpty(url) || imageView == null)) { ImageLoader.getInstance().displayImage(url, imageView, options, loadingListener); } } }
Example #25
Source File: LetvCacheMannager.java From letv with Apache License 2.0 | 5 votes |
public synchronized void loadImage(String url, ImageView imageView, DisplayImageOptions options) { if (ImageLoader.getInstance().isInited()) { if (!(TextUtils.isEmpty(url) || imageView == null)) { ImageLoader.getInstance().displayImage(url, imageView, options); } } }
Example #26
Source File: FeatureImage.java From fdroidclient with GNU General Public License v3.0 | 5 votes |
public void loadImageAndDisplay(@NonNull ImageLoader loader, @NonNull DisplayImageOptions imageOptions, String url) { loader.loadImage(url, imageOptions, new ImageLoadingAdapter() { @Override public void onLoadingComplete(String imageUri, View view, final Bitmap loadedImage) { if (loadedImage != null) { setImageBitmap(loadedImage); } } }); }
Example #27
Source File: MessageChatAdapter.java From Conquer with Apache License 2.0 | 5 votes |
public MessageChatAdapter(Context context, List<BmobMsg> msgList) { // TODO Auto-generated constructor stub super(context, msgList); currentObjectId = BmobUserManager.getInstance(context).getCurrentUserObjectId(); options = new DisplayImageOptions.Builder().showImageForEmptyUri(R.drawable.ic_launcher).showImageOnFail(R.drawable.ic_launcher) .resetViewBeforeLoading(true).cacheOnDisc(true).cacheInMemory(true).imageScaleType(ImageScaleType.EXACTLY) .bitmapConfig(Bitmap.Config.RGB_565).considerExifParams(true).displayer(new FadeInBitmapDisplayer(300)).build(); }
Example #28
Source File: Utils.java From tup.dota2recipe with Apache License 2.0 | 5 votes |
/** * * @return */ public static DisplayImageOptions createDisplayImageOptions() { return new DisplayImageOptions.Builder() .showStubImage(R.drawable.abs__progress_medium_holo) .showImageForEmptyUri(R.drawable.hero_for_empty_url) .cacheInMemory() .build(); }
Example #29
Source File: AdapterMusic.java From DMAudioStreamer with Apache License 2.0 | 5 votes |
public AdapterMusic(Context context, List<MediaMetaData> authors) { this.musicList = authors; this.mContext = context; this.inflate = LayoutInflater.from(context); this.colorPlay = ColorStateList.valueOf(context.getResources().getColor(R.color.md_black_1000)); this.colorPause = ColorStateList.valueOf(context.getResources().getColor(R.color.md_blue_grey_500_75)); this.options = new DisplayImageOptions.Builder() .showImageOnLoading(R.drawable.bg_default_album_art) .showImageForEmptyUri(R.drawable.bg_default_album_art) .showImageOnFail(R.drawable.bg_default_album_art).cacheInMemory(true) .cacheOnDisk(true).considerExifParams(true) .bitmapConfig(Bitmap.Config.RGB_565).build(); }
Example #30
Source File: ImageLoadProxy.java From JianDan_OkHttp with Apache License 2.0 | 5 votes |
/** * 加载图片列表专用,加载前会重置View * {@link com.nostra13.universalimageloader.core.DisplayImageOptions.Builder#resetViewBeforeLoading} = true * * @param loadingResource * @return */ public static DisplayImageOptions getOptions4PictureList(int loadingResource) { return new DisplayImageOptions.Builder() .cacheInMemory(true) .cacheOnDisk(true) .bitmapConfig(Bitmap.Config.RGB_565) .resetViewBeforeLoading(true) .showImageOnLoading(loadingResource) .showImageForEmptyUri(loadingResource) .showImageOnFail(loadingResource) .build(); }