本文整理汇总了Java中com.nostra13.universalimageloader.utils.L类的典型用法代码示例。如果您正苦于以下问题:Java L类的具体用法?Java L怎么用?Java L使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
L类属于com.nostra13.universalimageloader.utils包,在下文中一共展示了L类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: tryCacheImageOnDisk
import com.nostra13.universalimageloader.utils.L; //导入依赖的package包/类
/**
* @return <b>true</b> - if image was downloaded successfully; <b>false</b> - otherwise
*/
private boolean tryCacheImageOnDisk() throws TaskCancelledException {
L.d(LOG_CACHE_IMAGE_ON_DISK, memoryCacheKey);
boolean loaded;
try {
loaded = downloadImage();
if (loaded) {
int width = configuration.maxImageWidthForDiskCache;
int height = configuration.maxImageHeightForDiskCache;
if (width > 0 || height > 0) {
L.d(LOG_RESIZE_CACHED_IMAGE_FILE, memoryCacheKey);
resizeAndSaveImage(width, height); // TODO : process boolean result
}
}
} catch (IOException e) {
L.e(e);
loaded = false;
}
return loaded;
}
示例2: copyTestImageToSdCard
import com.nostra13.universalimageloader.utils.L; //导入依赖的package包/类
private void copyTestImageToSdCard(final File testImageOnSdCard) {
new Thread(new Runnable() {
@Override
public void run() {
try {
InputStream is = getAssets().open(TEST_FILE_NAME);
FileOutputStream fos = new FileOutputStream(testImageOnSdCard);
byte[] buffer = new byte[8192];
int read;
try {
while ((read = is.read(buffer)) != -1) {
fos.write(buffer, 0, read);
}
} finally {
fos.flush();
fos.close();
is.close();
}
} catch (IOException e) {
L.w("Can't copy test image onto SD card");
}
}
}).start();
}
示例3: ImageLoaderConfiguration
import com.nostra13.universalimageloader.utils.L; //导入依赖的package包/类
private ImageLoaderConfiguration(final Builder builder) {
resources = builder.context.getResources();
maxImageWidthForMemoryCache = builder.maxImageWidthForMemoryCache;
maxImageHeightForMemoryCache = builder.maxImageHeightForMemoryCache;
maxImageWidthForDiskCache = builder.maxImageWidthForDiskCache;
maxImageHeightForDiskCache = builder.maxImageHeightForDiskCache;
processorForDiskCache = builder.processorForDiskCache;
taskExecutor = builder.taskExecutor;
taskExecutorForCachedImages = builder.taskExecutorForCachedImages;
threadPoolSize = builder.threadPoolSize;
threadPriority = builder.threadPriority;
tasksProcessingType = builder.tasksProcessingType;
diskCache = builder.diskCache;
memoryCache = builder.memoryCache;
defaultDisplayImageOptions = builder.defaultDisplayImageOptions;
downloader = builder.downloader;
decoder = builder.decoder;
customExecutor = builder.customExecutor;
customExecutorForCachedImages = builder.customExecutorForCachedImages;
networkDeniedDownloader = new NetworkDeniedImageDownloader(downloader);
slowNetworkDownloader = new SlowNetworkImageDownloader(downloader);
L.writeDebugLogs(builder.writeLogs);
}
示例4: prepareDecodingOptions
import com.nostra13.universalimageloader.utils.L; //导入依赖的package包/类
protected Options prepareDecodingOptions(ImageSize imageSize, ImageDecodingInfo decodingInfo) {
ImageScaleType scaleType = decodingInfo.getImageScaleType();
int scale;
if (scaleType == ImageScaleType.NONE) {
scale = 1;
} else if (scaleType == ImageScaleType.NONE_SAFE) {
scale = ImageSizeUtils.computeMinImageSampleSize(imageSize);
} else {
ImageSize targetSize = decodingInfo.getTargetSize();
boolean powerOf2 = scaleType == ImageScaleType.IN_SAMPLE_POWER_OF_2;
scale = ImageSizeUtils.computeImageSampleSize(imageSize, targetSize, decodingInfo.getViewScaleType(), powerOf2);
}
if (scale > 1 && loggingEnabled) {
L.d(LOG_SUBSAMPLE_IMAGE, imageSize, imageSize.scaleDown(scale), scale, decodingInfo.getImageKey());
}
Options decodingOptions = decodingInfo.getDecodingOptions();
decodingOptions.inSampleSize = scale;
return decodingOptions;
}
示例5: run
import com.nostra13.universalimageloader.utils.L; //导入依赖的package包/类
public void run() {
if (this.imageAware.isCollected()) {
L.d(LOG_TASK_CANCELLED_IMAGEAWARE_COLLECTED, new Object[]{this.memoryCacheKey});
this.listener.onLoadingCancelled(this.imageUri, this.imageAware.getWrappedView());
} else if (isViewWasReused()) {
L.d(LOG_TASK_CANCELLED_IMAGEAWARE_REUSED, new Object[]{this.memoryCacheKey});
this.listener.onLoadingCancelled(this.imageUri, this.imageAware.getWrappedView());
} else {
L.d(LOG_DISPLAY_IMAGE_IN_IMAGEAWARE, new Object[]{this.loadedFrom, this
.memoryCacheKey});
this.displayer.display(this.bitmap, this.imageAware, this.loadedFrom);
this.engine.cancelDisplayTaskFor(this.imageAware);
this.listener.onLoadingComplete(this.imageUri, this.imageAware.getWrappedView(), this
.bitmap);
}
}
示例6: createDiskCache
import com.nostra13.universalimageloader.utils.L; //导入依赖的package包/类
/**
* Creates default implementation of {@link DiskCache} depends on incoming parameters
*/
public static DiskCache createDiskCache(Context context, FileNameGenerator diskCacheFileNameGenerator,
long diskCacheSize, int diskCacheFileCount) {
File reserveCacheDir = createReserveDiskCacheDir(context);
if (diskCacheSize > 0 || diskCacheFileCount > 0) {
File individualCacheDir = StorageUtils.getIndividualCacheDirectory(context);
try {
return new LruDiskCache(individualCacheDir, reserveCacheDir, diskCacheFileNameGenerator, diskCacheSize,
diskCacheFileCount);
} catch (IOException e) {
L.e(e);
// continue and create unlimited cache
}
}
File cacheDir = StorageUtils.getCacheDirectory(context);
return new UnlimitedDiskCache(cacheDir, reserveCacheDir, diskCacheFileNameGenerator);
}
示例7: resizeAndSaveImage
import com.nostra13.universalimageloader.utils.L; //导入依赖的package包/类
private boolean resizeAndSaveImage(int maxWidth, int maxHeight) throws IOException {
File targetFile = this.configuration.diskCache.get(this.uri);
if (targetFile == null || !targetFile.exists()) {
return false;
}
Bitmap bmp = this.decoder.decode(new ImageDecodingInfo(this.memoryCacheKey, Scheme.FILE
.wrap(targetFile.getAbsolutePath()), this.uri, new ImageSize(maxWidth, maxHeight)
, ViewScaleType.FIT_INSIDE, getDownloader(), new Builder().cloneFrom(this
.options).imageScaleType(ImageScaleType.IN_SAMPLE_INT).build()));
if (!(bmp == null || this.configuration.processorForDiskCache == null)) {
L.d(LOG_PROCESS_IMAGE_BEFORE_CACHE_ON_DISK, this.memoryCacheKey);
bmp = this.configuration.processorForDiskCache.process(bmp);
if (bmp == null) {
L.e(ERROR_PROCESSOR_FOR_DISK_CACHE_NULL, this.memoryCacheKey);
}
}
if (bmp == null) {
return false;
}
boolean saved = this.configuration.diskCache.save(this.uri, bmp);
bmp.recycle();
return saved;
}
示例8: tryCacheImageOnDisk
import com.nostra13.universalimageloader.utils.L; //导入依赖的package包/类
private boolean tryCacheImageOnDisk() throws TaskCancelledException {
L.d(LOG_CACHE_IMAGE_ON_DISK, this.memoryCacheKey);
try {
boolean loaded = downloadImage();
if (!loaded) {
return loaded;
}
int width = this.configuration.maxImageWidthForDiskCache;
int height = this.configuration.maxImageHeightForDiskCache;
if (width <= 0 && height <= 0) {
return loaded;
}
L.d(LOG_RESIZE_CACHED_IMAGE_FILE, this.memoryCacheKey);
resizeAndSaveImage(width, height);
return loaded;
} catch (IOException e) {
L.e(e);
return false;
}
}
示例9: ImageLoaderConfiguration
import com.nostra13.universalimageloader.utils.L; //导入依赖的package包/类
private ImageLoaderConfiguration(Builder builder) {
this.resources = builder.context.getResources();
this.maxImageWidthForMemoryCache = builder.maxImageWidthForMemoryCache;
this.maxImageHeightForMemoryCache = builder.maxImageHeightForMemoryCache;
this.maxImageWidthForDiskCache = builder.maxImageWidthForDiskCache;
this.maxImageHeightForDiskCache = builder.maxImageHeightForDiskCache;
this.processorForDiskCache = builder.processorForDiskCache;
this.taskExecutor = builder.taskExecutor;
this.taskExecutorForCachedImages = builder.taskExecutorForCachedImages;
this.threadPoolSize = builder.threadPoolSize;
this.threadPriority = builder.threadPriority;
this.tasksProcessingType = builder.tasksProcessingType;
this.diskCache = builder.diskCache;
this.memoryCache = builder.memoryCache;
this.defaultDisplayImageOptions = builder.defaultDisplayImageOptions;
this.downloader = builder.downloader;
this.decoder = builder.decoder;
this.thumbnailUtils = builder.thumbnailUtils;
this.customExecutor = builder.customExecutor;
this.customExecutorForCachedImages = builder.customExecutorForCachedImages;
this.networkDeniedDownloader = new NetworkDeniedImageDownloader(this.downloader);
this.slowNetworkDownloader = new SlowNetworkImageDownloader(this.downloader);
L.writeDebugLogs(builder.writeLogs);
}
示例10: decode
import com.nostra13.universalimageloader.utils.L; //导入依赖的package包/类
public Bitmap decode(ImageDecodingInfo decodingInfo) throws IOException {
Bitmap bitmap = null;
InputStream imageStream = getImageStream(decodingInfo);
if (imageStream == null) {
L.e(ERROR_NO_IMAGE_STREAM, decodingInfo.getImageKey());
return bitmap;
}
try {
ImageFileInfo imageInfo = defineImageSizeAndRotation(imageStream, decodingInfo);
imageStream = resetStream(imageStream, decodingInfo);
bitmap = BitmapFactory.decodeStream(imageStream, null, prepareDecodingOptions
(imageInfo.imageSize, decodingInfo));
if (bitmap != null) {
return considerExactScaleAndOrientatiton(bitmap, decodingInfo, imageInfo.exif
.rotation, imageInfo.exif.flipHorizontal);
}
L.e(ERROR_CANT_DECODE_IMAGE, decodingInfo.getImageKey());
return bitmap;
} finally {
IoUtils.closeSilently(imageStream);
}
}
示例11: waitIfPaused
import com.nostra13.universalimageloader.utils.L; //导入依赖的package包/类
private boolean waitIfPaused() {
AtomicBoolean pause = this.engine.getPause();
if (pause.get()) {
synchronized (this.engine.getPauseLock()) {
if (pause.get()) {
L.d(LOG_WAITING_FOR_RESUME, this.memoryCacheKey);
try {
this.engine.getPauseLock().wait();
L.d(LOG_RESUME_AFTER_PAUSE, this.memoryCacheKey);
} catch (InterruptedException e) {
L.e(LOG_TASK_INTERRUPTED, this.memoryCacheKey);
return true;
}
}
}
}
return isTaskNotActual();
}
示例12: prepareDecodingOptions
import com.nostra13.universalimageloader.utils.L; //导入依赖的package包/类
protected Options prepareDecodingOptions(ImageSize imageSize, ImageDecodingInfo decodingInfo) {
int scale;
ImageScaleType scaleType = decodingInfo.getImageScaleType();
if (scaleType == ImageScaleType.NONE) {
scale = 1;
} else if (scaleType == ImageScaleType.NONE_SAFE) {
scale = ImageSizeUtils.computeMinImageSampleSize(imageSize);
} else {
boolean powerOf2;
ImageSize targetSize = decodingInfo.getTargetSize();
if (scaleType == ImageScaleType.IN_SAMPLE_POWER_OF_2) {
powerOf2 = true;
} else {
powerOf2 = false;
}
scale = ImageSizeUtils.computeImageSampleSize(imageSize, targetSize, decodingInfo.getViewScaleType(), powerOf2);
}
if (scale > 1 && this.loggingEnabled) {
L.d(LOG_SUBSAMPLE_IMAGE, imageSize, imageSize.scaleDown(scale), Integer.valueOf(scale), decodingInfo.getImageKey());
}
Options decodingOptions = decodingInfo.getDecodingOptions();
decodingOptions.inSampleSize = scale;
return decodingOptions;
}
示例13: waitIfPaused
import com.nostra13.universalimageloader.utils.L; //导入依赖的package包/类
/**
* @return <b>true</b> - if task should be interrupted; <b>false</b> - otherwise
*/
private boolean waitIfPaused() {
AtomicBoolean pause = engine.getPause();
if (pause.get()) {
synchronized (engine.getPauseLock()) {
if (pause.get()) {
L.d(LOG_WAITING_FOR_RESUME, memoryCacheKey);
try {
engine.getPauseLock().wait();
} catch (InterruptedException e) {
L.e(LOG_TASK_INTERRUPTED, memoryCacheKey);
return true;
}
L.d(LOG_RESUME_AFTER_PAUSE, memoryCacheKey);
}
}
}
return isTaskNotActual();
}
示例14: onCreate
import com.nostra13.universalimageloader.utils.L; //导入依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
mContext = getApplicationContext();
mPlayBackStarter = new PlayBackStarter(mContext);
// Obtain the FirebaseAnalytics instance.
mFirebaseAnalytics = FirebaseAnalytics.getInstance(this);
initImageLoader();
AnalyticsTrackers.initialize(this);
AnalyticsTrackers.getInstance().get(AnalyticsTrackers.Target.APP);
/**
*disable UIL Logs
*/
L.writeDebugLogs(false);
}
示例15: LimitedMemoryCache
import com.nostra13.universalimageloader.utils.L; //导入依赖的package包/类
/** @param sizeLimit Maximum size for cache (in bytes) */
public LimitedMemoryCache(int sizeLimit) {
this.sizeLimit = sizeLimit;
cacheSize = new AtomicInteger();
if (sizeLimit > MAX_NORMAL_CACHE_SIZE) {
L.w("You set too large memory cache size (more than %1$d Mb)", MAX_NORMAL_CACHE_SIZE_IN_MB);
}
}