use of com.nostra13.universalimageloader.core.DisplayImageOptions in project SeaStar by 13120241790.
the class SealFragment method configImageLoader.
private void configImageLoader() {
// 初始化ImageLoader
DisplayImageOptions options = // 设置图片下载期间显示的图片
new DisplayImageOptions.Builder().showStubImage(drawable.icon_stub).showImageForEmptyUri(// 设置图片Uri为空或是错误的时候显示的图片
drawable.icon_stub).showImageOnFail(// 设置图片加载或解码过程中发生错误显示的图片
drawable.icon_stub).cacheInMemory(// 设置下载的图片是否缓存在内存中
true).cacheOnDisc(// 设置下载的图片是否缓存在SD卡中
true).build();
// 创建配置过得DisplayImageOption对象
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getContext()).defaultDisplayImageOptions(options).threadPriority(Thread.NORM_PRIORITY - 2).denyCacheImageMultipleSizesInMemory().discCacheFileNameGenerator(new Md5FileNameGenerator()).tasksProcessingOrder(QueueProcessingType.LIFO).build();
ImageLoader.getInstance().init(config);
}
use of com.nostra13.universalimageloader.core.DisplayImageOptions in project ABPlayer by winkstu.
the class HomePageFragment 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);
}
use of com.nostra13.universalimageloader.core.DisplayImageOptions in project fresco by facebook.
the class SampleUilFactory method getImageLoader.
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;
}
use of com.nostra13.universalimageloader.core.DisplayImageOptions in project android-ui-design-pattern by MathieuCalba.
the class UIDesignPatternApplication method onCreate.
@Override
public void onCreate() {
super.onCreate();
final DisplayImageOptions defaultDisplayImageOptions = //
new DisplayImageOptions.Builder().cacheInMemory().cacheOnDisc().displayer(//
new FadeInBitmapDisplayer(250)).showImageForEmptyUri(//
R.drawable.ic_launcher).showStubImage(//
R.drawable.ic_launcher).build();
final File cacheDir = StorageUtils.getOwnCacheDirectory(getApplicationContext(), "YANA/ImageCache");
final ImageLoaderConfiguration config = //
new ImageLoaderConfiguration.Builder(getApplicationContext()).defaultDisplayImageOptions(//
defaultDisplayImageOptions).discCache(//
new TotalSizeLimitedDiscCache(cacheDir, new Md5FileNameGenerator(), 10 * 1024 * 1024)).imageDownloader(//
new URLConnectionImageDownloader()).memoryCacheSize(// 2 Mb
2 * 1024 * 1024).tasksProcessingOrder(//
QueueProcessingType.LIFO).threadPoolSize(//
3).threadPriority(//
Thread.NORM_PRIORITY - 2).build();
ImageLoader.getInstance().init(config);
}
use of com.nostra13.universalimageloader.core.DisplayImageOptions in project JamsMusicPlayer by psaravan.
the class StackRemoteViewsFactory method getViewAt.
@Override
public RemoteViews getViewAt(int position) {
RemoteViews rv = new RemoteViews(mContext.getPackageName(), R.layout.large_widget_listview_layout);
if (position <= getCount()) {
try {
if (mApp.getService().getPlaybackIndecesList() != null && mApp.getService().getPlaybackIndecesList().size() != 0) {
if (cursor.getCount() > mApp.getService().getPlaybackIndecesList().get(position)) {
cursor.moveToPosition(mApp.getService().getPlaybackIndecesList().get(position));
} else {
return null;
}
} else {
return null;
}
} catch (Exception e) {
return null;
}
//Set the song title, album, and artist fields.
String songTitle = cursor.getString(cursor.getColumnIndex(DBAccessHelper.SONG_TITLE));
String songAlbumArtPath = cursor.getString(cursor.getColumnIndex(DBAccessHelper.SONG_ALBUM_ART_PATH));
ImageSize imageSize = new ImageSize(100, 100);
//Set the duration of the song.
long songDurationInMillis = 0;
try {
songDurationInMillis = Long.parseLong(cursor.getString(cursor.getColumnIndex(DBAccessHelper.SONG_DURATION)));
} catch (Exception e) {
songDurationInMillis = 0;
}
rv.setTextViewText(R.id.widget_listview_song_name, songTitle);
rv.setTextViewText(R.id.widget_listview_duration, convertMillisToMinsSecs(songDurationInMillis));
if (mWidgetColor.equals("LIGHT")) {
rv.setTextColor(R.id.widget_listview_song_name, Color.BLACK);
rv.setTextColor(R.id.widget_listview_duration, Color.BLACK);
}
Bitmap bitmap = mApp.getImageLoader().loadImageSync(songAlbumArtPath, imageSize, displayImageOptions);
rv.setImageViewBitmap(R.id.widget_listview_thumbnail, bitmap);
}
/* This intent latches itself onto the pendingIntentTemplate from
* LargeWidgetProvider.java and adds the extra "INDEX" argument to it. */
Intent fillInIntent = new Intent();
fillInIntent.putExtra("INDEX", position);
rv.setOnClickFillInIntent(R.id.widget_listview_layout, fillInIntent);
return rv;
}
Aggregations