Skip to content
This repository has been archived by the owner on Jan 27, 2023. It is now read-only.

Commit

Permalink
default scaletype to FIT_CENTER and never null, fixes #27
Browse files Browse the repository at this point in the history
  • Loading branch information
vinc3m1 committed Jan 12, 2014
1 parent f8c95e1 commit 0672a6a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 2 additions & 2 deletions roundedimageview/src/com/makeramen/RoundedDrawable.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class RoundedDrawable extends Drawable {
private boolean mOval = false;
private float mBorderWidth = 0;
private ColorStateList mBorderColor = ColorStateList.valueOf(DEFAULT_BORDER_COLOR);
private ScaleType mScaleType = ScaleType.FIT_XY;
private ScaleType mScaleType = ScaleType.FIT_CENTER;

public RoundedDrawable(Bitmap bitmap) {

Expand Down Expand Up @@ -336,7 +336,7 @@ public ScaleType getScaleType() {

public RoundedDrawable setScaleType(ScaleType scaleType) {
if (scaleType == null) {
scaleType = ScaleType.FIT_XY;
scaleType = ScaleType.FIT_CENTER;
}
if (mScaleType != scaleType) {
mScaleType = scaleType;
Expand Down
3 changes: 3 additions & 0 deletions roundedimageview/src/com/makeramen/RoundedImageView.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ public RoundedImageView(Context context, AttributeSet attrs, int defStyle) {
int index = a.getInt(R.styleable.RoundedImageView_android_scaleType, -1);
if (index >= 0) {
setScaleType(sScaleTypeArray[index]);
} else {
// default scaletype to FIT_CENTER
setScaleType(ScaleType.FIT_CENTER);
}

mCornerRadius = a.getDimensionPixelSize(R.styleable.RoundedImageView_corner_radius, -1);
Expand Down

0 comments on commit 0672a6a

Please # to comment.