// Path: sak-nop/src/main/java/com/wanjian/sak/converter/ISizeConverter.java
// public abstract class ISizeConverter {
//     public static ISizeConverter CONVERTER;
// 
//     public abstract String desc();
// 
//     public abstract Size convert(Context context, float length);
// 
//     public abstract int recovery(Context context, float length);
// 
// }
// 
// Path: saklib/src/main/java/com/wanjian/sak/layer/ISize.java
// public interface ISize {
//   void onSizeConvertChange(ISizeConverter converter);
// }
// 
// Path: saklib/src/main/java/com/wanjian/sak/utils/ScreenUtils.java
// public class ScreenUtils {
// 
//   public static int dp2px(Context context, int dip) {
//     float density = context.getResources().getDisplayMetrics().density;
//     return (int) (dip * density + 0.5);
//   }
// 
//   public static int px2dp(Context context, float pxValue) {
//     final float scale = context.getResources().getDisplayMetrics().density;
//     return (int) (pxValue / scale + 0.5f);
//   }
// 
// }


import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect;
import android.view.View;
import android.view.ViewGroup;
import com.wanjian.sak.converter.ISizeConverter;
import com.wanjian.sak.layer.ISize;
import com.wanjian.sak.utils.ScreenUtils;
import java.text.DecimalFormat;
    }
    int childCount = ((ViewGroup) view).getChildCount();
    for (int i = 0; i < childCount; i++) {
      canvas.save();
      drawMargin(canvas, ((ViewGroup) view).getChildAt(i));
      canvas.restore();
    }

  }

  private void drawMargin(Canvas canvas, View view) {
    ViewGroup.LayoutParams params = view.getLayoutParams();
    if (!(params instanceof ViewGroup.MarginLayoutParams)) {
      return;
    }//画 外边距
    int w = view.getWidth();
    int h = view.getHeight();
    ViewGroup.MarginLayoutParams marginLayoutParams = ((ViewGroup.MarginLayoutParams) params);

    canvas.translate(view.getX(), view.getY());

    int l = -marginLayoutParams.leftMargin;
    int t = -marginLayoutParams.topMargin;
    int r = w + marginLayoutParams.rightMargin;
    int b = h + marginLayoutParams.bottomMargin;

    canvas.drawRect(l, 0, 0, h, mMarginPaint);//left
    canvas.drawRect(w, 0, r, h, mMarginPaint);//right
    canvas.drawRect(0, t, w, 0, mMarginPaint);
    canvas.drawRect(0, h, w, b, mMarginPaint);
// Path: sak-nop/src/main/java/com/wanjian/sak/converter/ISizeConverter.java
// public abstract class ISizeConverter {
//     public static ISizeConverter CONVERTER;
// 
//     public abstract String desc();
// 
//     public abstract Size convert(Context context, float length);
// 
//     public abstract int recovery(Context context, float length);
// 
// }
// 
// Path: saklib/src/main/java/com/wanjian/sak/layer/ISize.java
// public interface ISize {
//   void onSizeConvertChange(ISizeConverter converter);
// }
// 
// Path: saklib/src/main/java/com/wanjian/sak/utils/ScreenUtils.java
// public class ScreenUtils {
// 
//   public static int dp2px(Context context, int dip) {
//     float density = context.getResources().getDisplayMetrics().density;
//     return (int) (dip * density + 0.5);
//   }
// 
//   public static int px2dp(Context context, float pxValue) {
//     final float scale = context.getResources().getDisplayMetrics().density;
//     return (int) (pxValue / scale + 0.5f);
//   }
// 
// }


// Path: saklib/src/main/java/com/wanjian/sak/layer/impl/MarginLayer.java
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect;
import android.view.View;
import android.view.ViewGroup;
import com.wanjian.sak.converter.ISizeConverter;
import com.wanjian.sak.layer.ISize;
import com.wanjian.sak.utils.ScreenUtils;
import java.text.DecimalFormat;

    }
    int childCount = ((ViewGroup) view).getChildCount();
    for (int i = 0; i < childCount; i++) {
      canvas.save();
      drawMargin(canvas, ((ViewGroup) view).getChildAt(i));
      canvas.restore();
    }

  }

  private void drawMargin(Canvas canvas, View view) {
    ViewGroup.LayoutParams params = view.getLayoutParams();
    if (!(params instanceof ViewGroup.MarginLayoutParams)) {
      return;
    }//画 外边距
    int w = view.getWidth();
    int h = view.getHeight();
    ViewGroup.MarginLayoutParams marginLayoutParams = ((ViewGroup.MarginLayoutParams) params);

    canvas.translate(view.getX(), view.getY());

    int l = -marginLayoutParams.leftMargin;
    int t = -marginLayoutParams.topMargin;
    int r = w + marginLayoutParams.rightMargin;
    int b = h + marginLayoutParams.bottomMargin;

    canvas.drawRect(l, 0, 0, h, mMarginPaint);//left
    canvas.drawRect(w, 0, r, h, mMarginPaint);//right
    canvas.drawRect(0, t, w, 0, mMarginPaint);
    canvas.drawRect(0, h, w, b, mMarginPaint);
    ISizeConverter converter = getSizeConverter();