package com.blstream.studybox;

import android.support.design.widget.NavigationView;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBar;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.util.Log;



public class MainActivity extends AppCompatActivity {

    private static final String TAG = MainActivity.class.getSimpleName();

    private NavigationView navigationView;
    private ActionBarDrawerToggle drawerToggle;
    private DrawerLayout drawerLayout;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);

        final ActionBar actionBar = getSupportActionBar();

        if (actionBar != null) {
            actionBar.setHomeAsUpIndicator(R.drawable.ic_menu_black_18dp);
            actionBar.setDisplayHomeAsUpEnabled(true);
        }

        navigationView = (NavigationView) findViewById(R.id.nav_view);
        drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
     }
}

@@ -78,16 +78,62 @@
 onView;%0A
+import android.support.v4.view.GravityCompat;%0A
 import a
@@ -411,62 +411,179 @@
 og;%0A
-%0A%0A%0Apublic class MainActivity extends AppCompatActivity
+import android.view.MenuItem;%0Aimport android.widget.Toast;%0A%0A%0Apublic class MainActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener
  %7B%0A%0A
@@ -660,51 +660,12 @@
 ();%0A
-%0A
     
-private NavigationView navigationView;
 %0A   
@@ -909,24 +909,96 @@
 ity_main);%0A%0A
+        drawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);%0A
         Tool
@@ -1100,68 +1100,94 @@
     
-final ActionBar actionBar = getSupportActionBar(
+NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view
 );%0A
-%0A
         
 if (
@@ -1186,153 +1186,388 @@
     
-if (actionBar != null) %7B%0A            actionBar.setHomeAsUpIndicator(R.drawable.ic_menu_black_18dp);%0A            actionBar.setDisplayHomeAsUpEnabl
+navigationView.setNavigationItemSelectedListener(this);%0A%0A        drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, toolbar, R.string.nav_open_drawer, R.string.nav_close_drawer);%0A        drawerLayout.setDrawerListener(drawerToggle);%0A        drawerToggle.syncState();%0A    %7D%0A%0A    @Override%0A    public boolean onNavigationItemSelected(MenuItem item) %7B%0A        item.setCheck
 ed(t
@@ -1572,24 +1572,25 @@
 (true);%0A
+%0A
         
 %7D%0A%0A     
@@ -1585,155 +1585,740 @@
     
-%7D%0A%0A        navigationView = (NavigationView) findViewById(R.id.nav_view);%0A        drawerLayout = (DrawerLayout) findViewById(R.id.
+int id = item.getItemId();%0A%0A        switch (id) %7B%0A            case R.id.nav_my_account:%0A                break;%0A            case R.id.nav_my_decks:%0A                break;%0A            case R.id.nav_create_fiche:%0A                break;%0A            case R.id.nav_show_deck:%0A                break;%0A            case R.id.nav_stats:%0A                break;%0A            case R.id.nav_logout:%0A                break;%0A        %7D%0A%0A        drawerLayout.closeDrawer(GravityCompat.START);%0A%0A        return true;%0A    %7D%0A%0A    @Override%0A    public void onBackPressed() %7B%0A        if (drawerLayout.isDrawerOpen(GravityCompat.START)) %7B%0A            
 drawer
-_l
+L
 ayout
-);%0A 
+.closeDrawer(GravityCompat.START);%0A        %7D else %7B%0A            super.onBackPressed();%0A        %7D%0A
     

Add DrawerToggle and listener