本文整理汇总了Java中com.nostra13.universalimageloader.core.ImageLoader.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Java ImageLoader.getInstance方法的具体用法?Java ImageLoader.getInstance怎么用?Java ImageLoader.getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.nostra13.universalimageloader.core.ImageLoader
的用法示例。
在下文中一共展示了ImageLoader.getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initImageLoader
import com.nostra13.universalimageloader.core.ImageLoader; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
private void initImageLoader() {
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(
this)
.memoryCacheExtraOptions(480, 800)
// default = device screen dimensions
.threadPoolSize(3)
// default
.threadPriority(Thread.NORM_PRIORITY - 1)
// default
.tasksProcessingOrder(QueueProcessingType.FIFO)
// default
.denyCacheImageMultipleSizesInMemory()
.memoryCache(new LruMemoryCache(2 * 1024 * 1024))
.memoryCacheSize(2 * 1024 * 1024).memoryCacheSizePercentage(13) // default
.discCacheSize(50 * 1024 * 1024) // 缓冲大小
.discCacheFileCount(100) // 缓冲文件数目
.discCacheFileNameGenerator(new HashCodeFileNameGenerator()) // default
.imageDownloader(new BaseImageDownloader(this)) // default
.defaultDisplayImageOptions(DisplayImageOptions.createSimple()) // default
.writeDebugLogs().build();
// 2.单例ImageLoader类的初始化
ImageLoader imageLoader = ImageLoader.getInstance();
imageLoader.init(config);
}
示例2: 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;
}
示例3: onAfterViews
import com.nostra13.universalimageloader.core.ImageLoader; //导入方法依赖的package包/类
@Override
public void onAfterViews() {
initToolbar();
mContext = this;
mContentResolver = getContentResolver();
mImageLoader = ImageLoader.getInstance();
options = new DisplayImageOptions.Builder()
.showImageOnLoading(R.mipmap.ic_launcher)
.showImageForEmptyUri(R.mipmap.ic_launcher)
.showImageOnFail(R.mipmap.ic_launcher)
.cacheInMemory(false)
.cacheOnDisk(true)
.considerExifParams(true)
.imageScaleType(ImageScaleType.EXACTLY)
.bitmapConfig(Bitmap.Config.RGB_565).build();
initViews();
}
示例4: onBindViewHolder
import com.nostra13.universalimageloader.core.ImageLoader; //导入方法依赖的package包/类
@Override
public void onBindViewHolder(SmingViewHolder holder, int position) {
File file = mSmings.get(position);
long lastModified = file.lastModified();
String name = file.getName();
;
holder.date.setText(new SimpleDateFormat("yy/MM/dd HH:mm").format(new Date(lastModified)));
holder.title.setText(name);
ImageLoader imageLoader = ImageLoader.getInstance();
String path = file.getAbsolutePath();
// DisplayImageOptions.Builder builder = new DisplayImageOptions.Builder();
holder.image.setImageDrawable(null);
imageLoader.displayImage("file://" + path, holder.image);
holder.itemView.setTag(path);
holder.delete.setTag(path);
holder.sticker.setTag(path);
}
示例5: init
import com.nostra13.universalimageloader.core.ImageLoader; //导入方法依赖的package包/类
/**初始化方法
* @must 使用其它方法前必须调用,建议在自定义Application的onCreate方法中调用
* @param context
*/
public static void init(Context context) {
if (context == null) {
Log.e(TAG, "\n\n\n\n\n !!!!!! <<<<<< init context == null >> return; >>>>>>>> \n\n\n\n");
return;
}
imageLoader = ImageLoader.getInstance();
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context)
.defaultDisplayImageOptions(getOption(0))
// .threadPoolSize(5)
// //.threadPriority(Thread.MIN_PRIORITY + 3)
.tasksProcessingOrder(QueueProcessingType.LIFO)
// .discCacheSize((int)(Runtime.getRuntime().maxMemory()/2))
// .discCache(new UnlimitedDiscCache(getCachePath()))
// .memoryCacheSize(2 * 1024 * 1024)
// .memoryCacheExtraOptions(147, 147)
// .writeDebugLogs()
// .httpConnectTimeout(5000)
// .httpReadTimeout(20000)
.diskCacheExtraOptions(ScreenUtil.getScreenWidth(context), ScreenUtil.getScreenHeight(context), null)
.threadPriority(Thread.NORM_PRIORITY - 2)
.denyCacheImageMultipleSizesInMemory()
.diskCacheSize(50 * 1024 * 1024) // 50 Mb
// .displayer(new RoundedBitmapDisplayer(5))
.build();
imageLoader.init(config);
}
示例6: onCreate
import com.nostra13.universalimageloader.core.ImageLoader; //导入方法依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.layout_shopping_cart_activity);
initView();
ImageLoader imageLoader=ImageLoader.getInstance();
imageLoader.init(ImageLoaderConfiguration.createDefault(this));
}
示例7: setProfileImage
import com.nostra13.universalimageloader.core.ImageLoader; //导入方法依赖的package包/类
public static void setProfileImage(String url, ImageView imgView, ImageLoadingListener listener) {
if (url != null) {
if (ImageLoader.getInstance() != null) {
ImageLoader.getInstance().displayImage(url, imgView, Util.displayImageOptions_circluar, listener);
}
}
}
示例8: setURLImage
import com.nostra13.universalimageloader.core.ImageLoader; //导入方法依赖的package包/类
public static void setURLImage(String url, ImageView imgView, ImageLoadingListener listener) {
if (url != null) {
if (ImageLoader.getInstance() != null) {
ImageLoader.getInstance().displayImage(url, imgView, Util.displayImageOptions_original, listener);
}
}
}
示例9: onViewCreated
import com.nostra13.universalimageloader.core.ImageLoader; //导入方法依赖的package包/类
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
this.imageLoader = ImageLoader.getInstance();
this.context = getActivity();
ButterKnife.inject((Object) this, view);
init(this.type);
}
示例10: onCreate
import com.nostra13.universalimageloader.core.ImageLoader; //导入方法依赖的package包/类
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.imageLoader = ImageLoader.getInstance();
if (getArguments() != null) {
this.mImageUrl = getArguments().getString(KEY_IMAGE_URL);
}
}
示例11: initImageLoaderConfig
import com.nostra13.universalimageloader.core.ImageLoader; //导入方法依赖的package包/类
public static void initImageLoaderConfig(Context context) {
try {
File cacheDir = StorageUtils.getOwnCacheDirectory(context, CommonUtil.getSavePath(SysConstant.FILE_SAVE_TYPE_IMAGE));
File reserveCacheDir = StorageUtils.getCacheDirectory(context);
int maxMemory = (int) (Runtime.getRuntime().maxMemory() );
// 使用最大可用内存值的1/8作为缓存的大小。
int cacheSize = maxMemory/8;
DisplayMetrics metrics=new DisplayMetrics();
WindowManager mWm = (WindowManager)context.getSystemService(Context.WINDOW_SERVICE);
mWm.getDefaultDisplay().getMetrics(metrics);
IMImageLoaderConfig = new ImageLoaderConfiguration.Builder(context)
.memoryCacheExtraOptions(metrics.widthPixels, metrics.heightPixels)
.threadPriority(Thread.NORM_PRIORITY-2)
// .denyCacheImageMultipleSizesInMemory()
.memoryCache(new UsingFreqLimitedMemoryCache(cacheSize))
.diskCacheFileNameGenerator(new Md5FileNameGenerator())
.tasksProcessingOrder(QueueProcessingType.LIFO)
.diskCacheExtraOptions(metrics.widthPixels, metrics.heightPixels, null)
.diskCache(new UnlimitedDiscCache(cacheDir,reserveCacheDir,new Md5FileNameGenerator()))
.diskCacheSize(1024 * 1024 * 1024)
.diskCacheFileCount(1000)
.build();
IMImageLoadInstance = ImageLoader.getInstance();
IMImageLoadInstance.init(IMImageLoaderConfig);
}catch (Exception e){
logger.e(e.toString());
}
}
示例12: NineGridImageView
import com.nostra13.universalimageloader.core.ImageLoader; //导入方法依赖的package包/类
public NineGridImageView(Context context, AttributeSet attrs) {
super(context, attrs);
this.PREVIEW_COLORS = new int[]{R.color.dg, R.color.dh, R.color.di, R.color.dj, R.color.dk};
this.context = context;
this.imageLoader = ImageLoader.getInstance();
}
示例13: init
import com.nostra13.universalimageloader.core.ImageLoader; //导入方法依赖的package包/类
private void init() {
this.imageLoader = ImageLoader.getInstance();
initView();
}
示例14: FriendsAdapter
import com.nostra13.universalimageloader.core.ImageLoader; //导入方法依赖的package包/类
public FriendsAdapter(Context context, List<StatusUser> users, String type) {
this.mImageLoader = ImageLoader.getInstance();
this.mContext = context;
this.mUsers = users;
this.type = type;
}
示例15: AppRecommendListAdapter
import com.nostra13.universalimageloader.core.ImageLoader; //导入方法依赖的package包/类
public AppRecommendListAdapter(Context ctx, ArrayList<AppRecommend> apps) {
this.ctx = ctx;
this.apps = apps;
this.imageLoader = ImageLoader.getInstance();
this.option = ImageLoaderOptions.global();
}