package com.genius.groupie.example.item;

import android.support.annotation.ColorRes;

import com.genius.groupie.Item;
import com.genius.groupie.example.databinding.ItemCardBinding;

import java.util.HashMap;
import java.util.Map;

import static com.genius.groupie.example.MainActivity.INSET;
import static com.genius.groupie.example.MainActivity.INSET_TYPE_KEY;

public class CardItem extends Item<ItemCardBinding> {

    @ColorRes private int colorRes;
    private CharSequence text;

    public CardItem(@ColorRes int colorRes) {
        this(colorRes, "");
    }

    public CardItem(@ColorRes int colorRes, CharSequence text) {
        this.colorRes = colorRes;
        this.text = text;
    }

    @Override public int getLayout() {
        return com.genius.groupie.example.R.layout.item_card;
    }

    @Override public void bind(ItemCardBinding viewBinding, int position) {
        //viewBinding.getRoot().setBackgroundResource(colorRes);
        viewBinding.text.setText(text);
    }

    public void setText(CharSequence text) {
        this.text = text;
    }

    @Override public Map<String, Object> getExtras() {
        Map<String, Object> map = new HashMap<>();
        map.put(INSET_TYPE_KEY, INSET);
        return map;
    }
}

@@ -112,16 +112,64 @@
 e.Item;%0A
+import com.genius.groupie.example.MainActivity;%0A
 import c
@@ -331,83 +331,9 @@
 ity.
-INSET;%0Aimport static com.genius.groupie.example.MainActivity.INSET_TYPE_KEY
+*
 ;%0A%0Ap

Undo formatting