// Path: 8 - After EventBus/app/src/main/java/pt/forkit/androidlx_2014/ui/BaseFragment.java
// @SuppressLint("NewApi")
// public class BaseFragment extends Fragment {
// 
//     protected Mp3Api mApi;
// 
//     public BaseFragment() {
//         super();
//     }
// 
//     public void onCreate(Bundle s) {
//         super.onCreate(s);
// 
//         RestAdapter  restAdapter = new RestAdapter.Builder()
//                 .setLogLevel(RestAdapter.LogLevel.FULL)
//                 .setRequestInterceptor(new AuthorizationInterceptor())
//                 .setEndpoint("http://api.soundcloud.com")
//                 .build();
// 
//         mApi = restAdapter.create(Mp3Api.class);
// 
//     }
// 
// }
// 
// Path: 8 - After EventBus/app/src/main/java/pt/forkit/androidlx_2014/ui/adapter/MenuAdapter.java
// public class MenuAdapter extends BaseAdapter {
// 
//     private ArrayList<Menu> mMenus;
//     private Context ctx;
//     private int currentPosition = 0;
//     LayoutInflater inflater;
// 
//     public MenuAdapter(ArrayList<Menu> menus, Context ctx) {
//         this.ctx = ctx;
//         this.mMenus = menus;
//         this.inflater = (LayoutInflater) ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
//     }
// 
//     @Override
//     public int getCount() {
//         return mMenus.size();
//     }
// 
//     @Override
//     public Menu getItem(int i) {
//         return mMenus.get(i);
//     }
// 
//     @Override
//     public long getItemId(int i) {
//         return 0;
//     }
// 
//     @Override
//     public View getView(int i, View view, ViewGroup viewGroup) {
//         ViewHolder holder;
//         if (view != null) {
//             holder = (ViewHolder) view.getTag();
//         } else {
//             view = inflater.inflate(R.layout.list_item_menu, null, false);
//             holder = new ViewHolder(view);
//             view.setTag(holder);
//         }
// 
//         Menu mi = getItem(i);
// 
//         holder.iv_icon.setImageResource(mi.getMenuIconDrawableId());
//         holder.tv_title.setText(mi.getMenuTitle());
// 
//         if(currentPosition == i){
//             holder.tv_title.setTextColor(ctx.getResources().getColor(R.color.light_green));
//         } else {
//             holder.tv_title.setTextColor(ctx.getResources().getColor(R.color.white));
//         }
// 
//         return view;
//     }
// 
//     public void setActive(int position) {
//         currentPosition = position;
//         notifyDataSetChanged();
//     }
// 
//     static class ViewHolder {
//         @InjectView(R.id.iv_icon) ImageView iv_icon;
//         @InjectView(R.id.tv_title) TextView tv_title;
// 
//         public ViewHolder(View view) {
//             ButterKnife.inject(this, view);
//         }
//     }
// }


import android.app.ActionBar;
import android.app.Activity;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v4.app.ActionBarDrawerToggle;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.view.*;
import android.widget.AdapterView;
import android.widget.ListView;
import pt.forkit.androidlx_2014.R;
import pt.forkit.androidlx_2014.ui.BaseFragment;
import pt.forkit.androidlx_2014.ui.adapter.MenuAdapter;
import java.util.ArrayList;
        // Read in the flag indicating whether or not the user has demonstrated awareness of the
        // drawer. See PREF_USER_LEARNED_DRAWER for details.
        SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getActivity());
        mUserLearnedDrawer = sp.getBoolean(PREF_USER_LEARNED_DRAWER, false);

        if (savedInstanceState != null) {
            mCurrentSelectedPosition = savedInstanceState.getInt(STATE_SELECTED_POSITION);
            mFromSavedInstanceState = true;
        }

        // Select either the default item (0) or the last selected item.
        selectItem(mCurrentSelectedPosition);
    }

    @Override
    public void onActivityCreated (Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        // Indicate that this fragment would like to influence the set of actions in the action bar.
        setHasOptionsMenu(true);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        View v = inflater.inflate(
                R.layout.fragment_menu, container, false);
        mLvMenu = (ListView) v.findViewById(R.id.lv_menu);
        ArrayList<pt.forkit.androidlx_2014.domain.Menu> items = new ArrayList<pt.forkit.androidlx_2014.domain.Menu>();
        items.add(new pt.forkit.androidlx_2014.domain.Menu("Search", R.drawable.search));
        items.add(new pt.forkit.androidlx_2014.domain.Menu("My Music", R.drawable.sound));
// Path: 8 - After EventBus/app/src/main/java/pt/forkit/androidlx_2014/ui/BaseFragment.java
// @SuppressLint("NewApi")
// public class BaseFragment extends Fragment {
// 
//     protected Mp3Api mApi;
// 
//     public BaseFragment() {
//         super();
//     }
// 
//     public void onCreate(Bundle s) {
//         super.onCreate(s);
// 
//         RestAdapter  restAdapter = new RestAdapter.Builder()
//                 .setLogLevel(RestAdapter.LogLevel.FULL)
//                 .setRequestInterceptor(new AuthorizationInterceptor())
//                 .setEndpoint("http://api.soundcloud.com")
//                 .build();
// 
//         mApi = restAdapter.create(Mp3Api.class);
// 
//     }
// 
// }
// 
// Path: 8 - After EventBus/app/src/main/java/pt/forkit/androidlx_2014/ui/adapter/MenuAdapter.java
// public class MenuAdapter extends BaseAdapter {
// 
//     private ArrayList<Menu> mMenus;
//     private Context ctx;
//     private int currentPosition = 0;
//     LayoutInflater inflater;
// 
//     public MenuAdapter(ArrayList<Menu> menus, Context ctx) {
//         this.ctx = ctx;
//         this.mMenus = menus;
//         this.inflater = (LayoutInflater) ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
//     }
// 
//     @Override
//     public int getCount() {
//         return mMenus.size();
//     }
// 
//     @Override
//     public Menu getItem(int i) {
//         return mMenus.get(i);
//     }
// 
//     @Override
//     public long getItemId(int i) {
//         return 0;
//     }
// 
//     @Override
//     public View getView(int i, View view, ViewGroup viewGroup) {
//         ViewHolder holder;
//         if (view != null) {
//             holder = (ViewHolder) view.getTag();
//         } else {
//             view = inflater.inflate(R.layout.list_item_menu, null, false);
//             holder = new ViewHolder(view);
//             view.setTag(holder);
//         }
// 
//         Menu mi = getItem(i);
// 
//         holder.iv_icon.setImageResource(mi.getMenuIconDrawableId());
//         holder.tv_title.setText(mi.getMenuTitle());
// 
//         if(currentPosition == i){
//             holder.tv_title.setTextColor(ctx.getResources().getColor(R.color.light_green));
//         } else {
//             holder.tv_title.setTextColor(ctx.getResources().getColor(R.color.white));
//         }
// 
//         return view;
//     }
// 
//     public void setActive(int position) {
//         currentPosition = position;
//         notifyDataSetChanged();
//     }
// 
//     static class ViewHolder {
//         @InjectView(R.id.iv_icon) ImageView iv_icon;
//         @InjectView(R.id.tv_title) TextView tv_title;
// 
//         public ViewHolder(View view) {
//             ButterKnife.inject(this, view);
//         }
//     }
// }


// Path: 0 - And so it begins/app/src/main/java/pt/forkit/androidlx_2014/ui/fragment/NavigationDrawerFragment.java
import android.app.ActionBar;
import android.app.Activity;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v4.app.ActionBarDrawerToggle;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.view.*;
import android.widget.AdapterView;
import android.widget.ListView;
import pt.forkit.androidlx_2014.R;
import pt.forkit.androidlx_2014.ui.BaseFragment;
import pt.forkit.androidlx_2014.ui.adapter.MenuAdapter;
import java.util.ArrayList;

        // Read in the flag indicating whether or not the user has demonstrated awareness of the
        // drawer. See PREF_USER_LEARNED_DRAWER for details.
        SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(getActivity());
        mUserLearnedDrawer = sp.getBoolean(PREF_USER_LEARNED_DRAWER, false);

        if (savedInstanceState != null) {
            mCurrentSelectedPosition = savedInstanceState.getInt(STATE_SELECTED_POSITION);
            mFromSavedInstanceState = true;
        }

        // Select either the default item (0) or the last selected item.
        selectItem(mCurrentSelectedPosition);
    }

    @Override
    public void onActivityCreated (Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        // Indicate that this fragment would like to influence the set of actions in the action bar.
        setHasOptionsMenu(true);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        View v = inflater.inflate(
                R.layout.fragment_menu, container, false);
        mLvMenu = (ListView) v.findViewById(R.id.lv_menu);
        ArrayList<pt.forkit.androidlx_2014.domain.Menu> items = new ArrayList<pt.forkit.androidlx_2014.domain.Menu>();
        items.add(new pt.forkit.androidlx_2014.domain.Menu("Search", R.drawable.search));
        items.add(new pt.forkit.androidlx_2014.domain.Menu("My Music", R.drawable.sound));
        mLvMenu.setAdapter(new MenuAdapter(items, getActivity()));