Android Open Source - SIC Image Settings






From Project

Back to project page SIC.

License

The source code is released under:

MIT License

If you think the Android project SIC listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.sun.imageloader.core;
//from w w w  .  ja va  2 s .co m

import java.net.URI;
import android.graphics.Bitmap;
import android.graphics.Bitmap.CompressFormat;
import android.graphics.Bitmap.Config;
import android.widget.ImageView;

import com.sun.imageloader.core.api.Settings;

public class ImageSettings  extends Settings{



  private final ImageView _imageView;
  private final int _width;
  private final int _height;
  private final boolean  _shouldUseSampleSizeFromImageKey;

  /**
   * Used to keep references to the {@link URI} and {@link ImageView} that will be used to display and retrieve {@link Bitmap} for
   * images
   * 
   * @param url_
   * @param imageView_
   * @param imageKey_
   */
  public ImageSettings( URI url_, ImageView imageView_, ImageKey imageKey_, CompressFormat compressformat_, 
      Config bitmapConfig_, int imageQuality_, int width_, int height_, boolean shouldUseSampleSizeFromImageKey_){
    super(url_, imageView_, imageKey_, compressformat_, bitmapConfig_, imageQuality_);
    _imageView = imageView_;
    _width = width_;
    _height = height_;
    _shouldUseSampleSizeFromImageKey = shouldUseSampleSizeFromImageKey_;
  }
  
  /**
   * Used to keep references to the {@link URI} and {@link ImageView} that will be used to display and retrieve {@link Bitmap} for
   * images
   * 
   * @param url_
   * @param imageView_
   * @param imageKey_
   */
  public ImageSettings( URI url_, ImageView imageView_, ImageKey imageKey_, CompressFormat compressformat_, 
      Config bitmapConfig_, int imageQuality_, int width_, int height_){
    super(url_, imageView_, imageKey_, compressformat_, bitmapConfig_, imageQuality_);
    _imageView = imageView_;
    _width = width_;
    _height = height_;
    _shouldUseSampleSizeFromImageKey = true;
  }
  
  /**
   * Used to keep references to the {@link URI} and {@link ImageView} that will be used to display and retrieve {@link Bitmap} for
   * images
   * 
   * @param url_
   * @param imageView_
   * @param imageKey_
   */
  public ImageSettings( URI url_, ImageView imageView_, ImageKey imageKey_, CompressFormat compressformat_, 
      Config bitmapConfig_, int imageQuality_){
    super(url_, imageView_, imageKey_, compressformat_, bitmapConfig_, imageQuality_);
    _imageView = imageView_;
    _width = 0;
    _height = 0;
    _shouldUseSampleSizeFromImageKey = true;
  }
  
  public ImageView getImageView() {
    return  _imageView;
  }

  public int getDestWidth() {
    return _width;
  }

  public int getDestHeight() {
    return _height;
  }
  
  public boolean shouldUseSampleSizeFromImageKey() {
    return _shouldUseSampleSizeFromImageKey;
  }
  
  @Override
  public int hashCode() {
    final int prime = 31;
    int result = 1;
    result = prime * result + _height;
    result = prime * result
        + ((_imageView == null) ? 0 : _imageView.hashCode());
    result = prime * result
        + (_shouldUseSampleSizeFromImageKey ? 1231 : 1237);
    result = prime * result + _width;
    return result;
  }

  @Override
  public boolean equals(Object obj) {
    if (this == obj)
      return true;
    if (obj == null)
      return false;
    if (getClass() != obj.getClass())
      return false;
    ImageSettings other = (ImageSettings) obj;
    if (_height != other._height)
      return false;
    if (_imageView == null) {
      if (other._imageView != null)
        return false;
    } else if (!_imageView.equals(other._imageView))
      return false;
    if (_shouldUseSampleSizeFromImageKey != other._shouldUseSampleSizeFromImageKey)
      return false;
    if (_width != other._width)
      return false;
    return true;
  }
  
}




Java Source Code List

com.sun.imageloader.cache.api.MemoryCache.java
com.sun.imageloader.cache.impl.DiskCache.java
com.sun.imageloader.cache.impl.ImageFileFilter.java
com.sun.imageloader.cache.impl.LRUCache.java
com.sun.imageloader.cache.impl.SoftCache.java
com.sun.imageloader.computable.impl.ComputableImage.java
com.sun.imageloader.computable.impl.Computable.java
com.sun.imageloader.concurrent.ComputableCallable.java
com.sun.imageloader.concurrent.DisplayImageTask.java
com.sun.imageloader.concurrent.ImageLoaderTask.java
com.sun.imageloader.core.FlingLock.java
com.sun.imageloader.core.ImageKey.java
com.sun.imageloader.core.ImagePreferences.java
com.sun.imageloader.core.ImageSettings.java
com.sun.imageloader.core.ImageWriter.java
com.sun.imageloader.core.SimpleImageListenerImpl.java
com.sun.imageloader.core.UrlImageLoaderConfiguration.java
com.sun.imageloader.core.UrlImageLoader.java
com.sun.imageloader.core.UrlImageTaskExecutor.java
com.sun.imageloader.core.api.FailedTaskReason.java
com.sun.imageloader.core.api.ImageFailListenter.java
com.sun.imageloader.core.api.ImageTaskListener.java
com.sun.imageloader.core.api.Settings.java
com.sun.imageloader.downloader.api.ImageRetriever.java
com.sun.imageloader.downloader.impl.ImageDownloader.java
com.sun.imageloader.downloader.impl.ImageRetrieverFactory.java
com.sun.imageloader.downloader.impl.Scheme.java
com.sun.imageloader.imagedecoder.api.ImageDecoder.java
com.sun.imageloader.imagedecoder.impl.SimpleImageDecoder.java
com.sun.imageloader.memorizer.api.AMemorizer.java
com.sun.imageloader.memorizer.api.BitmapMemorizer.java
com.sun.imageloader.memorizer.api.IMemorizer.java
com.sun.imageloader.memorizer.api.InterruptedImageLoadException.java
com.sun.imageloader.utils.KeyUtils.java
com.sun.imageloader.utils.L.java
com.sun.imageloader.utils.ViewUtils.java