Search in sources :

Example 1 with RoundedCornerTreatment

use of com.google.android.material.shape.RoundedCornerTreatment in project Carbon by ZieIony.

the class AppBarLayout method setCornerRadius.

/**
 * Sets the corner radius. If corner radius is equal to 0, rounded corners are turned off.
 *
 * @param cornerRadius
 */
@Override
public void setCornerRadius(float cornerRadius) {
    shapeModel = ShapeAppearanceModel.builder().setAllCorners(new RoundedCornerTreatment(cornerRadius)).build();
    setShapeModel(shapeModel);
}
Also used : RoundedCornerTreatment(com.google.android.material.shape.RoundedCornerTreatment)

Example 2 with RoundedCornerTreatment

use of com.google.android.material.shape.RoundedCornerTreatment in project Carbon by ZieIony.

the class Carbon method initCornerCutRadius.

public static void initCornerCutRadius(ShapeModelView shapeModelView, TypedArray a, int[] ids) {
    int carbon_cornerRadiusTopStart = ids[0];
    int carbon_cornerRadiusTopEnd = ids[1];
    int carbon_cornerRadiusBottomStart = ids[2];
    int carbon_cornerRadiusBottomEnd = ids[3];
    int carbon_cornerRadius = ids[4];
    int carbon_cornerCutTopStart = ids[5];
    int carbon_cornerCutTopEnd = ids[6];
    int carbon_cornerCutBottomStart = ids[7];
    int carbon_cornerCutBottomEnd = ids[8];
    int carbon_cornerCut = ids[9];
    float cornerRadius = Math.max(a.getDimension(carbon_cornerRadius, 0), 0.1f);
    float cornerRadiusTopStart = a.getDimension(carbon_cornerRadiusTopStart, cornerRadius);
    float cornerRadiusTopEnd = a.getDimension(carbon_cornerRadiusTopEnd, cornerRadius);
    float cornerRadiusBottomStart = a.getDimension(carbon_cornerRadiusBottomStart, cornerRadius);
    float cornerRadiusBottomEnd = a.getDimension(carbon_cornerRadiusBottomEnd, cornerRadius);
    float cornerCut = a.getDimension(carbon_cornerCut, 0);
    float cornerCutTopStart = a.getDimension(carbon_cornerCutTopStart, cornerCut);
    float cornerCutTopEnd = a.getDimension(carbon_cornerCutTopEnd, cornerCut);
    float cornerCutBottomStart = a.getDimension(carbon_cornerCutBottomStart, cornerCut);
    float cornerCutBottomEnd = a.getDimension(carbon_cornerCutBottomEnd, cornerCut);
    ShapeAppearanceModel model = ShapeAppearanceModel.builder().setTopLeftCorner(cornerCutTopStart >= cornerRadiusTopStart ? new CutCornerTreatment(cornerCutTopStart) : new RoundedCornerTreatment(cornerRadiusTopStart)).setTopRightCorner(cornerCutTopEnd >= cornerRadiusTopEnd ? new CutCornerTreatment(cornerCutTopEnd) : new RoundedCornerTreatment(cornerRadiusTopEnd)).setBottomLeftCorner(cornerCutBottomStart >= cornerRadiusBottomStart ? new CutCornerTreatment(cornerCutBottomStart) : new RoundedCornerTreatment(cornerRadiusBottomStart)).setBottomRightCorner(cornerCutBottomEnd >= cornerRadiusBottomEnd ? new CutCornerTreatment(cornerCutBottomEnd) : new RoundedCornerTreatment(cornerRadiusBottomEnd)).build();
    shapeModelView.setShapeModel(model);
}
Also used : RoundedCornerTreatment(com.google.android.material.shape.RoundedCornerTreatment) CutCornerTreatment(com.google.android.material.shape.CutCornerTreatment) ShapeAppearanceModel(com.google.android.material.shape.ShapeAppearanceModel)

Example 3 with RoundedCornerTreatment

use of com.google.android.material.shape.RoundedCornerTreatment in project Carbon by ZieIony.

the class CollapsingToolbarLayout method setCornerRadius.

/**
 * Sets the corner radius. If corner radius is equal to 0, rounded corners are turned off.
 *
 * @param cornerRadius
 */
@Override
public void setCornerRadius(float cornerRadius) {
    shapeModel = ShapeAppearanceModel.builder().setAllCorners(new RoundedCornerTreatment(cornerRadius)).build();
    setShapeModel(shapeModel);
}
Also used : RoundedCornerTreatment(com.google.android.material.shape.RoundedCornerTreatment)

Example 4 with RoundedCornerTreatment

use of com.google.android.material.shape.RoundedCornerTreatment in project Carbon by ZieIony.

the class CoordinatorLayout method setCornerRadius.

/**
 * Sets the corner radius. If corner radius is equal to 0, rounded corners are turned off.
 *
 * @param cornerRadius
 */
@Override
public void setCornerRadius(float cornerRadius) {
    shapeModel = ShapeAppearanceModel.builder().setAllCorners(new RoundedCornerTreatment(cornerRadius)).build();
    setShapeModel(shapeModel);
}
Also used : RoundedCornerTreatment(com.google.android.material.shape.RoundedCornerTreatment)

Example 5 with RoundedCornerTreatment

use of com.google.android.material.shape.RoundedCornerTreatment in project Carbon by ZieIony.

the class LinearLayout method setCornerRadius.

/**
 * Sets the corner radius. If corner radius is equal to 0, rounded corners are turned off.
 *
 * @param cornerRadius
 */
@Override
public void setCornerRadius(float cornerRadius) {
    shapeModel = ShapeAppearanceModel.builder().setAllCorners(new RoundedCornerTreatment(cornerRadius)).build();
    setShapeModel(shapeModel);
}
Also used : RoundedCornerTreatment(com.google.android.material.shape.RoundedCornerTreatment)

Aggregations

RoundedCornerTreatment (com.google.android.material.shape.RoundedCornerTreatment)19 CutCornerTreatment (com.google.android.material.shape.CutCornerTreatment)1 ShapeAppearanceModel (com.google.android.material.shape.ShapeAppearanceModel)1