use of carbon.drawable.CheckableDrawable in project Carbon by ZieIony.
the class CheckBox method initCheckBox.
public void initCheckBox(AttributeSet attrs, int defStyleAttr) {
CheckableDrawable d = new CheckableDrawable(getContext(), R.raw.carbon_checkbox_checked, R.raw.carbon_checkbox_unchecked, R.raw.carbon_checkbox_filled, new PointF(-0.09f, 0.11f));
setButtonDrawable(d);
TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.CheckBox, defStyleAttr, R.style.carbon_CheckBox);
for (int i = 0; i < a.getIndexCount(); i++) {
int attr = a.getIndex(i);
if (attr == R.styleable.CheckBox_android_drawablePadding) {
drawablePadding = a.getDimension(attr, 0);
} else if (attr == R.styleable.RadioButton_android_checked) {
setCheckedImmediate(a.getBoolean(attr, false));
}
}
Carbon.initHtmlText(this, a, R.styleable.CheckBox_carbon_htmlText);
a.recycle();
}
use of carbon.drawable.CheckableDrawable in project Carbon by ZieIony.
the class RadioButton method initRadioButton.
public void initRadioButton(AttributeSet attrs, int defStyleAttr) {
CheckableDrawable d = new CheckableDrawable(getContext(), R.raw.carbon_radiobutton_checked, R.raw.carbon_radiobutton_unchecked, R.raw.carbon_radiobutton_filled, new PointF(0, 0));
setButtonDrawable(d);
TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.RadioButton, defStyleAttr, R.style.carbon_RadioButton);
for (int i = 0; i < a.getIndexCount(); i++) {
int attr = a.getIndex(i);
if (attr == R.styleable.RadioButton_android_drawablePadding) {
drawablePadding = a.getDimension(attr, 0);
} else if (attr == R.styleable.RadioButton_android_checked) {
setCheckedImmediate(a.getBoolean(attr, false));
}
}
Carbon.initHtmlText(this, a, R.styleable.RadioButton_carbon_htmlText);
a.recycle();
}
use of carbon.drawable.CheckableDrawable in project Carbon by ZieIony.
the class CheckedTextView method initCheckedTextView.
public void initCheckedTextView(AttributeSet attrs, int defStyleAttr) {
CheckableDrawable d = new CheckableDrawable(getContext(), R.raw.carbon_checkbox_checked, R.raw.carbon_checkbox_unchecked, R.raw.carbon_checkbox_filled, new PointF(-0.09f, 0.11f));
setButtonDrawable(d);
TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.CheckedTextView, defStyleAttr, R.style.carbon_CheckedTextView);
for (int i = 0; i < a.getIndexCount(); i++) {
int attr = a.getIndex(i);
if (attr == R.styleable.CheckedTextView_android_drawablePadding) {
drawablePadding = a.getDimension(attr, 0);
} else if (attr == R.styleable.RadioButton_android_checked) {
setCheckedImmediate(a.getBoolean(attr, false));
}
}
Carbon.initHtmlText(this, a, R.styleable.CheckedTextView_carbon_htmlText);
a.recycle();
}
Aggregations