Search in sources :

Example 1 with StateAnimatorView

use of carbon.view.StateAnimatorView in project Carbon by ZieIony.

the class Carbon method initElevation.

public static void initElevation(ShadowView view, TypedArray a, int[] ids) {
    int carbon_elevation = ids[0];
    int carbon_shadowColor = ids[1];
    int carbon_ambientShadowColor = ids[2];
    int carbon_spotShadowColor = ids[3];
    float elevation = a.getDimension(carbon_elevation, 0);
    view.setElevation(elevation);
    if (elevation > 0)
        AnimUtils.setupElevationAnimator(((StateAnimatorView) view).getStateAnimator(), view);
    ColorStateList shadowColor = a.getColorStateList(carbon_shadowColor);
    view.setElevationShadowColor(shadowColor != null ? shadowColor.withAlpha(255) : null);
    if (a.hasValue(carbon_ambientShadowColor)) {
        ColorStateList ambientShadowColor = a.getColorStateList(carbon_ambientShadowColor);
        view.setOutlineAmbientShadowColor(ambientShadowColor != null ? ambientShadowColor.withAlpha(255) : null);
    }
    if (a.hasValue(carbon_spotShadowColor)) {
        ColorStateList spotShadowColor = a.getColorStateList(carbon_spotShadowColor);
        view.setOutlineSpotShadowColor(spotShadowColor != null ? spotShadowColor.withAlpha(255) : null);
    }
}
Also used : ColorStateList(android.content.res.ColorStateList) AnimatedColorStateList(carbon.animation.AnimatedColorStateList) StateAnimatorView(carbon.view.StateAnimatorView)

Aggregations

ColorStateList (android.content.res.ColorStateList)1 AnimatedColorStateList (carbon.animation.AnimatedColorStateList)1 StateAnimatorView (carbon.view.StateAnimatorView)1