public class BitmapImageSizing
{
- public final float scale;
+ private final float scale;
- public final int width;
+ private final int width;
- public final int height;
+ private final int height;
- public BitmapImageSizing(float scale, int width, int height)
+ private boolean isDefault = false;
+
+ public BitmapImageSizing(float scale, int width, int height,
+ boolean isDefault)
{
this.scale = scale;
this.width = width;
this.height = height;
+ this.isDefault = isDefault;
}
public boolean isNull()
public static BitmapImageSizing nullBitmapImageSizing()
{
- return new BitmapImageSizing(0.0f, 0, 0);
+ return new BitmapImageSizing(0.0f, 0, 0, false);
}
public static final String BITMAP_SCALE = "BITMAP_SCALE";
*/
public static BitmapImageSizing defaultBitmapImageSizing()
{
+ return new BitmapImageSizing(0f, 0, 0, true);
+ }
+
+ private float defaultScale()
+ {
+ return Cache.getDefault(BITMAP_SCALE, 0f);
+ }
+
+ private int defaultWidth()
+ {
+ return Cache.getDefault(BITMAP_WIDTH, 0);
+ }
+
+ private int defaultHeight()
+ {
+ return Cache.getDefault(BITMAP_HEIGHT, 0);
+ }
+
+ public float scale()
+ {
+ return isDefault() ? defaultScale() : scale;
+ }
+
+ public int width()
+ {
+ return isDefault() ? defaultWidth() : width;
+ }
- return new BitmapImageSizing(Cache.getDefault(BITMAP_SCALE, 0) / 10f,
- Cache.getDefault(BITMAP_WIDTH, 0),
- Cache.getDefault(BITMAP_HEIGHT, 0));
+ public int height()
+ {
+ return isDefault() ? defaultHeight() : height;
+ }
+ public boolean isDefault()
+ {
+ return isDefault;
}
}