com.nostra13.universalimageloader.core.decode.BaseImageDecoder Java Examples

The following examples show how to use com.nostra13.universalimageloader.core.decode.BaseImageDecoder. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MainApplication.java    From snowdream-books-android with Apache License 2.0 6 votes vote down vote up
private void initImageLoader(){
        Context context = getApplicationContext();
        File cacheDir = StorageUtils.getCacheDirectory(context);
        ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context)
                .memoryCacheExtraOptions(480, 800) // default = device screen dimensions
                .diskCacheExtraOptions(480, 800, null)
                .threadPriority(Thread.NORM_PRIORITY - 2) // default
                .tasksProcessingOrder(QueueProcessingType.FIFO) // default
                .denyCacheImageMultipleSizesInMemory()
                .memoryCache(new LruMemoryCache(2 * 1024 * 1024))
                .memoryCacheSize(2 * 1024 * 1024)
                .memoryCacheSizePercentage(13) // default
                .diskCache(new UnlimitedDiscCache(cacheDir)) // default
                .diskCacheSize(50 * 1024 * 1024)
                .diskCacheFileCount(100)
                .diskCacheFileNameGenerator(new HashCodeFileNameGenerator()) // default
                .imageDownloader(new BaseImageDownloader(context)) // default
                .imageDecoder(new BaseImageDecoder(false)) // default
                .defaultDisplayImageOptions(DisplayImageOptions.createSimple()) // default
//                .writeDebugLogs()
                .build();

        ImageLoader.getInstance().init(config);
    }
 
Example #2
Source File: UniversalImageLoader.java    From UltimateAndroid with Apache License 2.0 6 votes vote down vote up
public static ImageLoaderConfiguration.Builder getDefaultImageLoaderConfigurationBuilder(Context context) {
        File cacheDir = StorageUtils.getCacheDirectory(context);
        ImageLoaderConfiguration.Builder builder = new ImageLoaderConfiguration.Builder(context)
//                .memoryCacheExtraOptions(480, 800) // default = device screen dimensions
//                .discCacheExtraOptions(480, 800, Bitmap.CompressFormat.JPEG, 75, null)
                .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
                .discCache(new UnlimitedDiscCache(cacheDir)) // default
//                .discCacheSize(50 * 1024 * 1024)
                .discCacheFileCount(1000)
                .discCacheFileNameGenerator(new HashCodeFileNameGenerator()) // default
                .imageDownloader(new BaseImageDownloader(context)) // default
                .imageDecoder(new BaseImageDecoder(false)) // default
                        //   .defaultDisplayImageOptions(DisplayImageOptions.createSimple()) // default
                .defaultDisplayImageOptions(getDefaultImageOptions());
        return builder;
    }
 
Example #3
Source File: UniversalImageLoader.java    From UltimateAndroid with Apache License 2.0 6 votes vote down vote up
/**
     * Get default ImageLoaderConfiguration.Builder,and you can easily change the builder.
     * @param context
     * @return
     */
    public static ImageLoaderConfiguration.Builder getDefaultImageLoaderConfigurationBuilder(Context context) {
        File cacheDir = StorageUtils.getCacheDirectory(context);
        ImageLoaderConfiguration.Builder builder = new ImageLoaderConfiguration.Builder(context)
//                .memoryCacheExtraOptions(480, 800) // default = device screen dimensions
//                .discCacheExtraOptions(480, 800, Bitmap.CompressFormat.JPEG, 75, null)
                .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
                .diskCache(new UnlimitedDiskCache(cacheDir)) // default
//                .discCacheSize(50 * 1024 * 1024)
                .diskCacheFileCount(1000)
                .diskCacheFileNameGenerator(new HashCodeFileNameGenerator()) // default
                .imageDownloader(new BaseImageDownloader(context)) // default
                .imageDecoder(new BaseImageDecoder(false)) // default
                        //   .defaultDisplayImageOptions(DisplayImageOptions.createSimple()) // default
                .defaultDisplayImageOptions(getDefaultImageOptions());
        return builder;
    }
 
Example #4
Source File: MainApplication.java    From android-imageviewer with Apache License 2.0 6 votes vote down vote up
public static void initImageLoader(Context context) {
    File cacheDir = StorageUtils.getCacheDirectory(context);
    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context)
            .memoryCacheExtraOptions(480, 800) // default = device screen dimensions
            .denyCacheImageMultipleSizesInMemory()
            .discCacheExtraOptions(480, 800, Bitmap.CompressFormat.JPEG, 75, null)
            .threadPriority(Thread.NORM_PRIORITY - 2) // default
            .tasksProcessingOrder(QueueProcessingType.FIFO) // default
            .denyCacheImageMultipleSizesInMemory()
            .memoryCache(new LruMemoryCache(2 * 1024 * 1024))
            .memoryCacheSize(2 * 1024 * 1024)
            .memoryCacheSizePercentage(13) // default
            .discCache(new UnlimitedDiscCache(cacheDir)) // default
            .discCacheSize(50 * 1024 * 1024)
            .discCacheFileCount(100)
            .discCacheFileNameGenerator(new HashCodeFileNameGenerator()) // default
            .imageDownloader(new BaseImageDownloader(context)) // default
            .imageDecoder(new BaseImageDecoder(true)) // default
            .defaultDisplayImageOptions(DisplayImageOptions.createSimple()) // default
            .writeDebugLogs()
            .build();

    ImageLoader.getInstance().init(config);
}
 
Example #5
Source File: ImageLoaderUtils.java    From q-municate-android with Apache License 2.0 5 votes vote down vote up
public static ImageLoaderConfiguration getImageLoaderConfiguration(Context context) {
    final int MEMORY_CACHE_LIMIT = 2 * 1024 * 1024;
    final int THREAD_POOL_SIZE = 3;

    ImageLoaderConfiguration imageLoaderConfiguration = new ImageLoaderConfiguration.Builder(context)
            .threadPoolSize(THREAD_POOL_SIZE).threadPriority(Thread.NORM_PRIORITY)
            .denyCacheImageMultipleSizesInMemory()
            .memoryCache(new UsingFreqLimitedMemoryCache(MEMORY_CACHE_LIMIT))
            .defaultDisplayImageOptions(ImageLoaderUtils.UIL_DEFAULT_DISPLAY_OPTIONS)
            .imageDecoder(new SmartUriDecoder(context, new BaseImageDecoder(false)))
            .denyCacheImageMultipleSizesInMemory()
            .discCacheFileNameGenerator(new HashCodeFileNameGeneratorWithoutToken()).build();
    return imageLoaderConfiguration;
}
 
Example #6
Source File: ImageLoaderUtils.java    From q-municate-android with Apache License 2.0 5 votes vote down vote up
public SmartUriDecoder(Context context, BaseImageDecoder imageUriDecoder) {
    if (imageUriDecoder == null) {
        throw new NullPointerException("Image decoder can't be null");
    }

    this.context = new WeakReference(context);
    this.imageUriDecoder = imageUriDecoder;
}
 
Example #7
Source File: DefaultConfigurationFactory.java    From candybar with Apache License 2.0 4 votes vote down vote up
/**
 * Creates default implementation of {@link ImageDecoder} - {@link BaseImageDecoder}
 */
public static ImageDecoder createImageDecoder(boolean loggingEnabled) {
    return new BaseImageDecoder(loggingEnabled);
}
 
Example #8
Source File: DefaultConfigurationFactory.java    From letv with Apache License 2.0 4 votes vote down vote up
public static ImageDecoder createImageDecoder(boolean loggingEnabled) {
    return new BaseImageDecoder(loggingEnabled);
}
 
Example #9
Source File: ThumbnailDecoder.java    From talk-android with MIT License 4 votes vote down vote up
public ThumbnailDecoder(ContentResolver cr, BaseImageDecoder baseDecoder) {
    contentResolver = cr;
    baseImageDecoder = baseDecoder;
}
 
Example #10
Source File: DefaultConfigurationFactory.java    From mobile-manager-tool with MIT License 4 votes vote down vote up
/** Creates default implementation of {@link com.nostra13.universalimageloader.core.decode.ImageDecoder} - {@link com.nostra13.universalimageloader.core.decode.BaseImageDecoder} */
public static ImageDecoder createImageDecoder(boolean loggingEnabled) {
	return new BaseImageDecoder(loggingEnabled);
}
 
Example #11
Source File: DefaultConfigurationFactory.java    From BigApp_WordPress_Android with Apache License 2.0 4 votes vote down vote up
/** Creates default implementation of {@link ImageDecoder} - {@link BaseImageDecoder} */
public static ImageDecoder createImageDecoder(boolean loggingEnabled) {
	return new BaseImageDecoder(loggingEnabled);
}
 
Example #12
Source File: FragmentUser.java    From BigApp_WordPress_Android with Apache License 2.0 4 votes vote down vote up
private void uploadImg() {
    if (mDialogSearching == null) {
        mDialogSearching = new DialogSearching(getActivity());
    }
    mDialogSearching.setContent(R.string.z_toast_modifying);
    mDialogSearching.show();
    new Handler().post(new Runnable() {
                           @Override
                           public void run() {
                               new Thread() {
                                   @Override
                                   public void run() {
                                       Message msg = new Message();
                                       msg.what = 1;
                                       msg.obj = null;
                                       try {
                                           ImageSize imageSize = BaseImageDecoder.getImageSize(mImagePath);
                                           BaseResponse<String> base = new Gson().fromJson((String) FormFile.postDatas(CommonUtils.getImageByteByPath(mImagePath, imageSize),
                                                   imageSize == null ? null : imageSize.getMimeType()), new TypeToken<BaseResponse<String>>() {
                                           }.getType());
                                           msg.obj = base;
                                           if (base.error_code == 0) {
                                               String fileName = new HashCodeFileNameGenerator().generate(base.data);
                                               MediaStoreUtils.copyFile(mImagePath, SdCacheTools.getOwnImageCacheDir(mContext) + "/" + fileName);
                                               File file = new File(mImagePath);
                                               if (!file.exists()) {
                                                   file.delete();
                                               }
                                           }
                                       } catch (Throwable e) {
                                           e.printStackTrace();
                                           msg.obj = null;
                                       }
                                       mHanlder.sendMessage(msg);
                                   }
                               }.start();
                           }
                       }

    );
}
 
Example #13
Source File: DefaultConfigurationFactory.java    From WliveTV with Apache License 2.0 4 votes vote down vote up
/** Creates default implementation of {@link ImageDecoder} - {@link BaseImageDecoder} */
public static ImageDecoder createImageDecoder(boolean loggingEnabled) {
	return new BaseImageDecoder(loggingEnabled);
}
 
Example #14
Source File: DefaultConfigurationFactory.java    From MiBandDecompiled with Apache License 2.0 4 votes vote down vote up
public static ImageDecoder createImageDecoder(boolean flag)
{
    return new BaseImageDecoder(flag);
}
 
Example #15
Source File: DefaultConfigurationFactory.java    From android-open-project-demo with Apache License 2.0 4 votes vote down vote up
/** Creates default implementation of {@link ImageDecoder} - {@link BaseImageDecoder} */
public static ImageDecoder createImageDecoder(boolean loggingEnabled) {
	return new BaseImageDecoder(loggingEnabled);
}
 
Example #16
Source File: DefaultConfigurationFactory.java    From Android-Universal-Image-Loader-Modify with Apache License 2.0 2 votes vote down vote up
/**
 * Creates default implementation of {@link ImageDecoder} - {@link BaseImageDecoder}
 * 创建图片默认的解码器
 */
public static ImageDecoder createImageDecoder(boolean loggingEnabled) {
	return new BaseImageDecoder(loggingEnabled);
}