// Path: app/src/main/java/edu/umn/paull011/evolveworkoutlogger/data_structures/RoutineStats.java
// public class RoutineStats {
// 
//     private HashMap<String, ArrayList<Pair<String, Integer>>> mRoutineData;
//     private HashMap<String, String> mNotes;
//     private SortedDateStringList mSortedDates;
//     private DateFormat mDateFormat;
// 
//     public RoutineStats() {
//         mRoutineData = new HashMap<>(4);
//         mNotes = new HashMap<>(4);
//         mDateFormat = new SimpleDateFormat("MM/dd/yy", Locale.US);
//         mSortedDates = new SortedDateStringList(mDateFormat);
//     }
// 
//     public void add(Date date, String exerciseName, int setCount) {
//         String dateString = mDateFormat.format(date);
//         Pair<String, Integer> exerciseSetCount = new Pair<>(exerciseName, setCount);
//         ArrayList<Pair<String, Integer>> setCountList;
//         if (mRoutineData.containsKey(dateString)) {
//             setCountList = mRoutineData.get(dateString);
//             setCountList.add(exerciseSetCount);
//             mSortedDates.add(date);
//         }
//         else {
//             setCountList = new ArrayList<>(4);
//             setCountList.add(exerciseSetCount);
//             mRoutineData.put(dateString, setCountList);
//             mSortedDates.add(date);
//         }
//     }
// 
//     public void addNote(Date date, String note) {
//         String dateString = mDateFormat.format(date);
//         mNotes.put(dateString, note);
//     }
// 
//     public int getNumDates() {
//         return mRoutineData.size();
//     }
// 
//     public List<Pair<String, Integer>> getExerciseSetCounts(int position) {
//         String dateString = mSortedDates.getDateString(position);
//         return mRoutineData.get(dateString);
//     }
// 
//     public String getNote(int position) {
//         String dateString = mSortedDates.getDateString(position);
//         return mNotes.get(dateString);
//     }
// 
//     public String getDateString(int position) {
//         return mSortedDates.getDateString(position);
//     }
// 
//     public String getLastPerformedDateString() {
//         if (!isEmpty()) {
//             return mSortedDates.getDateString(0);
//         }
//         else {
//             return null;
//         }
//     }
// 
//     public boolean isEmpty(){
//         return mRoutineData.isEmpty();
//     }
// }
// 
// Path: app/src/main/java/edu/umn/paull011/evolveworkoutlogger/fragments/RoutineHistoryFragment.java
// public class RoutineHistoryFragment extends BaseFragment {
// 
//     private OnFragmentInteractionListener mListener;
//     private RoutineStatsDataHolder mDataHolder = RoutineStatsDataHolder.getInstance();
// 
//     private RecyclerView mRecyclerView;
//     private RoutineHistoryAdapter mAdapter;
//     private RecyclerView.LayoutManager mLayoutManager;
// 
//     public RoutineHistoryFragment() {
//         // Required empty public constructor
//     }
// 
//     public static RoutineHistoryFragment newInstance() {
//         return new RoutineHistoryFragment();
//     }
// 
//     @Override
//     public void onCreate(Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
//     }
// 
//     @Override
//     public View onCreateView(LayoutInflater inflater, ViewGroup container,
//                              Bundle savedInstanceState) {
//         // Inflate the layout for this fragment
//         View view = inflater.inflate(R.layout.fragment_routine_history, container, false);
// 
//         mRecyclerView = (RecyclerView) view.findViewById(R.id.recycler_view_routine_history);
//         mLayoutManager = new LinearLayoutManager(getActivity());
//         mRecyclerView.setLayoutManager(mLayoutManager);
// 
//         RoutineStats routineStats = mDataHolder.getRoutineStats();
// 
//         mAdapter = new RoutineHistoryAdapter(mListener, routineStats);
// 
//         mRecyclerView.setAdapter(mAdapter);
// 
//         // Display the empty view if there are no previous exercise sessions
//         TextView emptyView = (TextView) view.findViewById(R.id.empty_view_routine_history);
//         if (routineStats == null || routineStats.isEmpty()) {
//             mRecyclerView.setVisibility(View.GONE);
//             emptyView.setVisibility(View.VISIBLE);
//         } else {
//             mRecyclerView.setVisibility(View.VISIBLE);
//             emptyView.setVisibility(View.GONE);
//         }
// 
//         return view;
//     }
// 
//     @Override
//     public void onAttach(Context context) {
//         super.onAttach(context);
//         if (context instanceof OnFragmentInteractionListener) {
//             mListener = (OnFragmentInteractionListener) context;
//         } else {
//             throw new RuntimeException(context.toString()
//                     + " must implement OnFragmentInteractionListener");
//         }
//     }
// 
//     @Override
//     public void onDetach() {
//         super.onDetach();
//         mListener = null;
//     }
// 
//     public interface OnFragmentInteractionListener {
//         void exerciseSelected(String exerciseName);
//     }
// }


import android.content.Context;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.util.Pair;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import java.util.List;
import edu.umn.paull011.evolveworkoutlogger.R;
import edu.umn.paull011.evolveworkoutlogger.data_structures.RoutineStats;
import edu.umn.paull011.evolveworkoutlogger.fragments.RoutineHistoryFragment;
package edu.umn.paull011.evolveworkoutlogger.helper_classes;




/**
 * Created by Mitchell on 7/19/2016.
 * An adapter that populates the Routine History RecyclerView with cards showing details
 * for each routine session.
 */
public class RoutineHistoryAdapter extends RecyclerView.Adapter<RoutineHistoryAdapter.ViewHolder> {
    public static final String TAG = RoutineHistoryAdapter.class.getSimpleName();
// Path: app/src/main/java/edu/umn/paull011/evolveworkoutlogger/data_structures/RoutineStats.java
// public class RoutineStats {
// 
//     private HashMap<String, ArrayList<Pair<String, Integer>>> mRoutineData;
//     private HashMap<String, String> mNotes;
//     private SortedDateStringList mSortedDates;
//     private DateFormat mDateFormat;
// 
//     public RoutineStats() {
//         mRoutineData = new HashMap<>(4);
//         mNotes = new HashMap<>(4);
//         mDateFormat = new SimpleDateFormat("MM/dd/yy", Locale.US);
//         mSortedDates = new SortedDateStringList(mDateFormat);
//     }
// 
//     public void add(Date date, String exerciseName, int setCount) {
//         String dateString = mDateFormat.format(date);
//         Pair<String, Integer> exerciseSetCount = new Pair<>(exerciseName, setCount);
//         ArrayList<Pair<String, Integer>> setCountList;
//         if (mRoutineData.containsKey(dateString)) {
//             setCountList = mRoutineData.get(dateString);
//             setCountList.add(exerciseSetCount);
//             mSortedDates.add(date);
//         }
//         else {
//             setCountList = new ArrayList<>(4);
//             setCountList.add(exerciseSetCount);
//             mRoutineData.put(dateString, setCountList);
//             mSortedDates.add(date);
//         }
//     }
// 
//     public void addNote(Date date, String note) {
//         String dateString = mDateFormat.format(date);
//         mNotes.put(dateString, note);
//     }
// 
//     public int getNumDates() {
//         return mRoutineData.size();
//     }
// 
//     public List<Pair<String, Integer>> getExerciseSetCounts(int position) {
//         String dateString = mSortedDates.getDateString(position);
//         return mRoutineData.get(dateString);
//     }
// 
//     public String getNote(int position) {
//         String dateString = mSortedDates.getDateString(position);
//         return mNotes.get(dateString);
//     }
// 
//     public String getDateString(int position) {
//         return mSortedDates.getDateString(position);
//     }
// 
//     public String getLastPerformedDateString() {
//         if (!isEmpty()) {
//             return mSortedDates.getDateString(0);
//         }
//         else {
//             return null;
//         }
//     }
// 
//     public boolean isEmpty(){
//         return mRoutineData.isEmpty();
//     }
// }
// 
// Path: app/src/main/java/edu/umn/paull011/evolveworkoutlogger/fragments/RoutineHistoryFragment.java
// public class RoutineHistoryFragment extends BaseFragment {
// 
//     private OnFragmentInteractionListener mListener;
//     private RoutineStatsDataHolder mDataHolder = RoutineStatsDataHolder.getInstance();
// 
//     private RecyclerView mRecyclerView;
//     private RoutineHistoryAdapter mAdapter;
//     private RecyclerView.LayoutManager mLayoutManager;
// 
//     public RoutineHistoryFragment() {
//         // Required empty public constructor
//     }
// 
//     public static RoutineHistoryFragment newInstance() {
//         return new RoutineHistoryFragment();
//     }
// 
//     @Override
//     public void onCreate(Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
//     }
// 
//     @Override
//     public View onCreateView(LayoutInflater inflater, ViewGroup container,
//                              Bundle savedInstanceState) {
//         // Inflate the layout for this fragment
//         View view = inflater.inflate(R.layout.fragment_routine_history, container, false);
// 
//         mRecyclerView = (RecyclerView) view.findViewById(R.id.recycler_view_routine_history);
//         mLayoutManager = new LinearLayoutManager(getActivity());
//         mRecyclerView.setLayoutManager(mLayoutManager);
// 
//         RoutineStats routineStats = mDataHolder.getRoutineStats();
// 
//         mAdapter = new RoutineHistoryAdapter(mListener, routineStats);
// 
//         mRecyclerView.setAdapter(mAdapter);
// 
//         // Display the empty view if there are no previous exercise sessions
//         TextView emptyView = (TextView) view.findViewById(R.id.empty_view_routine_history);
//         if (routineStats == null || routineStats.isEmpty()) {
//             mRecyclerView.setVisibility(View.GONE);
//             emptyView.setVisibility(View.VISIBLE);
//         } else {
//             mRecyclerView.setVisibility(View.VISIBLE);
//             emptyView.setVisibility(View.GONE);
//         }
// 
//         return view;
//     }
// 
//     @Override
//     public void onAttach(Context context) {
//         super.onAttach(context);
//         if (context instanceof OnFragmentInteractionListener) {
//             mListener = (OnFragmentInteractionListener) context;
//         } else {
//             throw new RuntimeException(context.toString()
//                     + " must implement OnFragmentInteractionListener");
//         }
//     }
// 
//     @Override
//     public void onDetach() {
//         super.onDetach();
//         mListener = null;
//     }
// 
//     public interface OnFragmentInteractionListener {
//         void exerciseSelected(String exerciseName);
//     }
// }


// Path: app/src/main/java/edu/umn/paull011/evolveworkoutlogger/helper_classes/RoutineHistoryAdapter.java
import android.content.Context;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.util.Pair;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import java.util.List;
import edu.umn.paull011.evolveworkoutlogger.R;
import edu.umn.paull011.evolveworkoutlogger.data_structures.RoutineStats;
import edu.umn.paull011.evolveworkoutlogger.fragments.RoutineHistoryFragment;

package edu.umn.paull011.evolveworkoutlogger.helper_classes;




/**
 * Created by Mitchell on 7/19/2016.
 * An adapter that populates the Routine History RecyclerView with cards showing details
 * for each routine session.
 */
public class RoutineHistoryAdapter extends RecyclerView.Adapter<RoutineHistoryAdapter.ViewHolder> {
    public static final String TAG = RoutineHistoryAdapter.class.getSimpleName();
    public RoutineHistoryFragment.OnFragmentInteractionListener mListener;