本文整理汇总了Java中com.nostra13.universalimageloader.core.display.RoundedBitmapDisplayer类的典型用法代码示例。如果您正苦于以下问题:Java RoundedBitmapDisplayer类的具体用法?Java RoundedBitmapDisplayer怎么用?Java RoundedBitmapDisplayer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
RoundedBitmapDisplayer类属于com.nostra13.universalimageloader.core.display包,在下文中一共展示了RoundedBitmapDisplayer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getOption
import com.nostra13.universalimageloader.core.display.RoundedBitmapDisplayer; //导入依赖的package包/类
/**获取配置
* @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();
}
示例2: getDefaultConfig
import com.nostra13.universalimageloader.core.display.RoundedBitmapDisplayer; //导入依赖的package包/类
/**
* 获取图片加载器的图片的配置
*
* @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();
}
示例3: getRoundBitmapOption
import com.nostra13.universalimageloader.core.display.RoundedBitmapDisplayer; //导入依赖的package包/类
/**
* 获取一个圆角的配置
*
* @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;
}
示例4: ConversationsCursorRowAdapter
import com.nostra13.universalimageloader.core.display.RoundedBitmapDisplayer; //导入依赖的package包/类
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();
}
示例5: ContactCursorRowAdapter
import com.nostra13.universalimageloader.core.display.RoundedBitmapDisplayer; //导入依赖的package包/类
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();
}
示例6: MessageSearchCursorRowAdapter
import com.nostra13.universalimageloader.core.display.RoundedBitmapDisplayer; //导入依赖的package包/类
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();
}
示例7: load
import com.nostra13.universalimageloader.core.display.RoundedBitmapDisplayer; //导入依赖的package包/类
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();
}
}
示例8: load
import com.nostra13.universalimageloader.core.display.RoundedBitmapDisplayer; //导入依赖的package包/类
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();
}
}
示例9: loadImage
import com.nostra13.universalimageloader.core.display.RoundedBitmapDisplayer; //导入依赖的package包/类
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);
}
}
}
示例10: fireFailEvent
import com.nostra13.universalimageloader.core.display.RoundedBitmapDisplayer; //导入依赖的package包/类
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);
}
示例11: getDisplayOptions
import com.nostra13.universalimageloader.core.display.RoundedBitmapDisplayer; //导入依赖的package包/类
@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;
}
示例12: getSimpleOptions
import com.nostra13.universalimageloader.core.display.RoundedBitmapDisplayer; //导入依赖的package包/类
/**
* 设置常用的设置项
* @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;
}
示例13: onBindViewHolder
import com.nostra13.universalimageloader.core.display.RoundedBitmapDisplayer; //导入依赖的package包/类
@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());
}
}
示例14: getDisplayOptions
import com.nostra13.universalimageloader.core.display.RoundedBitmapDisplayer; //导入依赖的package包/类
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;
}
示例15: ChatItemArrayAdapter
import com.nostra13.universalimageloader.core.display.RoundedBitmapDisplayer; //导入依赖的package包/类
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<>();
}