public SettingsBuilder withCacheDir(File file) { settings.setCacheDir(file); return this; }
public SettingsBuilder withNetworkManager(NetworkManager networkManager) { settings.setNetworkManager(networkManager); return this; }
/** * Change setting of time period before cached images are removed from file storage. * * @param timePeriodInMillis time period in milli seconds * @return this SettingsBuilder */ public SettingsBuilder withExpirationPeriod(long timePeriodInMillis) { settings.setExpirationPeriod(timePeriodInMillis); return this; }
/** * Constructor with all settings set to default values */ public LoaderSettings() { this.setExpirationPeriod(DEFAULT_EXPIRATION_PERIOD); this.setQueryIncludedInHash(DEFAULT_INCLUDE_QUERY_IN_HASH); this.setConnectionTimeout(DEFAULT_CONNECTION_TIMEOUT); this.setReadTimeout(DEFAULT_READ_TIMEOUT); this.setDisconnectOnEveryCall(DEFAULT_DISCONNECT_ON_EVERY_CALL); this.setUseAsyncTasks(DEFAULT_USE_ASYNC_TASKS); this.setAllowUpsampling(DEFAULT_ALLOW_UPSAMPLING); this.setAlwaysUseOriginalSize(DEFAULT_ALWAYS_USE_ORIGINAL_SIZE); }
/** * Normal image manager settings */ private void normalImageManagerSettings() { imageManager = new ImageManager(this, new SettingsBuilder() .withCacheManager(new LruBitmapCache(this)) .build(this)); }
/** * Change flag indicating whether queries of image urls should be used as part of the cache key. * If set to false the cache returns the same image e.g. for <code>http://king.com/img.png?v=1</code> and <code>http://king.com/img.png?v=2</code> * * @param enableQueryInHashGeneration set to false if querys in urls should be ignored. * @return this SettingsBuilder. */ public SettingsBuilder withEnableQueryInHashGeneration(boolean enableQueryInHashGeneration) { settings.setQueryIncludedInHash(enableQueryInHashGeneration); return this; }
/** * Changes flag to enable upsampling for small images. * If true and the image is smaller than the requested size * the image is resized to a larger image. Default is false. * * @param allowUpsampling set to true if you want to enlarge small images * @return this SettingsBuilder */ public SettingsBuilder withUpsampling(boolean allowUpsampling) { settings.setAllowUpsampling(allowUpsampling); return this; }
/** * Changes flag to disable image resizing. * Set the flag to true if you want to avoid bitmap resizing. Default is false. * * @param alwaysUseOriginalSize set to true if you want to avoid bitmap resizing * @return this SettingsBuilder */ public SettingsBuilder withoutResizing(boolean alwaysUseOriginalSize) { settings.setAlwaysUseOriginalSize(alwaysUseOriginalSize); return this; }
public SettingsBuilder addHeader(String key, String value) { settings.addHeader(key, value); return this; }
public SettingsBuilder withConnectionTimeout(int connectionTimeout) { settings.setConnectionTimeout(connectionTimeout); return this; }
public SettingsBuilder withAsyncTasks(boolean useAsyncTasks) { settings.setUseAsyncTasks(useAsyncTasks); return this; }
public SettingsBuilder withFileManager(FileManager fileManager) { settings.setFileManager(fileManager); return this; }
public SettingsBuilder() { settings = new LoaderSettings(); }
public NetworkManager getNetworkManager() { return loaderSettings.getNetworkManager(); }
public SettingsBuilder withReadTimeout(int readTimeout) { settings.setReadTimeout(readTimeout); return this; }
public SettingsBuilder withDisconnectOnEveryCall(boolean disconnectOnEveryCall) { settings.setDisconnectOnEveryCall(disconnectOnEveryCall); return this; }
public SettingsBuilder withCacheManager(CacheManager cacheManager) { settings.setCacheManager(cacheManager); return this; }
public SettingsBuilder withResCacheManager(CacheManager resCacheManager) { settings.setResCacheManager(resCacheManager); return this; }
private void verifyPermissions(Context context) { verifyPermission(context, Manifest.permission.WRITE_EXTERNAL_STORAGE); verifyPermission(context, Manifest.permission.INTERNET); }
private void listenerCallback() { if (onImageLoadedListener != null && onImageLoadedListener.get() != null) { onImageLoadedListener.get().onImageLoaded(imageView); } }