// Path: android/app/src/main/java/hack/com/househunt/api/HouseHuntRestClient.java
// public class HouseHuntRestClient {
// 
//     private static final String BASE_URL = "http://54.148.214.208:3000/api/";
// 
//     private static AsyncHttpClient client = new AsyncHttpClient();
// 
//     public static void get(String url, RequestParams params,
//             AsyncHttpResponseHandler responseHandler) {
//         client.get(getAbsoluteUrl(url), params, responseHandler);
//     }
// 
//     public static void post(String url, StringEntity params,
//             AsyncHttpResponseHandler responseHandler) {
//         client.post(null, getAbsoluteUrl(url), params, "application/json", responseHandler);
//     }
// 
//     private static String getAbsoluteUrl(String relativeUrl) {
//         return BASE_URL + relativeUrl;
//     }
// 
// }
// 
// Path: android/app/src/main/java/hack/com/househunt/fragments/RecommendFragment.java
// public class RecommendFragment extends Fragment {
// 
//     public static final String TAG = RecommendFragment.class.getSimpleName();
// 
//     @InjectView(R.id.card_stack) CardContainer mLiveableCards;
//     private CardDataAdapter mAdapter;
// 
//     @Override
//     public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
//         View v = inflater.inflate(R.layout.recommend_frag, container, false);
//         ButterKnife.inject(this, v);
//         List<Liveable> liveables = UserSession.getInstance().getRecommendedLiveables();
//         mAdapter = new CardDataAdapter(getActivity(), R.layout.liveable_card, liveables);
//         mLiveableCards.setAdapter(mAdapter);
// 
//         return v;
//     }
// 
// 
// 
// }


import android.app.Activity;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentTransaction;
import android.util.Log;
import com.loopj.android.http.JsonHttpResponseHandler;
import org.apache.http.Header;
import org.json.JSONException;
import org.json.JSONObject;
import hack.com.househunt.R;
import hack.com.househunt.api.HouseHuntRestClient;
import hack.com.househunt.fragments.RecommendFragment;
package hack.com.househunt.internal;






/**
 * Static helper methods used to reduce redundancy in the application.
 */
public class Util {

    private Util() {

    }

    public static void switchFragments(FragmentActivity a, Fragment newFrag, String tag, boolean replace) {
        FragmentTransaction ft = a.getSupportFragmentManager().beginTransaction().addToBackStack(tag);
        ft.replace(R.id.container, newFrag, tag).commit();
        Log.d(tag, "Switched to " + tag + " fragment");
    }

    public static void getRecommendation(final FragmentActivity a, final boolean switchToRecommend) {
        String userId = UserSession.getInstance().getUserId();
// Path: android/app/src/main/java/hack/com/househunt/api/HouseHuntRestClient.java
// public class HouseHuntRestClient {
// 
//     private static final String BASE_URL = "http://54.148.214.208:3000/api/";
// 
//     private static AsyncHttpClient client = new AsyncHttpClient();
// 
//     public static void get(String url, RequestParams params,
//             AsyncHttpResponseHandler responseHandler) {
//         client.get(getAbsoluteUrl(url), params, responseHandler);
//     }
// 
//     public static void post(String url, StringEntity params,
//             AsyncHttpResponseHandler responseHandler) {
//         client.post(null, getAbsoluteUrl(url), params, "application/json", responseHandler);
//     }
// 
//     private static String getAbsoluteUrl(String relativeUrl) {
//         return BASE_URL + relativeUrl;
//     }
// 
// }
// 
// Path: android/app/src/main/java/hack/com/househunt/fragments/RecommendFragment.java
// public class RecommendFragment extends Fragment {
// 
//     public static final String TAG = RecommendFragment.class.getSimpleName();
// 
//     @InjectView(R.id.card_stack) CardContainer mLiveableCards;
//     private CardDataAdapter mAdapter;
// 
//     @Override
//     public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
//         View v = inflater.inflate(R.layout.recommend_frag, container, false);
//         ButterKnife.inject(this, v);
//         List<Liveable> liveables = UserSession.getInstance().getRecommendedLiveables();
//         mAdapter = new CardDataAdapter(getActivity(), R.layout.liveable_card, liveables);
//         mLiveableCards.setAdapter(mAdapter);
// 
//         return v;
//     }
// 
// 
// 
// }


// Path: android/app/src/main/java/hack/com/househunt/internal/Util.java
import android.app.Activity;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentTransaction;
import android.util.Log;
import com.loopj.android.http.JsonHttpResponseHandler;
import org.apache.http.Header;
import org.json.JSONException;
import org.json.JSONObject;
import hack.com.househunt.R;
import hack.com.househunt.api.HouseHuntRestClient;
import hack.com.househunt.fragments.RecommendFragment;

package hack.com.househunt.internal;






/**
 * Static helper methods used to reduce redundancy in the application.
 */
public class Util {

    private Util() {

    }

    public static void switchFragments(FragmentActivity a, Fragment newFrag, String tag, boolean replace) {
        FragmentTransaction ft = a.getSupportFragmentManager().beginTransaction().addToBackStack(tag);
        ft.replace(R.id.container, newFrag, tag).commit();
        Log.d(tag, "Switched to " + tag + " fragment");
    }

    public static void getRecommendation(final FragmentActivity a, final boolean switchToRecommend) {
        String userId = UserSession.getInstance().getUserId();
        HouseHuntRestClient.get("/rec/" + userId, null, new JsonHttpResponseHandler() {