/**获取配置 * @param cornerRadiusSize * @param defaultImageResId * @return */ @SuppressWarnings("deprecation") private static DisplayImageOptions getOption(int cornerRadiusSize, int defaultImageResId) { Options options0 = new Options(); options0.inPreferredConfig = Bitmap.Config.RGB_565; DisplayImageOptions.Builder builder = new DisplayImageOptions.Builder(); if(defaultImageResId > 0) { try { builder.showImageForEmptyUri(defaultImageResId) .showImageOnLoading(defaultImageResId) .showImageOnFail(defaultImageResId); } catch (Exception e) { Log.e(TAG, "getOption try {builder.showImageForEmptyUri(defaultImageResId) ..." + " >> } catch (Exception e) { \n" + e.getMessage()); } } if (cornerRadiusSize > 0) { builder.displayer(new RoundedBitmapDisplayer(cornerRadiusSize)); } return builder.cacheInMemory(true).cacheOnDisc(true).decodingOptions(options0).build(); }
/** * 获取图片加载器的图片的配置 * * @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(); }
/** * 获取一个圆角的配置 * * @return */ public static DisplayImageOptions getRoundBitmapOption( int cornerRadiusPixels, int marginPixels) { DisplayImageOptions options = new DisplayImageOptions.Builder() . // 网络图片下载完成之前的预加载的默认图片 showImageOnLoading(R.mipmap.ic_launcher) . // 网络图片下载失败后显示该默认图片 showImageOnFail(R.mipmap.ic_launcher) . // 图片的质量 bitmapConfig(Bitmap.Config.RGB_565) .cacheInMemory(true) .cacheOnDisk(true) .displayer( new RoundedBitmapDisplayer(cornerRadiusPixels, marginPixels)).build(); return options; }
public ConversationsCursorRowAdapter(SherlockFragmentActivity activity, int layout, String match) { // add param true for higthlite super(activity, layout, null, new String[] { MessageDAO.RECIPIENT_IDS, MessageDAO.SNIPPET, MessageDAO.DATE}, new int[] { R.id.respondent, R.id.body, R.id.millis}, 0); this.activity =activity; me = Me.getMe(); this.layout = layout; this.conversationIdIndex = 0; //cursor.getColumnIndex(MessageDAO._ID); this.recipientIdsIndex = 1; //cursor.getColumnIndex(MessageDAO.RECIPIENT_IDS); this.bodyIndex = 2; //cursor.getColumnIndex(MessageDAO.SNIPPET); this.dateIndex = 3; //cursor.getColumnIndex(MessageDAO.DATE); this.unreadIndex=4; //cursor.getColumnIndex(MessageDAO.UNPROCESSED_COUNT); this.match = match; this.notifyDataSetChanged(); this.layoutInflater = LayoutInflater.from(activity); options = new DisplayImageOptions.Builder() // .showImageOnLoading(R.drawable.contact) .showImageForEmptyUri(R.drawable.contact) .showImageOnFail(R.drawable.contact) .resetViewBeforeLoading(true) .cacheInMemory(true) .cacheOnDisc(true) .displayer(new RoundedBitmapDisplayer(20)) .build(); }
public ContactCursorRowAdapter (Activity activity, int layout, Cursor cursor, String match) { super(activity, layout, cursor, new String[] { ContactsContract.Contacts.DISPLAY_NAME}, new int[] { R.id.contactName }, 0); this.activity = activity; this.layout = layout; this.contactNameIndex = 1;//cursor.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME); this.idIndex = 0;//cursor.getColumnIndex(ContactsContract.Contacts._ID); this.keyIndex=3; this.layoutInflater = LayoutInflater.from(activity); this.match = match; options = new DisplayImageOptions.Builder() .showStubImage(R.drawable.contact) //.showImageOnLoading(R.drawable.contact_unknown) .showImageForEmptyUri(R.drawable.contact) .showImageOnFail(R.drawable.contact) // .resetViewBeforeLoading(true) .cacheInMemory(true) .cacheOnDisc(true) .displayer(new RoundedBitmapDisplayer(20)) .build(); }
public MessageSearchCursorRowAdapter(Activity activity, int layout) { // add param true for higthlite super(activity, layout, null, new String[] { MessageDAO.ADDRESS, MessageDAO.BODY, MessageDAO.DATE}, new int[] { R.id.respondent, R.id.body, R.id.millis}, 0); this.activity =activity; me = Me.getMe(); messageDAO=me.getMessageDAO(); this.layout = layout; this.messageIdIndex=0; //cursor.getColumnIndex(MessageDAO._ID); this.conversationIdIndex = 1; //cursor.getColumnIndex(MessageDAO.CONVERSATION_ID); this.addressIndex = 2; //cursor.getColumnIndex(MessageDAO.ADDRESS); this.bodyIndex = 3; //cursor.getColumnIndex(MessageDAO.BODY); this.dateIndex = 4; //cursor.getColumnIndex(MessageDAO.DATE); this.notifyDataSetChanged(); this.layoutInflater = LayoutInflater.from(activity); options = new DisplayImageOptions.Builder() // .showImageOnLoading(R.drawable.contact) .showImageForEmptyUri(R.drawable.contact) .showImageOnFail(R.drawable.contact) .resetViewBeforeLoading(true) .cacheInMemory(true) .cacheOnDisc(true) .displayer(new RoundedBitmapDisplayer(20)) .build(); }
public void load(String imageUri,String access_token, ImageView imageView, Drawable defaultDrawable, int round,ImageLoadingListener listener){ DisplayImageOptions.Builder builder = new DisplayImageOptions.Builder(); builder.showImageOnLoading(defaultDrawable).showImageForEmptyUri(null) .showImageOnFail(null).cacheInMemory(true).cacheOnDisk(true) .considerExifParams(true).bitmapConfig(Bitmap.Config.RGB_565); if (round > 0) { builder.displayer(new RoundedBitmapDisplayer(round)); } DisplayImageOptions options = builder.build(); try{ if(listener == null){ _imageLoader.displayImage(imageUri,access_token, imageView, options); }else{ _imageLoader.displayImage(imageUri,access_token, imageView, options,listener); } }catch(Exception e){ e.printStackTrace(); } }
public void load(String imageUri,String access_token, ImageView imageView, int defaultDrawable, int round,ImageLoadingListener listener) { if(StringUtil.isEmpty(imageUri)){ imageUri = "http://www.liyueyun.com"; } DisplayImageOptions.Builder builder = new DisplayImageOptions.Builder(); builder.showImageOnLoading(defaultDrawable).showImageForEmptyUri(null) .showImageOnFail(null).cacheInMemory(true).cacheOnDisk(true) .considerExifParams(true).bitmapConfig(Bitmap.Config.RGB_565); if (round > 0) { builder.displayer(new RoundedBitmapDisplayer(round)); } DisplayImageOptions options = builder.build(); try{ if(listener == null){ _imageLoader.displayImage(imageUri,access_token, imageView, options); }else{ _imageLoader.displayImage(imageUri,access_token, imageView, options,listener); } }catch(Exception e){ e.printStackTrace(); } }
public void load(String imageUri, ImageView imageView, Drawable defaultDrawable, int round,ImageLoadingListener listener){ DisplayImageOptions.Builder builder = new DisplayImageOptions.Builder(); builder.showImageOnLoading(defaultDrawable).showImageForEmptyUri(null) .showImageOnFail(null).cacheInMemory(true).cacheOnDisk(true) .considerExifParams(true).bitmapConfig(Bitmap.Config.RGB_565); if (round > 0) { builder.displayer(new RoundedBitmapDisplayer(round)); } DisplayImageOptions options = builder.build(); try{ if(listener == null){ _imageLoader.displayImage(imageUri, imageView, options); }else{ _imageLoader.displayImage(imageUri, imageView, options,listener); } }catch(Exception e){ e.printStackTrace(); } }
public void load(String imageUri, ImageView imageView, int defaultDrawable, int round,ImageLoadingListener listener) { if(imageUri == null){ imageUri = "http://www.liyueyun.com"; } DisplayImageOptions.Builder builder = new DisplayImageOptions.Builder(); builder.showImageOnLoading(defaultDrawable).showImageForEmptyUri(null) .showImageOnFail(null).cacheInMemory(true).cacheOnDisk(true) .considerExifParams(true).bitmapConfig(Bitmap.Config.RGB_565); if (round > 0) { builder.displayer(new RoundedBitmapDisplayer(round)); } DisplayImageOptions options = builder.build(); try{ if(listener == null){ _imageLoader.displayImage(imageUri, imageView, options); }else{ _imageLoader.displayImage(imageUri, imageView, options,listener); } }catch(Exception e){ e.printStackTrace(); } }
public void loadImage(String url) { if (url == null) { imageView.setImageResource(errorResId); loadingView.setVisibility(View.GONE); } else { if (shape == SHAPE_ROUND_CORNER) { DisplayImageOptions roundCornerOptions = new DisplayImageOptions.Builder() .cacheInMemory(true) .cacheOnDisk(true) .bitmapConfig(Bitmap.Config.ARGB_8888) .displayer(new RoundedBitmapDisplayer(20)) .build(); ImageLoader.getInstance().displayImage(url, imageView, roundCornerOptions, listener); } else { ImageLoader.getInstance().displayImage(url, imageView, listener); } } }
private void fireFailEvent(final FailType failType, final Throwable failCause) { if (syncLoading || isTaskInterrupted() || isTaskNotActual()) return; Runnable r = new Runnable() { @Override public void run() { if (options.shouldShowImageOnFail()) { Bitmap bitmapOnFaile = options.getImageBitmapOnFail(configuration.resources); if (options.getDisplayer() instanceof RoundedBitmapDisplayer && bitmapOnFaile != null) { int corner = ((RoundedBitmapDisplayer) options.getDisplayer()).getRoundedBitmapCorner(); if (corner != 0) { imageAware.setImageDrawable(new RoundedBitmapDisplayer.RoundedDrawable(bitmapOnFaile, corner, 0)); } } else { imageAware.setImageDrawable(options.getImageOnFail(configuration.resources)); } } listener.onLoadingFailed(uri, imageAware.getWrappedView(), new FailReason(failType, failCause)); } }; runTask(r, false, handler, engine); }
@SuppressWarnings("deprecation") private DisplayImageOptions getDisplayOptions() { DisplayImageOptions options; options = new DisplayImageOptions.Builder().showImageOnLoading(R.mipmap.ic_launcher) // 设置图片在下载期间显示的图片 .showImageForEmptyUri(R.mipmap.ic_launcher)// 设置图片Uri为空或是错误的时候显示的图片 .showImageOnFail(R.mipmap.ic_launcher) // 设置图片加载/解码过程中错误时候显示的图片 .cacheInMemory(true)// 设置下载的图片是否缓存在内存中 .cacheOnDisc(true)// 设置下载的图片是否缓存在SD卡中 .considerExifParams(true) // 是否考虑JPEG图像EXIF参数(旋转,翻转) .imageScaleType(ImageScaleType.IN_SAMPLE_INT)// 设置图片以如何的编码方式显示 .bitmapConfig(Bitmap.Config.RGB_565)// 设置图片的解码类型// // .delayBeforeLoading(int delayInMillis)//int // delayInMillis为你设置的下载前的延迟时间 // 设置图片加入缓存前,对bitmap进行设置 // .preProcessor(BitmapProcessor preProcessor) .resetViewBeforeLoading(true)// 设置图片在下载前是否重置,复位 .displayer(new RoundedBitmapDisplayer(20))// 是否设置为圆角,弧度为多少 .displayer(new FadeInBitmapDisplayer(100))// 是否图片加载好后渐入的动画时间 .build();// 构建完成 return options; }
/** * 设置常用的设置项 * @return */ public static DisplayImageOptions getSimpleOptions(int round) { DisplayImageOptions options = new DisplayImageOptions.Builder() .showImageOnLoading(R.mipmap.bg) //设置图片在下载期间显示的图片 .showImageForEmptyUri(R.mipmap.bg)//设置图片Uri为空或是错误的时候显示的图片 .showImageOnFail(R.mipmap.bg) //设置图片加载/解码过程中错误时候显示的图片 .cacheInMemory(true)//设置下载的图片是否缓存在内存中 .cacheOnDisk(true)//设置下载的图片是否缓存在SD卡中 .imageScaleType(ImageScaleType.IN_SAMPLE_INT)//设置图片以如何的编码方式显示 .bitmapConfig(Bitmap.Config.RGB_565)//设置图片的解码类型 .imageScaleType(ImageScaleType.IN_SAMPLE_POWER_OF_2) .displayer(new RoundedBitmapDisplayer(round)) .resetViewBeforeLoading(true)//设置图片在下载前是否重置,复位 .build(); return options; }
@Override public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) { if (position < getItemCount() && (customHeaderView != null ? position <= mDataList.size() : position < mDataList.size()) && (customHeaderView != null ? position > 0 : true)) { ViewHolder viewHolder = (ViewHolder) holder; Dynamic expert = mDataList.get(position); DisplayImageOptions options = new DisplayImageOptions.Builder() .showImageOnFail(R.drawable.ic_launcher) .cacheInMemory(true) .cacheOnDisk(true) .considerExifParams(true) .displayer(new RoundedBitmapDisplayer(20)).build(); ImageLoader.getInstance().displayImage(expert.getPortraitUrl(), viewHolder.iv_my_expert_avatars, options); viewHolder.tv_my_expert_name.setText(expert.getName()); viewHolder.tv_my_expert_title.setText(expert.getTitle()); viewHolder.tv_my_expert_hospital.setText(expert.getHospital()); viewHolder.tv_my_expert_section.setText(expert.getSection()); } }
private DisplayImageOptions getDisplayOptions() { DisplayImageOptions options; options = new DisplayImageOptions.Builder() .showImageOnLoading(R.drawable.logo) // 设置图片在下载期间显示的图片 .showImageForEmptyUri(R.drawable.logo)// 设置图片Uri为空或是错误的时候显示的图片 .showImageOnFail(R.drawable.logo) // 设置图片加载/解码过程中错误时候显示的图片 .cacheInMemory(true)// 设置下载的图片是否缓存在内存中 .cacheOnDisc(true)// 设置下载的图片是否缓存在SD卡中 .considerExifParams(true) // 是否考虑JPEG图像EXIF参数(旋转,翻转) .imageScaleType(ImageScaleType.IN_SAMPLE_INT)// 设置图片以如何的编码方式显示 .bitmapConfig(Bitmap.Config.RGB_565)// 设置图片的解码类型// // .delayBeforeLoading(int delayInMillis)//int // delayInMillis为你设置的下载前的延迟时间 // 设置图片加入缓存前,对bitmap进行设置 // .preProcessor(BitmapProcessor preProcessor) .resetViewBeforeLoading(true)// 设置图片在下载前是否重置,复位 .displayer(new RoundedBitmapDisplayer(20))// 是否设置为圆角,弧度为多少 .displayer(new FadeInBitmapDisplayer(100))// 是否图片加载好后渐入的动画时间 .build();// 构建完成 return options; }
public ChatItemArrayAdapter(Context context, int textViewResourceId) { super(context, textViewResourceId); options = new DisplayImageOptions.Builder() // .showImageOnLoading(R.drawable.ic_stub) // .showImageForEmptyUri(R.drawable.ic_empty) .resetViewBeforeLoading(true) .showImageOnFail(R.drawable.left_chatitem_disconnect) // .showImageOnLoading(R.drawable.left_chatitem_loading) .cacheInMemory(true) .cacheOnDisk(true) .considerExifParams(true) .displayer(new RoundedBitmapDisplayer(10)) .build(); mViewHolders = new HashMap<>(); mLoadingItems = new HashSet<>(); }
public VideoListAdapter(Context context) { super(); this.context = context; layoutInflater = LayoutInflater.from(context); list = new ArrayList<VideoItem>(); // 图片加载器初始化 imageLoader.init(ImageLoaderConfiguration.createDefault(context)); // 使用DisplayImageOptions.Builder()创建DisplayImageOptions options = new DisplayImageOptions.Builder() .showStubImage(R.drawable.bili_default_image_tv_with_bg) // 设置图片下载期间显示的图片 .showImageForEmptyUri(R.drawable.bili_default_image_tv_with_bg) // 设置图片Uri为空或是错误的时候显示的图片 .showImageOnFail(R.drawable.bili_default_image_tv_with_bg) // 设置图片加载或解码过程中发生错误显示的图片 .cacheInMemory() // 设置下载的图片是否缓存在内存中 .cacheOnDisc() // 设置下载的图片是否缓存在SD卡中 .displayer(new RoundedBitmapDisplayer(1)) // 设置成圆角图片 .build(); // 创建配置过得DisplayImageOption对象 }
public SimpleProjectAdapter(Context context, int resource, List<Project> objects) { super(context, resource, objects); this.context = context; this.projects = objects; options = new DisplayImageOptions.Builder() .showImageOnLoading(R.drawable.charity) .showImageForEmptyUri(R.drawable.charity) .showImageOnFail(R.drawable.charity) .cacheInMemory(true) .cacheOnDisk(true) .considerExifParams(true) .displayer(new RoundedBitmapDisplayer(10)) .build(); animateFirstListener = new AnimateFirstDisplayListener(); }
/** * 新闻列表中用到的图片加载配置 * */ public static DisplayImageOptions getListOptions() { DisplayImageOptions options = new DisplayImageOptions.Builder() .showImageOnLoading(R.drawable.small_image_holder_listpage)// 设置图片在下载期间显示的图片 .showImageForEmptyUri(R.drawable.small_image_holder_listpage)// 设置图片Uri为空或是错误的时候显示的图片 .showImageOnFail(R.drawable.small_image_holder_listpage)// 设置图片加载/解码过程中错误时候显示的图片 .cacheInMemory(true) .cacheOnDisc(true) .considerExifParams(true) .imageScaleType(ImageScaleType.EXACTLY_STRETCHED)// 设置图片以如何的编码方式显示 .bitmapConfig(Bitmap.Config.RGB_565)// 设置图片的解码类型 .resetViewBeforeLoading(true)// 设置图片在下载前是否重置,复位 .displayer(new RoundedBitmapDisplayer(20))//是否设置为圆角,弧度为多少 .displayer(new FadeInBitmapDisplayer(100)) .build(); return options; }
@Override public View getView(int position, View convertView, ViewGroup parent) { if (convertView == null) { convertView = (LinearLayout) inflater.inflate(rowID, null); } // set value to item CatalogObj obj = (CatalogObj) getItem(position); TextView title = (TextView) convertView.findViewById(R.id.base_title); title.setText(obj.getName()); ImageView icon = (ImageView) convertView.findViewById(R.id.base_icon); DisplayImageOptions options = new DisplayImageOptions.Builder() .cacheInMemory(true).cacheOnDisc(true) // option to round image .displayer(new RoundedBitmapDisplayer(20)) .imageScaleType(ImageScaleType.IN_SAMPLE_POWER_OF_2).build(); TextView records = (TextView) convertView.findViewById(R.id.base_item_records); records.setText(Integer.toString(obj.getRecords())); imageLoader.displayImage(obj.getIcon(), icon, options); return convertView; }
public void displayTwitterFriendList() { //pd.dismiss(); options = new DisplayImageOptions.Builder() .showImageOnLoading(R.drawable.default_profile) .showImageForEmptyUri(R.drawable.default_profile) .showImageOnFail(R.drawable.default_profile) .cacheInMemory(true) .cacheOnDisc(true) .considerExifParams(true) .displayer(new RoundedBitmapDisplayer(0)) .build(); ((ListView) listView).setAdapter(new ItemAdapter(friendList)); }
public void displayCodepixFriendList() { //pd.dismiss(); options = new DisplayImageOptions.Builder() .showImageOnLoading(R.drawable.default_profile) .showImageForEmptyUri(R.drawable.default_profile) .showImageOnFail(R.drawable.default_profile) .cacheInMemory(true) .cacheOnDisc(true) .considerExifParams(true) .displayer(new RoundedBitmapDisplayer(0)) .build(); ((ListView) listView).setAdapter(new ItemAdapter(friendList)); }
public TimeListAdapter(Context context, ArrayList<TimeViewItem> data, HashMap<String, ArrayList<TimeCache>> recordCache) { this.context = context; this.values = data; this.record_cache = recordCache; options = new DisplayImageOptions.Builder() .cacheInMemory(true) .cacheOnDisk(true) .considerExifParams(true) .displayer(new RoundedBitmapDisplayer(20)) .build(); ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context) .defaultDisplayImageOptions(options) .build(); imageLoader.init(config); }
public CommentListAdapter(FragmentBase fragmentBase, CommentList comments, Context context) { super(); this.mContext = context; this.commentList = comments.commentList; this.mFragment = fragmentBase; // get instance instead of new XX imageLoader = ImageLoader.getInstance(); options = new DisplayImageOptions.Builder() .showImageOnLoading(R.drawable.aio_image_default_round) .showImageForEmptyUri(R.drawable.aio_image_fail_round) .showImageOnFail(R.drawable.aio_image_fail_round) .cacheInMemory(true).cacheOnDisk(true).considerExifParams(true) .build(); options_avatar = new DisplayImageOptions.Builder().cacheInMemory(true) .showImageOnLoading(R.drawable.qlink_defaut_avatar) .showImageForEmptyUri(R.drawable.qlink_defaut_avatar) .showImageOnFail(R.drawable.qlink_defaut_avatar) .cacheOnDisk(true).considerExifParams(true) .displayer(new RoundedBitmapDisplayer(50)).build(); }
public HomeListAdapter(FragmentBase fragmentBase, StatusList statuses, Context context) { super(); this.mContext = context; configManager = new ConfigManager(mContext); this.statusList = statuses.statusList; this.mFragment = fragmentBase; // get instance instead of new XX imageLoader = ImageLoader.getInstance(); options = new DisplayImageOptions.Builder() .showImageOnLoading(R.drawable.aio_image_default_round) .showImageForEmptyUri(R.drawable.aio_image_fail_round) .showImageOnFail(R.drawable.aio_image_fail_round) .cacheInMemory(true).cacheOnDisk(true).considerExifParams(true) .build(); options_avatar = new DisplayImageOptions.Builder() .showImageOnLoading(R.drawable.qlink_defaut_avatar) .showImageForEmptyUri(R.drawable.qlink_defaut_avatar) .showImageOnFail(R.drawable.qlink_defaut_avatar) .cacheInMemory(true).cacheOnDisk(true).considerExifParams(true) .displayer(new RoundedBitmapDisplayer(50)).build(); }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.ac_image_list); Bundle bundle = getIntent().getExtras(); imageUrls = bundle.getStringArray(Extra.IMAGES); options = new DisplayImageOptions.Builder() .showStubImage(R.drawable.ic_stub) .showImageForEmptyUri(R.drawable.ic_empty) .showImageOnFail(R.drawable.ic_error) .cacheInMemory(true) .cacheOnDisc(true) .displayer(new RoundedBitmapDisplayer(20)) .build(); listView = (ListView) findViewById(android.R.id.list); ((ListView) listView).setAdapter(new ItemAdapter()); listView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { startImagePagerActivity(position); } }); }
ImageAdapter(Context context) { inflater = LayoutInflater.from(context); options = new DisplayImageOptions.Builder() .showImageOnLoading(R.drawable.ic_stub) .showImageForEmptyUri(R.drawable.ic_empty) .showImageOnFail(R.drawable.ic_error) .cacheInMemory(true) .cacheOnDisk(true) .considerExifParams(true) .bitmapConfig(Bitmap.Config.RGB_565) .displayer(new RoundedBitmapDisplayer(20)) .build(); }
public static DisplayImageOptions getOptions() { DisplayImageOptions options; options = new DisplayImageOptions.Builder() .showStubImage(R.drawable.mini_avatar_shadow)// 设置图片在下载期间显示的图片 .showImageForEmptyUri(R.drawable.mini_avatar_shadow)// 设置图片Uri为空或是错误的时候显示的图片 .showImageOnFail(R.drawable.mini_avatar_shadow)// 设置图片加载/解码过程中错误时候显示的图片 .cacheInMemory(true)// 是否緩存都內存中 .cacheOnDisc(true)// 是否緩存到sd卡上 .displayer(new RoundedBitmapDisplayer(20)).build(); return options; }
public void get(String imageUri,String access_token,ImageLoadingListener listener,int round){ DisplayImageOptions.Builder builder = new DisplayImageOptions.Builder(); builder.showImageForEmptyUri(null) .showImageOnFail(null).cacheInMemory(true).cacheOnDisk(true) .considerExifParams(true).bitmapConfig(Bitmap.Config.RGB_565); if(round > 0){ builder.displayer(new RoundedBitmapDisplayer(round)); } DisplayImageOptions options = builder.build(); _imageLoader.loadImage(imageUri, access_token, options, listener); }
public void get(String imageUri,ImageLoadingListener listener,int round){ DisplayImageOptions.Builder builder = new DisplayImageOptions.Builder(); builder.showImageForEmptyUri(null) .showImageOnFail(null).cacheInMemory(true).cacheOnDisk(true) .considerExifParams(true).bitmapConfig(Bitmap.Config.RGB_565); if(round > 0){ builder.displayer(new RoundedBitmapDisplayer(round)); } DisplayImageOptions options = builder.build(); _imageLoader.loadImage(imageUri, options, listener); }
public static void setheadimg(int dis, String url, ImageView imageView) { if (options == null) { options = new DisplayImageOptions.Builder().showImageOnLoading(0) .showImageForEmptyUri(0).showImageOnFail(0) .cacheInMemory(true).cacheOnDisk(true) .considerExifParams(true) .displayer(new RoundedBitmapDisplayer(dis)).build(); } ImageLoader.getInstance().displayImage(url, imageView, options); }
public static void settopimg(int dis, String url, ImageView imageView) { if (optionstop == null) { optionstop = new DisplayImageOptions.Builder() .showImageOnLoading(0).showImageForEmptyUri(0) .showImageOnFail(0).cacheInMemory(true).cacheOnDisk(true) .considerExifParams(true) .displayer(new RoundedBitmapDisplayer(dis)).build(); } ImageLoader.getInstance().displayImage(url, imageView, optionstop); }
public DisplayImageOptions getDisplayOptions(int round) { return new DisplayImageOptions.Builder() .cacheInMemory(true) .bitmapConfig(Bitmap.Config.RGB_565) .imageScaleType(ImageScaleType.EXACTLY) .cacheOnDisk(true) .considerExifParams(true) .displayer(new RoundedBitmapDisplayer(DensityUtils.dip2px(mContext, round))) .build(); }
public DisplayImageOptions getDisplayOptions(int round, Drawable drawable) { return new DisplayImageOptions.Builder() .showImageOnLoading(drawable) .showImageForEmptyUri(drawable) .showImageOnFail(drawable) .cacheInMemory(true) .bitmapConfig(Bitmap.Config.RGB_565) .imageScaleType(ImageScaleType.EXACTLY) .cacheOnDisk(true) .considerExifParams(true) .displayer(new RoundedBitmapDisplayer(DensityUtils.dip2px(mContext, round))) .build(); }