Skip to content

Commit 142b61b

Browse files
author
Henrik
committed
Fix constructor for API versions below 10
1 parent 2e401ba commit 142b61b

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

floatlabelededittext/src/com/wrapp/floatlabelededittext/FloatLabeledEditText.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,25 +25,29 @@ public class FloatLabeledEditText extends LinearLayout {
2525
private EditText editText;
2626

2727
public FloatLabeledEditText(Context context) {
28-
this(context, null);
28+
super(context);
2929
initialize();
3030
}
3131

3232
public FloatLabeledEditText(Context context, AttributeSet attrs) {
33-
this(context, attrs, 0);
33+
super(context, attrs);
34+
setAttributes(attrs);
35+
initialize();
3436
}
3537

3638
public FloatLabeledEditText(Context context, AttributeSet attrs, int defStyle) {
3739
super(context, attrs, defStyle);
38-
40+
setAttributes(attrs);
41+
initialize();
42+
}
43+
44+
private void setAttributes(AttributeSet attrs) {
3945
TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.FloatLabeledEditText);
4046
try {
4147
hint = a.getString(R.styleable.FloatLabeledEditText_floatingHint);
4248
} finally {
4349
a.recycle();
4450
}
45-
46-
initialize();
4751
}
4852

4953
private void initialize() {

0 commit comments

Comments
 (0)