packageorg.marcinzelent.liberavem;importandroid.os.Bundle;importandroid.support.annotation.NonNull;importandroid.support.design.widget.FloatingActionButton;importandroid.support.design.widget.Snackbar;importandroid.view.View;importandroid.support.design.widget.NavigationView;importandroid.support.v4.view.GravityCompat;importandroid.support.v4.widget.DrawerLayout;importandroid.support.v7.app.ActionBarDrawerToggle;importandroid.support.v7.app.AppCompatActivity;importandroid.support.v7.widget.Toolbar;importandroid.view.Menu;importandroid.view.MenuItem;publicclassMainActivityextendsAppCompatActivityimplementsNavigationView.OnNavigationItemSelectedListener{@OverrideprotectedvoidonCreate(BundlesavedInstanceState){super.onCreate(savedInstanceState);setContentView(R.layout.activity_main);Toolbartoolbar=findViewById(R.id.toolbar);setSupportActionBar(toolbar);FloatingActionButtonfab=findViewById(R.id.fab);fab.setOnClickListener(newView.OnClickListener(){@OverridepublicvoidonClick(Viewview){Snackbar.make(view,"Replace with your own action",Snackbar.LENGTH_LONG).setAction("Action",null).show();}});DrawerLayoutdrawer=findViewById(R.id.drawer_layout);ActionBarDrawerToggletoggle=newActionBarDrawerToggle(this,drawer,toolbar,R.string.navigation_drawer_open,R.string.navigation_drawer_close);drawer.addDrawerListener(toggle);toggle.syncState();NavigationViewnavigationView=findViewById(R.id.nav_view);navigationView.setNavigationItemSelectedListener(this);}@OverridepublicvoidonBackPressed(){DrawerLayoutdrawer=findViewById(R.id.drawer_layout);if(drawer.isDrawerOpen(GravityCompat.START)){drawer.closeDrawer(GravityCompat.START);}else{super.onBackPressed();}}@OverridepublicbooleanonCreateOptionsMenu(Menumenu){// Inflate the menu; this adds items to the action bar if it is present.getMenuInflater().inflate(R.menu.main,menu);returntrue;}@OverridepublicbooleanonOptionsItemSelected(MenuItemitem){// Handle action bar item clicks here. The action bar will// automatically handle clicks on the Home/Up button, so long// as you specify a parent activity in AndroidManifest.xml.intid=item.getItemId();//noinspection SimplifiableIfStatementif(id==R.id.action_settings){returntrue;}returnsuper.onOptionsItemSelected(item);}@SuppressWarnings("StatementWithEmptyBody")@OverridepublicbooleanonNavigationItemSelected(@NonNullMenuItemitem){// Handle navigation view item clicks here.intid=item.getItemId();if(id==R.id.nav_observations){// Handle the camera action}elseif(id==R.id.nav_atlas){}elseif(id==R.id.nav_settings){}elseif(id==R.id.nav_about){}DrawerLayoutdrawer=findViewById(R.id.drawer_layout);drawer.closeDrawer(GravityCompat.START);returntrue;}}