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