FileDocCategorySizeDatePackage
CardViewApi21.javaAPI DocAndroid 5.1 API3811Thu Mar 12 22:22:56 GMT 2015android.support.v7.widget

CardViewApi21

public class CardViewApi21 extends Object implements CardViewImpl

Fields Summary
Constructors Summary
Methods Summary
public floatgetElevation(CardViewDelegate cardView)

        return ((View) cardView).getElevation();
    
public floatgetMaxElevation(CardViewDelegate cardView)

        return ((RoundRectDrawable) (cardView.getBackground())).getPadding();
    
public floatgetMinHeight(CardViewDelegate cardView)

        return getRadius(cardView) * 2;
    
public floatgetMinWidth(CardViewDelegate cardView)

        return getRadius(cardView) * 2;
    
public floatgetRadius(CardViewDelegate cardView)

        return ((RoundRectDrawable) (cardView.getBackground())).getRadius();
    
public voidinitStatic()

    
public voidinitialize(CardViewDelegate cardView, android.content.Context context, int backgroundColor, float radius, float elevation, float maxElevation)

        final RoundRectDrawable backgroundDrawable = new RoundRectDrawable(backgroundColor, radius);
        cardView.setBackgroundDrawable(backgroundDrawable);
        View view = (View) cardView;
        view.setClipToOutline(true);
        view.setElevation(elevation);
        setMaxElevation(cardView, maxElevation);
    
public voidonCompatPaddingChanged(CardViewDelegate cardView)

        setMaxElevation(cardView, getMaxElevation(cardView));
    
public voidonPreventCornerOverlapChanged(CardViewDelegate cardView)

        setMaxElevation(cardView, getMaxElevation(cardView));
    
public voidsetBackgroundColor(CardViewDelegate cardView, int color)

        ((RoundRectDrawable) (cardView.getBackground())).setColor(color);
    
public voidsetElevation(CardViewDelegate cardView, float elevation)

        ((View) cardView).setElevation(elevation);
    
public voidsetMaxElevation(CardViewDelegate cardView, float maxElevation)

        ((RoundRectDrawable) (cardView.getBackground())).setPadding(maxElevation,
                cardView.getUseCompatPadding(), cardView.getPreventCornerOverlap());
        updatePadding(cardView);
    
public voidsetRadius(CardViewDelegate cardView, float radius)

        ((RoundRectDrawable) (cardView.getBackground())).setRadius(radius);
    
public voidupdatePadding(CardViewDelegate cardView)

        if (!cardView.getUseCompatPadding()) {
            cardView.setShadowPadding(0, 0, 0, 0);
            return;
        }
        float elevation = getMaxElevation(cardView);
        final float radius = getRadius(cardView);
        int hPadding = (int) Math.ceil(RoundRectDrawableWithShadow
                .calculateHorizontalPadding(elevation, radius, cardView.getPreventCornerOverlap()));
        int vPadding = (int) Math.ceil(RoundRectDrawableWithShadow
                .calculateVerticalPadding(elevation, radius, cardView.getPreventCornerOverlap()));
        cardView.setShadowPadding(hPadding, vPadding, hPadding, vPadding);