use of com.nostra13.universalimageloader.core.ImageLoaderConfiguration in project howabout-android by recomio.
the class HowaboutApplication method onCreate.
@Override
public void onCreate() {
super.onCreate();
// initialze universal image loader.
DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder().cacheInMemory().cacheOnDisc().build();
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getApplicationContext()).defaultDisplayImageOptions(defaultOptions).build();
ImageLoader.getInstance().init(config);
// saved playlist.
String prefsName = getString(R.string.prefs_name);
SharedPreferences prefs = getSharedPreferences(prefsName, 0);
String trackListJson = prefs.getString("trackListJson", null);
// initialize playlistAdapter to use globally.
if (trackListJson == null) {
playlistAdapter = new MusicPlaylistAdapter(this);
} else {
Gson gson = new Gson();
TrackList trackList = gson.fromJson(trackListJson, TrackList.class);
playlistAdapter = new MusicPlaylistAdapter(this, trackList);
}
MusicPlayerService.setPlaylistAdapter(playlistAdapter);
}
use of com.nostra13.universalimageloader.core.ImageLoaderConfiguration in project QuickAndroid by ImKarl.
the class QAImageLoaderConfig method getConfig.
/**
* 获取加载配置
* @param context
* @param imageOnLoadingRes 加载中显示的图片
* @param imageOnFailRes 加载失败显示的图片
* @return
*/
public static ImageLoaderConfiguration getConfig(Context context, int imageOnLoadingRes, int imageOnFailRes) {
DisplayImageOptions options = new DisplayImageOptions.Builder().showImageOnLoading(// 加载中
imageOnLoadingRes).showImageForEmptyUri(// 图片Uri为空或是错误的时候显示的图片
imageOnFailRes).showImageOnFail(// resource or drawable
imageOnFailRes).resetViewBeforeLoading(// default
false).delayBeforeLoading(// 加载前延迟时长
50).cacheInMemory(// default = false 是否使用内存缓存
true).cacheOnDisk(// default = false 是否使用文件缓存
true).considerExifParams(// default = false
false).imageScaleType(// default
ImageScaleType.IN_SAMPLE_POWER_OF_2).bitmapConfig(// default
Bitmap.Config.ARGB_8888).displayer(// default = new SimpleBitmapDisplayer()
new FadeInBitmapDisplayer(100)).build();
File cacheDir = new File(QAFileManager.getUsableDir(context.getPackageName()));
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context).threadPoolSize(// default 线程池大小
3).threadPriority(// default 线程优先级
Thread.NORM_PRIORITY - 2).denyCacheImageMultipleSizesInMemory().memoryCache(// 内存缓存
new LruMemoryCache(8 * 1024 * 1024)).diskCache(// default 磁盘缓存
new UnlimitedDiskCache(cacheDir)).diskCacheSize(// 磁盘缓存大小
30 * 1024 * 1024).diskCacheFileNameGenerator(// default 磁盘缓存文件名
new HashCodeFileNameGenerator()).imageDownloader(// default 图片下载器
new BaseImageDownloader(context)).imageDecoder(// default 图片解码器
new BaseImageDecoder(QACore.isDebug())).defaultDisplayImageOptions(// default=DisplayImageOptions.createSimple() 图片显示选项
options).build();
return config;
}
use of com.nostra13.universalimageloader.core.ImageLoaderConfiguration in project YourAppIdea by Michenux.
the class YourApplication method onCreate.
@Override
public void onCreate() {
super.onCreate();
this.injectSelf();
// Enable tutorial sync
this.tutorialSyncHelper.createTutorialAccount(this);
// Initialize Universal Image Loader
// Create global configuration and initialize ImageLoader with this configuration
DisplayImageOptions options = new DisplayImageOptions.Builder().cacheInMemory(// default
true).cacheOnDisk(// default
true).displayer(// default SimpleBitmapDisplayer,RoundedBitmapDisplayer(10),FadeInBitmapDisplayer
new FadeInBitmapDisplayer(5000)).build();
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getApplicationContext()).memoryCache(new LruMemoryCache(2 * 1024 * 1024)).memoryCacheSizePercentage(// default
13).defaultDisplayImageOptions(// default
options).build();
ImageLoader.getInstance().init(config);
}
use of com.nostra13.universalimageloader.core.ImageLoaderConfiguration in project ApertureGallery by MJonesDev.
the class ApertureBasing method onCreate.
@Override
public void onCreate() {
super.onCreate();
applicationContext = getApplicationContext();
applicationHandler = new Handler(applicationContext.getMainLooper());
checkDisplaySize();
density = ApertureBasing.applicationContext.getResources().getDisplayMetrics().density;
DisplayImageOptions defaultDisplayImageOptions = //
new DisplayImageOptions.Builder().considerExifParams(true).resetViewBeforeLoading(true).showImageOnLoading(R.drawable.nophotos).showImageOnFail(R.drawable.nophotos).delayBeforeLoading(0).build();
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getApplicationContext()).defaultDisplayImageOptions(defaultDisplayImageOptions).memoryCacheExtraOptions(480, 800).threadPoolSize(5).build();
ImageLoader.getInstance().init(config);
}
use of com.nostra13.universalimageloader.core.ImageLoaderConfiguration in project ABPlayer by winkstu.
the class HomePageFragment2 method initImageLoader.
private void initImageLoader() {
File cacheDir = com.nostra13.universalimageloader.utils.StorageUtils.getOwnCacheDirectory(this.getActivity().getApplicationContext(), IMAGE_CACHE_PATH);
DisplayImageOptions defaultOptions = new DisplayImageOptions.Builder().cacheInMemory(true).cacheOnDisc(true).build();
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this.getActivity()).defaultDisplayImageOptions(defaultOptions).memoryCache(new LruMemoryCache(12 * 1024 * 1024)).memoryCacheSize(12 * 1024 * 1024).discCacheSize(32 * 1024 * 1024).discCacheFileCount(100).discCache(new UnlimitedDiscCache(cacheDir)).threadPriority(Thread.NORM_PRIORITY - 2).tasksProcessingOrder(QueueProcessingType.LIFO).build();
ImageLoader.getInstance().init(config);
}
Aggregations