com.nostra13.universalimageloader.core.assist
Enum ViewScaleType

java.lang.Object
  extended by java.lang.Enum<ViewScaleType>
      extended by com.nostra13.universalimageloader.core.assist.ViewScaleType
All Implemented Interfaces:
Serializable, Comparable<ViewScaleType>

public enum ViewScaleType
extends Enum<ViewScaleType>

Simplify ImageView's scale type to 2 types: FIT_INSIDE and CROP

Since:
1.6.1
Author:
Sergey Tarasevich (nostra13[at]gmail[dot]com)

Enum Constant Summary
CROP
          Scale the image uniformly (maintain the image's aspect ratio) so that both dimensions (width and height) of the image will be equal to or larger than the corresponding dimension of the view.
FIT_INSIDE
          Scale the image uniformly (maintain the image's aspect ratio) so that at least one dimension (width or height) of the image will be equal to or less the corresponding dimension of the view.
 
Method Summary
static ViewScaleType fromImageView(android.widget.ImageView imageView)
          Defines scale type of ImageView.
static ViewScaleType valueOf(String name)
          Returns the enum constant of this type with the specified name.
static ViewScaleType[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

FIT_INSIDE

public static final ViewScaleType FIT_INSIDE
Scale the image uniformly (maintain the image's aspect ratio) so that at least one dimension (width or height) of the image will be equal to or less the corresponding dimension of the view.


CROP

public static final ViewScaleType CROP
Scale the image uniformly (maintain the image's aspect ratio) so that both dimensions (width and height) of the image will be equal to or larger than the corresponding dimension of the view.

Method Detail

values

public static ViewScaleType[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (ViewScaleType c : ViewScaleType.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static ViewScaleType valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null

fromImageView

public static ViewScaleType fromImageView(android.widget.ImageView imageView)
Defines scale type of ImageView.

Parameters:
imageView - ImageView
Returns:
FIT_INSIDE for
  • ImageView.ScaleType.FIT_CENTER
  • ImageView.ScaleType.FIT_XY
  • ImageView.ScaleType.FIT_START
  • ImageView.ScaleType.FIT_END
  • ImageView.ScaleType.CENTER_INSIDE
CROP for
  • ImageView.ScaleType.CENTER
  • ImageView.ScaleType.CENTER_CROP
  • ImageView.ScaleType.MATRIX


Copyright © 2011-2014. All Rights Reserved.