Search in sources :

Example 1 with CutCornerTreatment

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

the class AppBarLayout method setCornerCut.

@Override
public void setCornerCut(float cornerCut) {
    shapeModel = ShapeAppearanceModel.builder().setAllCorners(new CutCornerTreatment(cornerCut)).build();
    setShapeModel(shapeModel);
}
Also used : CutCornerTreatment(com.google.android.material.shape.CutCornerTreatment)

Example 2 with CutCornerTreatment

use of com.google.android.material.shape.CutCornerTreatment 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 CutCornerTreatment

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

the class CoordinatorLayout method setCornerCut.

@Override
public void setCornerCut(float cornerCut) {
    shapeModel = ShapeAppearanceModel.builder().setAllCorners(new CutCornerTreatment(cornerCut)).build();
    setShapeModel(shapeModel);
}
Also used : CutCornerTreatment(com.google.android.material.shape.CutCornerTreatment)

Example 4 with CutCornerTreatment

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

the class EditText method setCornerCut.

@Override
public void setCornerCut(float cornerCut) {
    shapeModel = ShapeAppearanceModel.builder().setAllCorners(new CutCornerTreatment(cornerCut)).build();
    setShapeModel(shapeModel);
}
Also used : CutCornerTreatment(com.google.android.material.shape.CutCornerTreatment)

Example 5 with CutCornerTreatment

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

the class View method setCornerCut.

@Override
public void setCornerCut(float cornerCut) {
    shapeModel = ShapeAppearanceModel.builder().setAllCorners(new CutCornerTreatment(cornerCut)).build();
    setShapeModel(shapeModel);
}
Also used : CutCornerTreatment(com.google.android.material.shape.CutCornerTreatment)

Aggregations

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