app/src/main/java/com/example/iamatourist/MainActivity.java
@SuppressWarnings("StatementWithEmptyBody")
    @Override
    public boolean onNavigationItemSelected(MenuItem item) {
        String title = "";
        // Handle navigation view item clicks here.
        int id = item.getItemId();
        Fragment f = new Fragment();

        if (id == R.id.nav_home) {
            fab.show();
            f = new GalleryFragment();
            if (currentTrip != null) {
                title = currentTrip.getTitle();
            } else {
                title = getResources().getString(R.string.menu_home);
            }
        } else if (id == R.id.nav_Search) {
            fab.show();
            f = new SearchFragment();
            title = getResources().getString(R.string.menu_search);
        } else if (id == R.id.nav_trips) {
            fab.show();
            f = new TripsFragment();
            title = getResources().getString(R.string.menu_trips);
        } else if (id == R.id.nav_slideshow) {
            fab.hide();
            f = new SlideshowFragment();
            title = getResources().getString(R.string.menu_slideshow);
        } else if (id == R.id.nav_settings) {
            fab.hide();
            f = new SettingsFragment();
            title = getResources().getString(R.string.menu_settings);
        }

        FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
        transaction.replace(R.id.contentContainer, f);
        transaction.addToBackStack(null);
        transaction.commit();
        getSupportActionBar().setTitle(title);

        DrawerLayout drawer = findViewById(R.id.drawer_layout);
        drawer.closeDrawer(GravityCompat.START);
        return true;
    }
/**
     * This override controls the navigation by switching the fragment displayed when an item
     * on the drawer is selected
     *
     * @param item The item selected by the user
     * @return Returns true, presumably to mark a success
     */
This override controls the navigation by switching the fragment displayed when an item
on the drawer is selected

@param item The item selected by the user
@return Returns true, presumably to mark a success
This override controls the navigation by switching the fragment displayed when an item on the drawer is selected @param item The item selected by the user @return Returns true presumably to mark a success
@SuppressWarnings("StatementWithEmptyBody")
    @Override
    public boolean onNavigationItemSelected(MenuItem item) {
        String title = "";
        int id = item.getItemId();
        Fragment f = new Fragment();
        if (id == R.id.nav_home) {
            fab.show();
            f = new GalleryFragment();
            if (currentTrip != null) {
                title = currentTrip.getTitle();
            } else {
                title = getResources().getString(R.string.menu_home);
            }
        } else if (id == R.id.nav_Search) {
            fab.show();
            f = new SearchFragment();
            title = getResources().getString(R.string.menu_search);
        } else if (id == R.id.nav_trips) {
            fab.show();
            f = new TripsFragment();
            title = getResources().getString(R.string.menu_trips);
        } else if (id == R.id.nav_slideshow) {
            fab.hide();
            f = new SlideshowFragment();
            title = getResources().getString(R.string.menu_slideshow);
        } else if (id == R.id.nav_settings) {
            fab.hide();
            f = new SettingsFragment();
            title = getResources().getString(R.string.menu_settings);
        }
        FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
        transaction.replace(R.id.contentContainer, f);
        transaction.addToBackStack(null);
        transaction.commit();
        getSupportActionBar().setTitle(title);
        DrawerLayout drawer = findViewById(R.id.drawer_layout);
        drawer.closeDrawer(GravityCompat.START);
        return true;
    }
@ SuppressWarnings ( "StatementWithEmptyBody" ) @ Override public boolean onNavigationItemSelected ( MenuItem item ) { String title = "" ; int id = item . getItemId ( ) ; Fragment f = new Fragment ( ) ; if ( id == R . id . nav_home ) { fab . show ( ) ; f = new GalleryFragment ( ) ; if ( currentTrip != null ) { title = currentTrip . getTitle ( ) ; } else { title = getResources ( ) . getString ( R . string . menu_home ) ; } } else if ( id == R . id . nav_Search ) { fab . show ( ) ; f = new SearchFragment ( ) ; title = getResources ( ) . getString ( R . string . menu_search ) ; } else if ( id == R . id . nav_trips ) { fab . show ( ) ; f = new TripsFragment ( ) ; title = getResources ( ) . getString ( R . string . menu_trips ) ; } else if ( id == R . id . nav_slideshow ) { fab . hide ( ) ; f = new SlideshowFragment ( ) ; title = getResources ( ) . getString ( R . string . menu_slideshow ) ; } else if ( id == R . id . nav_settings ) { fab . hide ( ) ; f = new SettingsFragment ( ) ; title = getResources ( ) . getString ( R . string . menu_settings ) ; } FragmentTransaction transaction = getSupportFragmentManager ( ) . beginTransaction ( ) ; transaction . replace ( R . id . contentContainer , f ) ; transaction . addToBackStack ( null ) ; transaction . commit ( ) ; getSupportActionBar ( ) . setTitle ( title ) ; DrawerLayout drawer = findViewById ( R . id . drawer_layout ) ; drawer . closeDrawer ( GravityCompat . START ) ; return true ; }
This override controls the navigation by switching the fragment displayed when an item
 on the drawer is selected
This override controls the navigation by switching the fragment displayed when an item on the drawer is selected
// Handle navigation view item clicks here.