package com.alsash.reciper.view.fragment;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.alsash.reciper.R;
import com.alsash.reciper.model.CategoryManager;
import com.alsash.reciper.model.models.Category;

import java.util.List;

public class RecipeCategoryFragment extends Fragment {

    // Model
    private List<Category> categories;

    // Views
    private RecyclerView recyclerView;

    public static RecipeListFragment newInstance() {
        Bundle args = new Bundle();
        RecipeListFragment fragment = new RecipeListFragment();
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        bindModel();
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container,
                             @Nullable Bundle savedInstanceState) {
        View layout = inflater.inflate(R.layout.view_list, container, false);
        bindViews(layout);
        setupList();
        return layout;
    }

    private void bindModel() {
        categories = CategoryManager.getInstance().getCategories();
    }

    private void bindViews(View layout) {
        recyclerView = (RecyclerView) layout.findViewById(R.id.list);
    }

    private void setupList() {
//        recyclerView.setLayoutManager(new GridLayoutManager(getActivity(), getResources()
//                .getInteger(R.integer.recipe_list_span)));
//        recyclerView.setAdapter(new RecipeCardAdapter(this, recipes));
//        recyclerView.setItemAnimator(new FlipCardAnimator());
    }
}

@@ -146,16 +146,70 @@
 agment;%0A
+import android.support.v7.widget.LinearLayoutManager;%0A
 import a
@@ -467,16 +467,319 @@
 ategory;
+%0Aimport com.alsash.reciper.model.models.Recipe;%0Aimport com.alsash.reciper.presenter.interaction.RecipeListInteraction;%0Aimport com.alsash.reciper.view.activity.RecipeDetailActivity;%0Aimport com.alsash.reciper.view.adapter.CategoryAdapter;%0Aimport com.alsash.reciper.view.fragment.dialog.RecipeBottomDialog;
 %0A%0Aimport
@@ -794,16 +794,38 @@
 il.List;
+%0Aimport java.util.Map;
 %0A%0Apublic
@@ -871,16 +871,49 @@
 ragment 
+implements RecipeListInteraction 
 %7B%0A%0A    /
@@ -932,20 +932,19 @@
 private 
-List
+Map
 %3CCategor
@@ -948,20 +948,42 @@
 gory
-%3E categories
+, List%3CRecipe%3E%3E categoryRecipesMap
 ;%0A%0A 
@@ -1252,24 +1252,480 @@
 ent;%0A    %7D%0A%0A
+    @Override%0A    public void onExpand(Recipe recipe, int position) %7B%0A        RecipeBottomDialog bottomDialog = RecipeBottomDialog.newInstance(recipe);%0A        bottomDialog.show(getActivity().getSupportFragmentManager(), bottomDialog.getTag());%0A    %7D%0A%0A    @Override%0A    public void onOpen(Recipe recipe, int position) %7B%0A        RecipeDetailActivity.start(getContext(), recipe.getId());%0A        recyclerView.getAdapter().notifyItemChanged(position);%0A    %7D%0A%0A
     @Overrid
@@ -2245,19 +2245,27 @@
  categor
-ies
+yRecipesMap
  = Categ
@@ -2303,11 +2303,19 @@
 egor
-ies
+yRecipesMap
 ();%0A
@@ -2471,18 +2471,16 @@
 ist() %7B%0A
-//
         
@@ -2517,12 +2517,14 @@
 new 
-Grid
+Linear
 Layo
@@ -2550,88 +2550,12 @@
 ty()
-, getResources()%0A//                .getInteger(R.integer.recipe_list_span)
 ));%0A
-//
     
@@ -2590,18 +2590,16 @@
 new 
-RecipeCard
+Category
 Adap
@@ -2612,79 +2612,26 @@
 is, 
-recipes));%0A//        recyclerView.setItemAnimator(new FlipCardAnimator(
+categoryRecipesMap
 ));%0A

Add recipe categories