Constructors Summary |
---|
public Size(int width, int height)Constructor.
val = new Point(width, height);
|
public Size(Size other)Copy constructor.
if (other == null) {
val = new Point(0, 0);
} else {
val = new Point(other.width(), other.height());
}
|
public Size(Camera.Size other)Constructor from a source {@link android.hardware.Camera.Size}.
if (other == null) {
val = new Point(0, 0);
} else {
val = new Point(other.width, other.height);
}
|
public Size(android.util.Size other)Constructor from a source {@link android.util.Size}.
if (other == null) {
val = new Point(0, 0);
} else {
val = new Point(other.getWidth(), other.getHeight());
}
|
public Size(android.graphics.Point p)Constructor from a source {@link android.graphics.Point}.
if (p == null) {
val = new Point(0, 0);
} else {
val = new Point(p);
}
|
Methods Summary |
---|
public static java.util.List | buildListFromAndroidSizes(java.util.List androidSizes)A helper method to build a list of this class from a list of {@link android.util.Size}.
ArrayList<Size> list = new ArrayList<Size>(androidSizes.size());
for (android.util.Size androidSize : androidSizes) {
list.add(new Size(androidSize));
}
return list;
|
public static java.util.List | buildListFromCameraSizes(java.util.List cameraSizes)An helper method to build a list of this class from a list of
{@link android.hardware.Camera.Size}.
ArrayList<Size> list = new ArrayList<Size>(cameraSizes.size());
for (Camera.Size cameraSize : cameraSizes) {
list.add(new Size(cameraSize));
}
return list;
|
public boolean | equals(java.lang.Object o)
if (o instanceof Size) {
Size other = (Size) o;
return val.equals(other.val);
}
return false;
|
public int | hashCode()
return val.hashCode();
|
public int | height()
return val.y;
|
public static java.lang.String | listToString(java.util.List sizes)Encode List of this class as comma-separated list of integers.
ArrayList<Integer> flatSizes = new ArrayList<>();
for (Size s : sizes) {
flatSizes.add(s.width());
flatSizes.add(s.height());
}
return TextUtils.join(DELIMITER, flatSizes);
|
public static java.util.List | stringToList(java.lang.String encodedSizes)Decode comma-separated even-length list of integers into a List of this class.
String[] flatSizes = TextUtils.split(encodedSizes, DELIMITER);
ArrayList<Size> list = new ArrayList<>();
for (int i = 0; i < flatSizes.length; i += 2) {
int width = Integer.parseInt(flatSizes[i]);
int height = Integer.parseInt(flatSizes[i + 1]);
list.add(new Size(width,height));
}
return list;
|
public java.lang.String | toString()
return "Size: (" + this.width() + " x " + this.height() + ")";
|
public int | width()
return val.x;
|