use of com.mikepenz.iconics.Iconics in project Android-Iconics by mikepenz.
the class IconicsFactory method onViewCreatedInternal.
/**
* @param view
* @param context
* @param attrs
*/
void onViewCreatedInternal(View view, final Context context, AttributeSet attrs) {
if (attrs == null) {
return;
}
if (view instanceof ActionMenuItemView) {
final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.Iconics);
String icon = a.getString(R.styleable.Iconics_ico_icon);
if (!TextUtils.isEmpty(icon)) {
((ActionMenuItemView) view).setIcon(getDrawable(context, a, icon));
}
a.recycle();
} else if (view instanceof EditText) {
//handle iconics
new Iconics.IconicsBuilder().ctx(context).on((TextView) view).build();
//for an editText we only style initial as styling the Editable causes problems!
} else if (view instanceof TextView) {
//handle iconics
new Iconics.IconicsBuilder().ctx(context).on((TextView) view).build();
((TextView) view).addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
}
@Override
public void afterTextChanged(Editable editable) {
Iconics.styleEditable(context, editable);
}
});
} else if (view instanceof ImageView) {
final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.Iconics);
String icon = a.getString(R.styleable.Iconics_ico_icon);
if (!TextUtils.isEmpty(icon)) {
((ImageView) view).setImageDrawable(getDrawable(context, a, icon));
}
a.recycle();
}
}
Aggregations