Skip to content

Commit

Permalink
Merge pull request hdodenhof#15 from mutahirqureshi/non-xml-init
Browse files Browse the repository at this point in the history
properly initialize in CircleImageView(Context) constructor
  • Loading branch information
hdodenhof committed Aug 11, 2014
2 parents 2102794 + e8428bf commit a22cab2
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ public class CircleImageView extends ImageView {

public CircleImageView(Context context) {
super(context);

init();
}

public CircleImageView(Context context, AttributeSet attrs) {
Expand All @@ -57,7 +59,6 @@ public CircleImageView(Context context, AttributeSet attrs) {

public CircleImageView(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
super.setScaleType(SCALE_TYPE);

TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CircleImageView, defStyle, 0);

Expand All @@ -66,6 +67,11 @@ public CircleImageView(Context context, AttributeSet attrs, int defStyle) {

a.recycle();

init();
}

private void init() {
super.setScaleType(SCALE_TYPE);
mReady = true;

if (mSetupPending) {
Expand Down

0 comments on commit a22cab2

Please sign in to comment.