Methods Summary |
---|
public float | getElevation(CardViewDelegate cardView)
return ((View) cardView).getElevation();
|
public float | getMaxElevation(CardViewDelegate cardView)
return ((RoundRectDrawable) (cardView.getBackground())).getPadding();
|
public float | getMinHeight(CardViewDelegate cardView)
return getRadius(cardView) * 2;
|
public float | getMinWidth(CardViewDelegate cardView)
return getRadius(cardView) * 2;
|
public float | getRadius(CardViewDelegate cardView)
return ((RoundRectDrawable) (cardView.getBackground())).getRadius();
|
public void | initStatic()
|
public void | initialize(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 void | onCompatPaddingChanged(CardViewDelegate cardView)
setMaxElevation(cardView, getMaxElevation(cardView));
|
public void | onPreventCornerOverlapChanged(CardViewDelegate cardView)
setMaxElevation(cardView, getMaxElevation(cardView));
|
public void | setBackgroundColor(CardViewDelegate cardView, int color)
((RoundRectDrawable) (cardView.getBackground())).setColor(color);
|
public void | setElevation(CardViewDelegate cardView, float elevation)
((View) cardView).setElevation(elevation);
|
public void | setMaxElevation(CardViewDelegate cardView, float maxElevation)
((RoundRectDrawable) (cardView.getBackground())).setPadding(maxElevation,
cardView.getUseCompatPadding(), cardView.getPreventCornerOverlap());
updatePadding(cardView);
|
public void | setRadius(CardViewDelegate cardView, float radius)
((RoundRectDrawable) (cardView.getBackground())).setRadius(radius);
|
public void | updatePadding(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);
|