TrevorPage/TPSVG_Android_SVG_Library — pull request #14 by farfromrefug (2013-09-22 11:09:09+00:00)
Title: full rewrite to support scaleType

I needed scaleType to work with an imageView. That pr does that.
Here is a simple example on how to use it
```
imageView = new ImageView(context) {
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
Drawable drawable = imageView.getDrawable();

if (!(drawable instanceof SVGDrawable)) {
return;
}
imageView.setImageDrawable(null);
int vWidth = getWidth() - getPaddingLeft() - getPaddingRight();
int vHeight = getHeight() - getPaddingTop() - getPaddingBottom();
((SVGDrawable)drawable).adjustToParentSize(vWidth, vHeight);
imageView.setImageDrawable(drawable);
}

@Override
public void setScaleType (ScaleType scaleType) {
super.setScaleType(scaleType);
Drawable drawable = getDrawable();

if (!(drawable instanceof SVGDrawable)) {
return;
}
setImageDrawable(null);
((SVGDrawable)drawable).setScaleType(scaleType);
int vWidth = getWidth() - getPaddingLeft() - getPaddingRight();
int vHeight = getHeight() - getPaddingTop() - getPaddingBottom();
((SVGDrawable)drawable).adjustToParentSize(vWidth, vHeight);
setImageDrawable(drawable);
}

@Override
public void setImageDrawable(Drawable drawable) {
if (!(drawable instanceof SVGDrawable)) {
super.setImageDrawable(drawable);
return;
}
if (getDrawable() == drawable) {
return;
}
SVGDrawable svg = (SVGDrawable) drawable;
svg.setScaleType(getScaleType());
int vWidth = getWidth() - getPaddingLeft() - getPaddingRight();
int vHeight = getHeight() - getPaddingTop()
- getPaddingBottom();
svg.adjustToParentSize(vWidth, vHeight);
super.setImageDrawable(svg);
}
};
```