package io.fabianterhorst.fastlayout.converters;

import io.fabianterhorst.fastlayout.annotations.Converter;

@Converter
public class CardViewLayoutConverter extends LayoutConverter {
    @Override
    public LayoutAttribute onConvertLayoutAttribute(String attributeStartValue, String attributeValue, String attributeName, boolean isString) {
        switch (attributeName) {
            case "app:cardCornerRadius":
                return new LayoutAttribute(setter("Radius", attributeValue, false));
            case "app:cardMaxElevation":
                return new LayoutAttribute(setter("MaxCardElevation", attributeValue, false));
            case "app:cardUseCompatPadding":
                return new LayoutAttribute(setter("UseCompatPadding", attributeValue, false));
            case "app:cardPreventCornerOverlap":
                return new LayoutAttribute(setter("PreventCornerOverlap", attributeValue, false));
        }
        return null;
    }
}

@@ -43,16 +43,68 @@
 rters;%0A%0A
+import java.util.ArrayList;%0Aimport java.util.List;%0A%0A
 import i
@@ -229,16 +229,110 @@
 erter %7B%0A
+%0A    private Object padding%5B%5D = new Object%5B%5D%7Bnull, null, null, null%7D;//left,top,right,bottom%0A%0A
     @Ove
@@ -1077,29 +1077,1591 @@
     
-%7D%0A        return null
+    case %22app:contentPaddingLeft%22:%0A                padding = new Object%5B%5D%7BattributeValue, padding%5B1%5D, padding%5B2%5D, padding%5B3%5D%7D;%0A                return new LayoutAttribute();%0A            case %22app:contentPaddingTop%22:%0A                padding = new Object%5B%5D%7Bpadding%5B0%5D, attributeValue, padding%5B2%5D, padding%5B3%5D%7D;%0A                return new LayoutAttribute();%0A            case %22app:contentPaddingRight%22:%0A                padding = new Object%5B%5D%7Bpadding%5B0%5D, padding%5B1%5D, attributeValue, padding%5B3%5D%7D;%0A                return new LayoutAttribute();%0A            case %22app:contentPaddingBottom%22:%0A                padding = new Object%5B%5D%7Bpadding%5B0%5D, padding%5B1%5D, padding%5B2%5D, attributeValue%7D;%0A                return new LayoutAttribute();%0A            case %22app:contentPadding%22:%0A                padding = new Object%5B%5D%7BattributeValue, attributeValue, attributeValue, attributeValue%7D;%0A                return new LayoutAttribute();%0A        %7D%0A        return null;%0A    %7D%0A%0A    @Override%0A    public List%3CLayoutAttribute%3E onFinish() %7B%0A        List%3CLayoutAttribute%3E finished = new ArrayList%3C%3E();%0A        if (padding%5B0%5D != null %7C%7C padding%5B1%5D != null %7C%7C padding%5B2%5D != null %7C%7C padding%5B3%5D != null) %7B%0A            for (int i = 0; i %3C padding.length; i++) %7B%0A                Object current = padding%5Bi%5D;%0A                if (current == null) %7B%0A                    padding%5Bi%5D = 0;%0A                %7D%0A            %7D%0A            finished.add(new LayoutAttribute(LayoutAttribute.Type.LAYOUT, setter(%22ContentPadding%22, padding%5B0%5D + %22,%22 + padding%5B1%5D + %22,%22 + padding%5B2%5D + %22,%22 + padding%5B3%5D, false)));%0A        %7D%0A        return finished
 ;%0A  

add contentPadding support to card view converter