本文整理汇总了Java中com.nostra13.universalimageloader.core.ImageLoader类的典型用法代码示例。如果您正苦于以下问题:Java ImageLoader类的具体用法?Java ImageLoader怎么用?Java ImageLoader使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ImageLoader类属于com.nostra13.universalimageloader.core包,在下文中一共展示了ImageLoader类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreateView
import com.nostra13.universalimageloader.core.ImageLoader; //导入依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_common, null);
DragLayout dragLayout = (DragLayout) rootView.findViewById(R.id.drag_layout);
imageView = (ImageView) dragLayout.findViewById(R.id.image);
ImageLoader.getInstance().displayImage(imageUrl, imageView);
address1 = dragLayout.findViewById(R.id.address1);
address2 = dragLayout.findViewById(R.id.address2);
address3 = dragLayout.findViewById(R.id.address3);
address4 = dragLayout.findViewById(R.id.address4);
address5 = dragLayout.findViewById(R.id.address5);
ratingBar = (RatingBar) dragLayout.findViewById(R.id.rating);
head1 = dragLayout.findViewById(R.id.head1);
head2 = dragLayout.findViewById(R.id.head2);
head3 = dragLayout.findViewById(R.id.head3);
head4 = dragLayout.findViewById(R.id.head4);
dragLayout.setGotoDetailListener(this);
return rootView;
}
示例2: onBindViewHolder
import com.nostra13.universalimageloader.core.ImageLoader; //导入依赖的package包/类
@Override
public void onBindViewHolder(ViewHolder holder, final int position) {
final IHistoryDailyPicks data = this.datas.get(position);
if (data != null) {
holder.titleTv.setText(data.getTitle());
holder.contentTv.setText(data.getDescribe());
holder.timeTv.setText(data.getTime());
holder.discussTv.setText(data.getDiscuss());
ImageLoader.getInstance().displayImage(data.getImgHref(), holder.picIv);
holder.rootView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
mListener.itemClicked(position, data.getTitle(), data.getHref());
}
});
}
}
示例3: getImageLoader
import com.nostra13.universalimageloader.core.ImageLoader; //导入依赖的package包/类
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;
}
示例4: initImageLoader
import com.nostra13.universalimageloader.core.ImageLoader; //导入依赖的package包/类
public static void initImageLoader(Context context) {
// 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.Builder config = new ImageLoaderConfiguration.Builder(context);
config.threadPriority(Thread.NORM_PRIORITY - 2);
config.denyCacheImageMultipleSizesInMemory();
config.diskCacheFileNameGenerator(new Md5FileNameGenerator());
config.diskCacheSize(50 * 1024 * 1024); // 50 MiB
config.tasksProcessingOrder(QueueProcessingType.LIFO);
config.writeDebugLogs(); // Remove for release app
// Initialize ImageLoader with configuration.
ImageLoader.getInstance().init(config.build());
}
示例5: initImageLoader
import com.nostra13.universalimageloader.core.ImageLoader; //导入依赖的package包/类
/**
* 初始化图片载入框架
*/
private void initImageLoader() {
File cacheDir = StorageUtils.getCacheDirectory(this);
int MAXMEMONRY = (int) (Runtime.getRuntime().maxMemory());
// System.out.println("dsa-->"+MAXMEMONRY+" "+(MAXMEMONRY/5));//.memoryCache(new
// LruMemoryCache(50 * 1024 * 1024))
DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder()
.cacheInMemory(true)
.cacheOnDisk(true)
.build();
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(
this).memoryCacheExtraOptions(480, 800).defaultDisplayImageOptions(defaultOptions)
.diskCacheExtraOptions(480, 800, null).threadPoolSize(3)
.threadPriority(Thread.NORM_PRIORITY - 2)
.tasksProcessingOrder(QueueProcessingType.FIFO)
.denyCacheImageMultipleSizesInMemory()
.memoryCache(new LruMemoryCache(MAXMEMONRY / 5))
.diskCache(new UnlimitedDiskCache(cacheDir))
.diskCacheFileNameGenerator(new HashCodeFileNameGenerator()) // default
.imageDownloader(new BaseImageDownloader(this)) // default
.imageDecoder(new BaseImageDecoder(false)) // default
.defaultDisplayImageOptions(DisplayImageOptions.createSimple()).build();
ImageLoader.getInstance().init(config);
}
示例6: onPanelStateChanged
import com.nostra13.universalimageloader.core.ImageLoader; //导入依赖的package包/类
@Override
public void onPanelStateChanged(View panel, SlidingUpPanelLayout.PanelState previousState,
SlidingUpPanelLayout.PanelState newState) {
File file = ImageLoader.getInstance().getDiskCache().get(mWallpaper.getUrl());
if (newState == SlidingUpPanelLayout.PanelState.COLLAPSED &&
mTooltip == null
&& Preferences.get(this).isShowWallpaperTooltip() &&
!file.exists() &&
!Preferences.get(this).isTimeToShowWallpaperPreviewIntro() &&
!Preferences.get(this).isHighQualityPreviewEnabled()) {
mTooltip = Tooltip.Builder(this)
.to(mMenuPreview)
.content(R.string.wallpaper_tooltip_preview)
.desc(R.string.wallpaper_tooltip_preview_icon_tap)
.descIcon(R.drawable.ic_toolbar_preview_full)
.visibleDontShowAgain(true)
.cancelable(false)
.buttonCallback(tooltip -> {
Preferences.get(this).setShowWallpaperTooltip(!tooltip.getCheckboxState());
tooltip.dismiss();
})
.build();
mTooltip.show();
}
}
示例7: onOptionsItemSelected
import com.nostra13.universalimageloader.core.ImageLoader; //导入依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case android.R.id.home:
this.finish();
return true;
case R.id.item_clear_memory_cache:
ImageLoader.getInstance().clearMemoryCache();
return true;
case R.id.item_clear_disc_cache:
ImageLoader.getInstance().clearDiskCache();
return true;
default:
return false;
}
}
示例8: getView
import com.nostra13.universalimageloader.core.ImageLoader; //导入依赖的package包/类
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
View view = convertView;
final ViewHolder holder;
if (convertView == null) {
view = inflater.inflate(R.layout.item_list_image, parent, false);
holder = new ViewHolder();
holder.text = (TextView) view.findViewById(R.id.text);
holder.image = (ImageView) view.findViewById(R.id.image);
view.setTag(holder);
} else {
holder = (ViewHolder) view.getTag();
}
holder.text.setText("Item " + (position + 1));
ImageLoader.getInstance().displayImage(IMAGE_URLS[position], holder.image, options, animateFirstListener);
return view;
}
示例9: onCreateView
import com.nostra13.universalimageloader.core.ImageLoader; //导入依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
@Nullable Bundle savedInstanceState) {
DisplayImageOptions displayImageOptions = new DisplayImageOptions.Builder()
.cacheInMemory(true)
.cacheOnDisk(true)
.imageScaleType(ImageScaleType.NONE)
.showImageOnLoading(R.drawable.screenshot_placeholder)
.showImageForEmptyUri(R.drawable.screenshot_placeholder)
.bitmapConfig(Bitmap.Config.RGB_565)
.build();
View rootView = inflater.inflate(R.layout.activity_screenshots_page, container, false);
ImageView screenshotView = (ImageView) rootView.findViewById(R.id.screenshot);
ImageLoader.getInstance().displayImage(screenshotUrl, screenshotView, displayImageOptions);
return rootView;
}
示例10: getView
import com.nostra13.universalimageloader.core.ImageLoader; //导入依赖的package包/类
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
ViewHolder viewHolder = null;
if(convertView == null) {
convertView = View.inflate(MainActivity.this,R.layout.list_item_layout,null);
viewHolder = new ViewHolder(convertView);
convertView.setTag(viewHolder);
} else {
viewHolder = (ViewHolder) convertView.getTag();
}
viewHolder.button.setText(position + "");
viewHolder.button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
VideoPlayerManager.getInstance().listVideoPlayer(listView, R.id.container, position, mDatas.get(position), position + "", mThumbs.get(position), ImageLoader.getInstance());
}
});
return convertView;
}
示例11: initImageLoader
import com.nostra13.universalimageloader.core.ImageLoader; //导入依赖的package包/类
private void initImageLoader() {
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this)
.threadPoolSize(5)
.threadPriority(Thread.NORM_PRIORITY - 2)
.denyCacheImageMultipleSizesInMemory()
.memoryCache(new LruMemoryCache(2 * 1024))
.memoryCacheSize(2 * 1024)
.defaultDisplayImageOptions(new DisplayImageOptions.Builder()
.showImageForEmptyUri(R.drawable.no_photo_group)
.showImageOnFail(R.drawable.no_photo_group)
.resetViewBeforeLoading(true)
.displayer(new FadeInBitmapDisplayer(300)).build())
.tasksProcessingOrder(QueueProcessingType.LIFO).build();
ImageLoader.getInstance().init(config);
com.nostra13.universalimageloader.utils.L.writeLogs(false);
}
示例12: initImageLoader
import com.nostra13.universalimageloader.core.ImageLoader; //导入依赖的package包/类
public void initImageLoader() {
File cacheDir = StorageUtils.getCacheDirectory(this);
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this)
.memoryCacheExtraOptions(480, 800) // default = device screen dimensions
.diskCacheExtraOptions(480, 800, null)
.denyCacheImageMultipleSizesInMemory()
.memoryCache(new LruMemoryCache(2 * 1024 * 1024))
.memoryCacheSize(2 * 1024 * 1024)
.memoryCacheSizePercentage(13) // default
.diskCache(new UnlimitedDiskCache(cacheDir)) // default
.diskCacheSize(50 * 1024 * 1024)
.diskCacheFileCount(100)
// .writeDebugLogs()
.build();
ImageLoader.getInstance().init(config);
}
示例13: onBindViewHolder
import com.nostra13.universalimageloader.core.ImageLoader; //导入依赖的package包/类
@Override
public void onBindViewHolder(ItemHolder itemHolder, int i) {
Song localItem = arraylist.get(i);
itemHolder.title.setText(localItem.title);
itemHolder.artist.setText(localItem.artistName);
if (MusicPlayer.getCurrentAudioId() == localItem.id) {
itemHolder.title.setTextColor(Config.accentColor(mContext, ateKey));
if (MusicPlayer.isPlaying()) {
itemHolder.visualizer.setColor(Config.accentColor(mContext, ateKey));
itemHolder.visualizer.setVisibility(View.VISIBLE);
}
} else {
itemHolder.title.setTextColor(Config.textColorPrimary(mContext, ateKey));
itemHolder.visualizer.setVisibility(View.GONE);
}
ImageLoader.getInstance().displayImage(TimberUtils.getAlbumArtUri(localItem.albumId).toString(), itemHolder.albumArt, new DisplayImageOptions.Builder().cacheInMemory(true).showImageOnFail(R.drawable.ic_empty_music2).resetViewBeforeLoading(true).build());
setOnPopupMenuListener(itemHolder, i);
}
示例14: onBindViewHolder
import com.nostra13.universalimageloader.core.ImageLoader; //导入依赖的package包/类
@Override
public void onBindViewHolder(ItemHolder itemHolder, int i) {
Album localItem = arraylist.get(i);
itemHolder.title.setText(localItem.title);
String songCount = TimberUtils.makeLabel(mContext, R.plurals.Nsongs, localItem.songCount);
itemHolder.details.setText(songCount);
ImageLoader.getInstance().displayImage(TimberUtils.getAlbumArtUri(localItem.id).toString(), itemHolder.albumArt,
new DisplayImageOptions.Builder().cacheInMemory(true)
.showImageOnFail(R.drawable.ic_empty_music2)
.resetViewBeforeLoading(true)
.build());
if (TimberUtils.isLollipop())
itemHolder.albumArt.setTransitionName("transition_album_art" + i);
}
示例15: initImageLoader
import com.nostra13.universalimageloader.core.ImageLoader; //导入依赖的package包/类
/**
* init UIL ImageLoader
*/
public static void initImageLoader(Context context) {
// 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()
.discCacheFileNameGenerator(new Md5FileNameGenerator())
.tasksProcessingOrder(QueueProcessingType.LIFO)
.writeDebugLogs() // Remove for release app
.build();
// Initialize ImageLoader with configuration.
ImageLoader.getInstance().init(config);
}