package com.casic.dcms.utils;

import android.graphics.Rect;
import android.view.View;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

public class ItemDecorationSpace extends RecyclerView.ItemDecoration {
    @Override
    public void getItemOffsets(@NonNull Rect outRect, @NonNull View view, @NonNull RecyclerView parent, @NonNull RecyclerView.State state) {
        if (parent.getChildAdapterPosition(view) % 2 == 0) {
            outRect.left = 0;
            outRect.right = 5;
        } else if (parent.getChildAdapterPosition(view) % 2 == 1) {
            outRect.left = 5;
            outRect.right = 0;
        }
    }
}
