use of carbon.drawable.DefaultAccentColorStateList in project Carbon by ZieIony.
the class FloatingActionButton method initFloatingActionButton.
private void initFloatingActionButton(AttributeSet attrs, int defStyleAttr) {
AnimUtils.setupElevationAnimator(getStateAnimator(), this);
TypedArray a = getContext().obtainStyledAttributes(attrs, R.styleable.FloatingActionButton, defStyleAttr, R.style.carbon_FloatingActionButton);
setCornerRadius(a.getDimension(R.styleable.FloatingActionButton_carbon_cornerRadius, -1));
if (a.hasValue(R.styleable.FloatingActionButton_carbon_menu)) {
int resId = a.getResourceId(R.styleable.FloatingActionButton_carbon_menu, 0);
if (resId != 0)
setMenu(resId);
}
TypedValue bg = new TypedValue();
a.getValue(R.styleable.FloatingActionButton_android_background, bg);
if (bg.type >= TypedValue.TYPE_FIRST_COLOR_INT && bg.type <= TypedValue.TYPE_LAST_COLOR_INT && bg.data == 0)
setBackgroundDrawable(new ColorStateListDrawable(AnimatedColorStateList.fromList(new DefaultAccentColorStateList(getContext()), animation -> postInvalidate())));
a.recycle();
}
Aggregations