@@ -0,0 +1,2187 @@
+package com.example.profbola.bakingtime.utils;%0A%0Aimport android.content.Context;%0Aimport android.support.v7.widget.RecyclerView;%0Aimport android.view.LayoutInflater;%0Aimport android.view.View;%0Aimport android.view.ViewGroup;%0Aimport android.widget.TextView;%0A%0Aimport com.example.profbola.bakingtime.R;%0Aimport com.example.profbola.bakingtime.models.Ingredient;%0A%0A/**%0A * Created by prof.BOLA on 7/2/2017.%0A */%0A%0Apublic class IngredientAdapter extends RecyclerView.Adapter%3CIngredientAdapter.IngredientViewHolder%3E %7B%0A%0A    private Context mContext;%0A    private Ingredient%5B%5D mIngredients;%0A%0A    public IngredientAdapter(Context context, Ingredient%5B%5D ingredients) %7B%0A        mContext = context;%0A        mIngredients = ingredients;%0A    %7D%0A%0A    @Override%0A    public IngredientViewHolder onCreateViewHolder(ViewGroup parent, int viewType) %7B%0A        View view = LayoutInflater.from(mContext)%0A                .inflate(R.layout.ingredient, parent, false);%0A%0A        return new IngredientViewHolder(view);%0A    %7D%0A%0A    @Override%0A    public void onBindViewHolder(IngredientViewHolder holder, int position) %7B%0A        Ingredient ingredient = mIngredients%5Bposition%5D;%0A        holder.bind(ingredient);%0A    %7D%0A%0A    @Override%0A    public int getItemCount() %7B%0A        if (null == mIngredients) return 0;%0A        return mIngredients.length;%0A    %7D%0A%0A    public class IngredientViewHolder extends RecyclerView.ViewHolder %7B%0A%0A        public final TextView name;%0A        public final TextView quantity;%0A        public final TextView measure;%0A%0A        public IngredientViewHolder(View itemView) %7B%0A            super(itemView);%0A%0A            name = (TextView) itemView.findViewById(R.id.ingredient_name);%0A            quantity = (TextView) itemView.findViewById(R.id.ingredient_quantity);%0A            measure = (TextView) itemView.findViewById(R.id.ingredient_measure);%0A        %7D%0A%0A        void bind(Ingredient ingredient) %7B%0A            name.setText(ingredient.ingredient);%0A            quantity.setText(String.valueOf(ingredient.quantity));%0A            measure.setText(ingredient.measure);%0A        %7D%0A    %7D%0A%0A    public void swapIngredients(Ingredient%5B%5D ingredients) %7B%0A        mIngredients = ingredients;%0A        notifyDataSetChanged();%0A    %7D%0A%7D

Add IngredientAdapter