// Path: app/src/main/java/com/github/jvanhie/discogsscrobbler/adapters/NavDrawerListAdapter.java
// public class NavDrawerListAdapter extends BaseAdapter {
// 
//     private Context mContext;
//     private ArrayList<NavDrawerItem> navDrawerItems;
// 
//     public NavDrawerListAdapter(Context context){
//         this.mContext = context;
//         this.navDrawerItems = new ArrayList<NavDrawerItem>();
//     }
// 
//     public void addItem(String title, int icon) {
//         navDrawerItems.add(new NavDrawerItem(title,icon));
//     }
// 
//     @Override
//     public int getCount() {
//         return navDrawerItems.size();
//     }
// 
//     @Override
//     public Object getItem(int position) {
//         return navDrawerItems.get(position);
//     }
// 
//     @Override
//     public long getItemId(int position) {
//         return position;
//     }
// 
//     @SuppressLint("InflateParams")
//     @Override
//     public View getView(int position, View convertView, ViewGroup parent) {
//         if (convertView == null) {
//             if(mContext == null) return null;
//             LayoutInflater mInflater = (LayoutInflater)
//                     mContext.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
//             convertView = mInflater.inflate(R.layout.drawer_list_item, null);
//         }
// 
//         ImageView imgIcon = (ImageView) convertView.findViewById(R.id.icon);
//         TextView txtTitle = (TextView) convertView.findViewById(R.id.title);
// 
//         imgIcon.setImageResource(navDrawerItems.get(position).icon);
//         txtTitle.setText(navDrawerItems.get(position).title);
// 
//         return convertView;
//     }
// 
//     private class NavDrawerItem {
//         public String title;
//         public int icon;
// 
//         public NavDrawerItem(){}
// 
//         public NavDrawerItem(String title, int icon){
//             this.title = title;
//             this.icon = icon;
//         }
// 
//     }
// 
// }


import com.github.jvanhie.discogsscrobbler.adapters.NavDrawerListAdapter;
import android.content.Intent;
import android.content.res.Configuration;
import android.content.res.TypedArray;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.ActionBarDrawerToggle;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarActivity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
/*
 * Copyright (c) 2014 Jono Vanhie-Van Gerwen
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.github.jvanhie.discogsscrobbler;



/**
 * Created by Jono on 01/04/2014.
 */
public abstract class DrawerActivity extends ActionBarActivity {

    private CharSequence mDrawerTitle;
    private CharSequence mTitle;
    private DrawerLayout mDrawerLayout;
    private ListView mDrawerList;
    private ActionBarDrawerToggle mDrawerToggle;

    public void setDrawer(int layout, int list, String title, String drawerTitle, boolean showDrawerIcon) {
        mTitle = title;
        mDrawerTitle = drawerTitle;
        mDrawerLayout = (DrawerLayout) findViewById(layout);
        //populate the navigation drawer
        mDrawerList = (ListView) findViewById(list);
        // set a custom shadow that overlays the main content when the drawer opens
        mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);

        // load slide menu items
        String[] navMenuTitles = getResources().getStringArray(R.array.nav_drawer_items);
        // nav drawer icons from resources
        TypedArray navMenuIcons = getResources().obtainTypedArray(R.array.nav_drawer_icons);
// Path: app/src/main/java/com/github/jvanhie/discogsscrobbler/adapters/NavDrawerListAdapter.java
// public class NavDrawerListAdapter extends BaseAdapter {
// 
//     private Context mContext;
//     private ArrayList<NavDrawerItem> navDrawerItems;
// 
//     public NavDrawerListAdapter(Context context){
//         this.mContext = context;
//         this.navDrawerItems = new ArrayList<NavDrawerItem>();
//     }
// 
//     public void addItem(String title, int icon) {
//         navDrawerItems.add(new NavDrawerItem(title,icon));
//     }
// 
//     @Override
//     public int getCount() {
//         return navDrawerItems.size();
//     }
// 
//     @Override
//     public Object getItem(int position) {
//         return navDrawerItems.get(position);
//     }
// 
//     @Override
//     public long getItemId(int position) {
//         return position;
//     }
// 
//     @SuppressLint("InflateParams")
//     @Override
//     public View getView(int position, View convertView, ViewGroup parent) {
//         if (convertView == null) {
//             if(mContext == null) return null;
//             LayoutInflater mInflater = (LayoutInflater)
//                     mContext.getSystemService(Activity.LAYOUT_INFLATER_SERVICE);
//             convertView = mInflater.inflate(R.layout.drawer_list_item, null);
//         }
// 
//         ImageView imgIcon = (ImageView) convertView.findViewById(R.id.icon);
//         TextView txtTitle = (TextView) convertView.findViewById(R.id.title);
// 
//         imgIcon.setImageResource(navDrawerItems.get(position).icon);
//         txtTitle.setText(navDrawerItems.get(position).title);
// 
//         return convertView;
//     }
// 
//     private class NavDrawerItem {
//         public String title;
//         public int icon;
// 
//         public NavDrawerItem(){}
// 
//         public NavDrawerItem(String title, int icon){
//             this.title = title;
//             this.icon = icon;
//         }
// 
//     }
// 
// }


// Path: app/src/main/java/com/github/jvanhie/discogsscrobbler/DrawerActivity.java
import com.github.jvanhie.discogsscrobbler.adapters.NavDrawerListAdapter;
import android.content.Intent;
import android.content.res.Configuration;
import android.content.res.TypedArray;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.ActionBarDrawerToggle;
import android.support.v4.view.GravityCompat;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarActivity;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;

/*
 * Copyright (c) 2014 Jono Vanhie-Van Gerwen
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.github.jvanhie.discogsscrobbler;



/**
 * Created by Jono on 01/04/2014.
 */
public abstract class DrawerActivity extends ActionBarActivity {

    private CharSequence mDrawerTitle;
    private CharSequence mTitle;
    private DrawerLayout mDrawerLayout;
    private ListView mDrawerList;
    private ActionBarDrawerToggle mDrawerToggle;

    public void setDrawer(int layout, int list, String title, String drawerTitle, boolean showDrawerIcon) {
        mTitle = title;
        mDrawerTitle = drawerTitle;
        mDrawerLayout = (DrawerLayout) findViewById(layout);
        //populate the navigation drawer
        mDrawerList = (ListView) findViewById(list);
        // set a custom shadow that overlays the main content when the drawer opens
        mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START);

        // load slide menu items
        String[] navMenuTitles = getResources().getStringArray(R.array.nav_drawer_items);
        // nav drawer icons from resources
        TypedArray navMenuIcons = getResources().obtainTypedArray(R.array.nav_drawer_icons);
        NavDrawerListAdapter adapter = new NavDrawerListAdapter(this);