use of com.nostra13.universalimageloader.core.DisplayImageOptions.Builder in project UltimateAndroid by cymcsg.
the class UniversalImageLoader method getDefaultImageLoaderConfiguration.
public static ImageLoaderConfiguration getDefaultImageLoaderConfiguration(Context context, boolean isWriteLog) {
ImageLoaderConfiguration.Builder builder = getDefaultImageLoaderConfigurationBuilder(context);
if (isWriteLog) {
builder.writeDebugLogs();
}
ImageLoaderConfiguration config = builder.build();
return config;
}
use of com.nostra13.universalimageloader.core.DisplayImageOptions.Builder in project UltimateAndroid by cymcsg.
the class UniversalImageLoader method getDefaultImageLoaderConfigurationBuilder.
public static ImageLoaderConfiguration.Builder getDefaultImageLoaderConfigurationBuilder(Context context) {
File cacheDir = StorageUtils.getCacheDirectory(context);
ImageLoaderConfiguration.Builder builder = new ImageLoaderConfiguration.Builder(context).threadPoolSize(// default
3).threadPriority(// default
Thread.NORM_PRIORITY - 1).tasksProcessingOrder(// default
QueueProcessingType.FIFO).denyCacheImageMultipleSizesInMemory().memoryCacheSizePercentage(// default
13).discCache(// default
new UnlimitedDiscCache(cacheDir)).discCacheFileCount(1000).discCacheFileNameGenerator(// default
new HashCodeFileNameGenerator()).imageDownloader(// default
new BaseImageDownloader(context)).imageDecoder(// default
new BaseImageDecoder(false)).defaultDisplayImageOptions(getDefaultImageOptions());
return builder;
}
use of com.nostra13.universalimageloader.core.DisplayImageOptions.Builder in project Memento-Calendar by alexstyl.
the class UILImageLoader method load.
@NonNull
@Override
public Request load(@NonNull final URI imagePath) {
final DisplayImageOptions.Builder builder = standardBuilder();
return new Request() {
@Override
public void into(@NonNull ImageView imageView) {
uil.displayImage(imagePath.toString(), imageView, builder.build());
}
@NonNull
@Override
public Request asCircle() {
builder.displayer(defaultCircleDisplayer);
return this;
}
@NonNull
@Override
public FixedSizeRequest withSize(@Px final int width, @Px final int height) {
builder.displayer(DefaultConfigurationFactory.createBitmapDisplayer());
return new FixedSizeRequest() {
@NonNull
@Override
public Optional<Bitmap> synchronously() {
Bitmap bitmap = uil.loadImageSync(imagePath.toString(), new ImageSize(width, height), builder.build());
if (bitmap == null) {
return Optional.Companion.absent();
} else {
return new Optional<>(bitmap);
}
}
@Override
public void into(@NonNull final ImageLoadedConsumer consumer) {
builder.displayer(DefaultConfigurationFactory.createBitmapDisplayer());
uil.loadImage(imagePath.toString(), builder.build(), new SimpleImageLoadingListener() {
@Override
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
consumer.onImageLoaded(loadedImage);
}
@Override
public void onLoadingFailed(String imageUri, View view, FailReason failReason) {
consumer.onLoadingFailed();
}
});
}
};
}
};
}
use of com.nostra13.universalimageloader.core.DisplayImageOptions.Builder in project LibreraReader by foobnix.
the class IMG method init.
public static void init(Context context) {
IMG.context = context;
bookBGWithMark = context.getResources().getDrawable(R.drawable.bookeffect2);
bookBGNoMark = context.getResources().getDrawable(R.drawable.bookeffect1);
final Builder builder = new DisplayImageOptions.Builder();
builder.cacheInMemory(true);
builder.cacheOnDisk(true);
builder.showImageOnLoading(COLOR_DRAWABLE);
builder.showImageOnFail(COLOR_DRAWABLE);
builder.showImageForEmptyUri(COLOR_DRAWABLE);
builder.bitmapConfig(BMP_CFG);
builder.imageScaleType(ImageScaleType.NONE);
builder.resetViewBeforeLoading(RESET_VIEW_BEFORE_LOADING);
builder.considerExifParams(false);
builder.decodingOptions(new Options());
final ImageLoaderConfiguration config = //
new ImageLoaderConfiguration.Builder(context).threadPoolSize(//
1).threadPriority(//
Thread.NORM_PRIORITY).defaultDisplayImageOptions(//
builder.build()).diskCache(//
new UnlimitedDiskCache(new File(context.getExternalCacheDir(), "Images-1"))).imageDownloader(//
ImageExtractor.getInstance(context)).build();
ImageLoader.getInstance().init(config);
}
use of com.nostra13.universalimageloader.core.DisplayImageOptions.Builder in project Timber by naman14.
the class AlbumDetailFragment method setAlbumart.
private void setAlbumart() {
ImageUtils.loadAlbumArtIntoView(album.id, albumArt, new ImageLoadingListener() {
@Override
public void onLoadingStarted(String imageUri, View view) {
}
@Override
public void onLoadingFailed(String imageUri, View view, FailReason failReason) {
loadFailed = true;
MaterialDrawableBuilder builder = MaterialDrawableBuilder.with(context).setIcon(MaterialDrawableBuilder.IconValue.SHUFFLE).setColor(TimberUtils.getBlackWhiteColor(Config.accentColor(context, Helpers.getATEKey(context))));
ATEUtils.setFabBackgroundTint(fab, Config.accentColor(context, Helpers.getATEKey(context)));
fab.setImageDrawable(builder.build());
}
@Override
public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage) {
try {
new Palette.Builder(loadedImage).generate(new Palette.PaletteAsyncListener() {
@Override
public void onGenerated(Palette palette) {
Palette.Swatch swatch = palette.getVibrantSwatch();
if (swatch != null) {
primaryColor = swatch.getRgb();
collapsingToolbarLayout.setContentScrimColor(primaryColor);
if (getActivity() != null)
ATEUtils.setStatusBarColor(getActivity(), Helpers.getATEKey(getActivity()), primaryColor);
} else {
Palette.Swatch swatchMuted = palette.getMutedSwatch();
if (swatchMuted != null) {
primaryColor = swatchMuted.getRgb();
collapsingToolbarLayout.setContentScrimColor(primaryColor);
if (getActivity() != null)
ATEUtils.setStatusBarColor(getActivity(), Helpers.getATEKey(getActivity()), primaryColor);
}
}
if (getActivity() != null) {
MaterialDrawableBuilder builder = MaterialDrawableBuilder.with(getActivity()).setIcon(MaterialDrawableBuilder.IconValue.SHUFFLE).setSizeDp(30);
if (primaryColor != -1) {
builder.setColor(TimberUtils.getBlackWhiteColor(primaryColor));
ATEUtils.setFabBackgroundTint(fab, primaryColor);
fab.setImageDrawable(builder.build());
} else {
if (context != null) {
ATEUtils.setFabBackgroundTint(fab, Config.accentColor(context, Helpers.getATEKey(context)));
builder.setColor(TimberUtils.getBlackWhiteColor(Config.accentColor(context, Helpers.getATEKey(context))));
fab.setImageDrawable(builder.build());
}
}
}
}
});
} catch (Exception ignored) {
}
}
@Override
public void onLoadingCancelled(String imageUri, View view) {
}
});
}
Aggregations