本文整理匯總了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<>();
}