// Path: app/src/main/java/com/hitanshudhawan/popcorn/fragments/FavouriteMoviesFragment.java
// public class FavouriteMoviesFragment extends Fragment {
// 
//     private RecyclerView mFavMoviesRecyclerView;
//     private List<MovieBrief> mFavMovies;
//     private MovieBriefsSmallAdapter mFavMoviesAdapter;
// 
//     private LinearLayout mEmptyLayout;
// 
//     @Nullable
//     @Override
//     public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
//         View view = inflater.inflate(R.layout.fragment_favourite_movies, container, false);
// 
//         mFavMoviesRecyclerView = (RecyclerView) view.findViewById(R.id.recycler_view_fav_movies);
//         mFavMovies = new ArrayList<>();
//         mFavMoviesAdapter = new MovieBriefsSmallAdapter(getContext(), mFavMovies);
//         mFavMoviesRecyclerView.setAdapter(mFavMoviesAdapter);
//         mFavMoviesRecyclerView.setLayoutManager(new GridLayoutManager(getContext(), 3));
// 
//         mEmptyLayout = (LinearLayout) view.findViewById(R.id.layout_recycler_view_fav_movies_empty);
// 
//         loadFavMovies();
// 
//         return view;
//     }
// 
//     @Override
//     public void onStart() {
//         super.onStart();
//         // TODO (feature or a bug? :P)
//         // hitanshu : use Room with LiveData to solve this problem
//         // for now when coming back to this activity after removing from fav it shows border heart.
//         mFavMoviesAdapter.notifyDataSetChanged();
//     }
// 
//     private void loadFavMovies() {
//         List<MovieBrief> favMovieBriefs = Favourite.getFavMovieBriefs(getContext());
//         if (favMovieBriefs.isEmpty()) {
//             mEmptyLayout.setVisibility(View.VISIBLE);
//             return;
//         }
// 
//         for (MovieBrief movieBrief : favMovieBriefs) {
//             mFavMovies.add(movieBrief);
//         }
//         mFavMoviesAdapter.notifyDataSetChanged();
//     }
// 
// }
// 
// Path: app/src/main/java/com/hitanshudhawan/popcorn/fragments/FavouriteTVShowsFragment.java
// public class FavouriteTVShowsFragment extends Fragment {
// 
//     private RecyclerView mFavTVShowsRecyclerView;
//     private List<TVShowBrief> mFavTVShows;
//     private TVShowBriefsSmallAdapter mFavTVShowsAdapter;
// 
//     private LinearLayout mEmptyLayout;
// 
//     @Nullable
//     @Override
//     public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
//         View view = inflater.inflate(R.layout.fragment_favourite_tv_shows, container, false);
// 
//         mFavTVShowsRecyclerView = (RecyclerView) view.findViewById(R.id.recycler_view_fav_tv_shows);
//         mFavTVShows = new ArrayList<>();
//         mFavTVShowsAdapter = new TVShowBriefsSmallAdapter(getContext(), mFavTVShows);
//         mFavTVShowsRecyclerView.setAdapter(mFavTVShowsAdapter);
//         mFavTVShowsRecyclerView.setLayoutManager(new GridLayoutManager(getContext(), 3));
// 
//         mEmptyLayout = (LinearLayout) view.findViewById(R.id.layout_recycler_view_fav_tv_shows_empty);
// 
//         loadFavTVShows();
// 
//         return view;
//     }
// 
//     @Override
//     public void onStart() {
//         super.onStart();
//         // TODO (feature or a bug? :P)
//         // hitanshu : use Room with LiveData to solve this problem
//         // for now when coming back to this activity after removing from fav it shows border heart.
//         mFavTVShowsAdapter.notifyDataSetChanged();
//     }
// 
//     private void loadFavTVShows() {
//         List<TVShowBrief> favTVShowBriefs = Favourite.getFavTVShowBriefs(getContext());
//         if (favTVShowBriefs.isEmpty()) {
//             mEmptyLayout.setVisibility(View.VISIBLE);
//             return;
//         }
// 
//         for (TVShowBrief tvShowBrief : favTVShowBriefs) {
//             mFavTVShows.add(tvShowBrief);
//         }
//         mFavTVShowsAdapter.notifyDataSetChanged();
//     }
// 
// }


import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import com.hitanshudhawan.popcorn.R;
import com.hitanshudhawan.popcorn.fragments.FavouriteMoviesFragment;
import com.hitanshudhawan.popcorn.fragments.FavouriteTVShowsFragment;
package com.hitanshudhawan.popcorn.adapters;



/**
 * Created by hitanshu on 10/8/17.
 */

public class FavouritesPagerAdapter extends FragmentPagerAdapter {

    private Context mContext;

    public FavouritesPagerAdapter(FragmentManager fm, Context context) {
        super(fm);
        mContext = context;
    }

    @Override
    public Fragment getItem(int position) {
        switch (position) {
            case 0:
                return new FavouriteMoviesFragment();
            case 1:
// Path: app/src/main/java/com/hitanshudhawan/popcorn/fragments/FavouriteMoviesFragment.java
// public class FavouriteMoviesFragment extends Fragment {
// 
//     private RecyclerView mFavMoviesRecyclerView;
//     private List<MovieBrief> mFavMovies;
//     private MovieBriefsSmallAdapter mFavMoviesAdapter;
// 
//     private LinearLayout mEmptyLayout;
// 
//     @Nullable
//     @Override
//     public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
//         View view = inflater.inflate(R.layout.fragment_favourite_movies, container, false);
// 
//         mFavMoviesRecyclerView = (RecyclerView) view.findViewById(R.id.recycler_view_fav_movies);
//         mFavMovies = new ArrayList<>();
//         mFavMoviesAdapter = new MovieBriefsSmallAdapter(getContext(), mFavMovies);
//         mFavMoviesRecyclerView.setAdapter(mFavMoviesAdapter);
//         mFavMoviesRecyclerView.setLayoutManager(new GridLayoutManager(getContext(), 3));
// 
//         mEmptyLayout = (LinearLayout) view.findViewById(R.id.layout_recycler_view_fav_movies_empty);
// 
//         loadFavMovies();
// 
//         return view;
//     }
// 
//     @Override
//     public void onStart() {
//         super.onStart();
//         // TODO (feature or a bug? :P)
//         // hitanshu : use Room with LiveData to solve this problem
//         // for now when coming back to this activity after removing from fav it shows border heart.
//         mFavMoviesAdapter.notifyDataSetChanged();
//     }
// 
//     private void loadFavMovies() {
//         List<MovieBrief> favMovieBriefs = Favourite.getFavMovieBriefs(getContext());
//         if (favMovieBriefs.isEmpty()) {
//             mEmptyLayout.setVisibility(View.VISIBLE);
//             return;
//         }
// 
//         for (MovieBrief movieBrief : favMovieBriefs) {
//             mFavMovies.add(movieBrief);
//         }
//         mFavMoviesAdapter.notifyDataSetChanged();
//     }
// 
// }
// 
// Path: app/src/main/java/com/hitanshudhawan/popcorn/fragments/FavouriteTVShowsFragment.java
// public class FavouriteTVShowsFragment extends Fragment {
// 
//     private RecyclerView mFavTVShowsRecyclerView;
//     private List<TVShowBrief> mFavTVShows;
//     private TVShowBriefsSmallAdapter mFavTVShowsAdapter;
// 
//     private LinearLayout mEmptyLayout;
// 
//     @Nullable
//     @Override
//     public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
//         View view = inflater.inflate(R.layout.fragment_favourite_tv_shows, container, false);
// 
//         mFavTVShowsRecyclerView = (RecyclerView) view.findViewById(R.id.recycler_view_fav_tv_shows);
//         mFavTVShows = new ArrayList<>();
//         mFavTVShowsAdapter = new TVShowBriefsSmallAdapter(getContext(), mFavTVShows);
//         mFavTVShowsRecyclerView.setAdapter(mFavTVShowsAdapter);
//         mFavTVShowsRecyclerView.setLayoutManager(new GridLayoutManager(getContext(), 3));
// 
//         mEmptyLayout = (LinearLayout) view.findViewById(R.id.layout_recycler_view_fav_tv_shows_empty);
// 
//         loadFavTVShows();
// 
//         return view;
//     }
// 
//     @Override
//     public void onStart() {
//         super.onStart();
//         // TODO (feature or a bug? :P)
//         // hitanshu : use Room with LiveData to solve this problem
//         // for now when coming back to this activity after removing from fav it shows border heart.
//         mFavTVShowsAdapter.notifyDataSetChanged();
//     }
// 
//     private void loadFavTVShows() {
//         List<TVShowBrief> favTVShowBriefs = Favourite.getFavTVShowBriefs(getContext());
//         if (favTVShowBriefs.isEmpty()) {
//             mEmptyLayout.setVisibility(View.VISIBLE);
//             return;
//         }
// 
//         for (TVShowBrief tvShowBrief : favTVShowBriefs) {
//             mFavTVShows.add(tvShowBrief);
//         }
//         mFavTVShowsAdapter.notifyDataSetChanged();
//     }
// 
// }


// Path: app/src/main/java/com/hitanshudhawan/popcorn/adapters/FavouritesPagerAdapter.java
import android.content.Context;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import com.hitanshudhawan.popcorn.R;
import com.hitanshudhawan.popcorn.fragments.FavouriteMoviesFragment;
import com.hitanshudhawan.popcorn.fragments.FavouriteTVShowsFragment;

package com.hitanshudhawan.popcorn.adapters;



/**
 * Created by hitanshu on 10/8/17.
 */

public class FavouritesPagerAdapter extends FragmentPagerAdapter {

    private Context mContext;

    public FavouritesPagerAdapter(FragmentManager fm, Context context) {
        super(fm);
        mContext = context;
    }

    @Override
    public Fragment getItem(int position) {
        switch (position) {
            case 0:
                return new FavouriteMoviesFragment();
            case 1:
                return new FavouriteTVShowsFragment();