Example usage for android.support.v4.view GravityCompat START

List of usage examples for android.support.v4.view GravityCompat START

Introduction

In this page you can find the example usage for android.support.v4.view GravityCompat START.

Prototype

int START

To view the source code for android.support.v4.view GravityCompat START.

Click Source Link

Usage

From source file:com.dm.wallpaper.board.activities.WallpaperBoardActivity.java

private void initNavigationView(Toolbar toolbar) {
    resetNavigationView(getResources().getConfiguration().orientation);
    mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout, toolbar, R.string.txt_open,
            R.string.txt_close) {//from  w w  w .j  a  va  2s. c  om

        @Override
        public void onDrawerClosed(View drawerView) {
            super.onDrawerClosed(drawerView);
            if (mPosition == 4) {
                mPosition = mLastPosition;
                mNavigationView.getMenu().getItem(mPosition).setChecked(true);
                InAppBillingFragment.showInAppBillingDialog(mFragManager, mBillingProcessor, mLicenseKey,
                        mDonationProductsId);
                return;
            }

            if (mPosition != mLastPosition) {
                mLastPosition = mPosition;
                setFragment(getFragment(mPosition));
            }
        }
    };

    mDrawerLayout.setDrawerShadow(R.drawable.navigation_view_shadow, GravityCompat.START);
    mDrawerLayout.addDrawerListener(mDrawerToggle);
    ColorStateList colorStateList = ContextCompat.getColorStateList(this,
            Preferences.get(this).isDarkTheme() ? R.color.navigation_view_item_highlight_dark
                    : R.color.navigation_view_item_highlight);
    mNavigationView.getMenu().getItem(mNavigationView.getMenu().size() - 2)
            .setVisible(getResources().getBoolean(R.bool.enable_donation));
    mNavigationView.setItemTextColor(colorStateList);
    mNavigationView.setItemIconTintList(colorStateList);
    Drawable background = ContextCompat.getDrawable(this,
            Preferences.get(this).isDarkTheme() ? R.drawable.navigation_view_item_background_dark
                    : R.drawable.navigation_view_item_background);
    mNavigationView.setItemBackground(background);
    mNavigationView.setNavigationItemSelectedListener(item -> {
        int id = item.getItemId();
        if (id == R.id.navigation_view_wallpapers)
            mPosition = 0;
        else if (id == R.id.navigation_view_favorites)
            mPosition = 1;
        else if (id == R.id.navigation_view_settings)
            mPosition = 2;
        else if (id == R.id.navigation_view_about)
            mPosition = 3;
        else if (id == R.id.navigation_view_donate)
            mPosition = 4;

        item.setChecked(true);
        mDrawerLayout.closeDrawers();
        return true;
    });
    ViewHelper.hideNavigationViewScrollBar(mNavigationView);
}

From source file:android.support.v7.app.ActionBarDrawerToggle.java

/**
 * Enable or disable the drawer indicator. The indicator defaults to enabled.
 *
 * <p>When the indicator is disabled, the <code>ActionBar</code> will revert to displaying
 * the home-as-up indicator provided by the <code>Activity</code>'s theme in the
 * <code>android.R.attr.homeAsUpIndicator</code> attribute instead of the animated
 * drawer glyph.</p>//  w ww  .  j  a va 2 s .c om
 *
 * @param enable true to enable, false to disable
 */
public void setDrawerIndicatorEnabled(boolean enable) {
    if (enable != mDrawerIndicatorEnabled) {
        if (enable) {
            setActionBarUpIndicator((Drawable) mSlider,
                    mDrawerLayout.isDrawerOpen(GravityCompat.START) ? mCloseDrawerContentDescRes
                            : mOpenDrawerContentDescRes);
        } else {
            setActionBarUpIndicator(mHomeAsUpIndicator, 0);
        }
        mDrawerIndicatorEnabled = enable;
    }
}

From source file:com.github.dfa.diaspora_android.activity.MainActivity.java

/**
 * Initialize the navigation slider/* w w  w  .  j a v a  2  s.c o m*/
 */
private void setupNavigationSlider() {
    ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, navDrawer, toolbarTop,
            R.string.navigation_drawer_open, R.string.navigation_drawer_close);
    navDrawer.addDrawerListener(toggle);
    toggle.syncState();

    //NavigationView navView = ButterKnife.findById(this, R.id.nav_view);
    navView.setNavigationItemSelectedListener(this);

    View navHeader = navView.getHeaderView(0);
    navProfilePictureArea = ButterKnife.findById(navHeader, R.id.nav_profile_picture);
    navDrawerLayout = ButterKnife.findById(navHeader, R.id.nav_drawer);
    //Handle clicks on profile picture
    navProfilePictureArea.setOnClickListener(new View.OnClickListener() {
        public void onClick(View view) {
            navDrawer.closeDrawer(GravityCompat.START);
            if (!appSettings.getProfileId().equals("")) {
                openDiasporaUrl(urls.getProfileUrl());
            }
        }
    });
    navheaderTitle = ButterKnife.findById(navHeader, R.id.navheader_title);
    navheaderDescription = ButterKnife.findById(navHeader, R.id.podselection__podupti_notice);
    navheaderImage = ButterKnife.findById(navHeader, R.id.navheader_user_image);

    if (!appSettings.getName().equals("")) {
        navheaderTitle.setText(appSettings.getName());
    }
    if (appSettings.getPod() != null) {
        navheaderDescription.setText(appSettings.getPod().getName());
    }
    String avatarUrl = appSettings.getAvatarUrl();
    if (!avatarUrl.equals("")) {
        //Display app launcher icon instead of default avatar asset
        //(Which would by the way not load because of missing pod domain prefix in the url)
        if (avatarUrl.startsWith("/assets/user/default")) {
            AppLog.v(this, "Avatar appears to be an asset. Display launcher icon instead (avatarUrl="
                    + avatarUrl + ")");
            navheaderImage.setImageResource(R.drawable.ic_launcher);
        } else {
            // Try to load image
            if (!app.getAvatarImageLoader().loadToImageView(navheaderImage)) {
                // If not yet loaded, start download
                AppLog.v(this, "Avatar not cached. Start download: " + avatarUrl);
                app.getAvatarImageLoader().startImageDownload(navheaderImage, avatarUrl);
            }
        }
    }
    updateNavigationViewEntryVisibilities();
}

From source file:com.almunt.jgcaap.systemupdater.MainActivity.java

@SuppressWarnings("StatementWithEmptyBody")
@Override/*from  w  ww.ja va  2s . c o m*/
public boolean onNavigationItemSelected(MenuItem item) {
    // Handle navigation view item clicks here.
    int id = item.getItemId();

    if (id == R.id.nav_all) {
        rv.setAdapter(new RVAdapter(files));
        currentfiles = files;
        toolbar.setTitle("System Update");
    } else if (id == R.id.nav_download) {
        dablefiles = new ArrayList<>();
        for (int i = 0; i < files.size(); i++)
            if (files.get(i).status < 2)
                dablefiles.add(files.get(i));
        currentfiles = dablefiles;
        rv.setAdapter(new RVAdapter(dablefiles));
        toolbar.setTitle("Downloadable Updates");
    } else if (id == R.id.nav_cell) {
        dedfiles = new ArrayList<>();
        for (int i = 0; i < files.size(); i++)
            if (files.get(i).status > 1)
                dedfiles.add(files.get(i));
        currentfiles = dedfiles;
        rv.setAdapter(new RVAdapter(dedfiles));
        toolbar.setTitle("Downloaded Updates");
    } else if (id == R.id.nav_reboot) {
        RebootRecovery(false);
    } else if (id == R.id.nav_how) {
        About(false);
    } else if (id == R.id.nav_about) {
        About(true);
    }
    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    drawer.closeDrawer(GravityCompat.START);
    return true;
}

From source file:com.example.innf.newchangtu.Map.view.activity.MainActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    Intent intent;//from   ww w. j a va  2  s. co m
    switch (item.getItemId()) {
    case android.R.id.home:
        if (null != drawerLayout) {
            drawerLayout.openDrawer(GravityCompat.START);
        }
        break;
    case R.id.fast_send:
        intent = OneClickFastSendActivity.newIntent(this);
        startActivity(intent);
        break;
    case R.id.start_record:
        Log.i(TAG, "??:" + getStatus());
        intent = StartRecordActivity.newIntent(MainActivity.this, getStatus(), mTrack, mTimeInterval, mPhone);
        startActivityForResult(intent, REQUEST_CODE);
        break;
    }
    return super.onOptionsItemSelected(item);
}

From source file:com.christophergs.mbientbasic.NavigationActivity.java

@Override
public void onBackPressed() {
    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    if (drawer.isDrawerOpen(GravityCompat.START)) {
        drawer.closeDrawer(GravityCompat.START);
    } else {/*  ww w .j a va 2s. c  o  m*/
        mwBoard.setConnectionStateHandler(null);
        mwBoard.disconnect();
        super.onBackPressed();
    }
}

From source file:com.diedrico.diedricoapp.MainActivity.java

public ExpandableListView.OnChildClickListener onExpandableClick() { //Setup the listener to the expandable List View
    return new ExpandableListView.OnChildClickListener() {
        @Override/*from  w  w w  .j  av a2 s .  c o  m*/
        public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition,
                long id) {
            List<PointVector> pointVectors = new ArrayList<>();
            List<LineVector> lineVectors = new ArrayList<>();
            List<PlaneVector> planeVectors = new ArrayList<>();
            List<Model> models = new ArrayList<>();

            switch (groupPosition) {
            case 0:
                switch (childPosition) {
                case 0: //The user pressed welcome
                    explanationFragment.setExplanation(R.string.welcome, R.string.firtstext);
                    models.add(new BienvenidoModel(new PointVector(0.5f, 0.5f, 0.0f)));

                    break;
                case 1: //the user pressed components of diedrico
                    explanationFragment.setExplanation(R.string.components, R.string.edges);
                    models.add(new FirstQuadrantModel(new PointVector(1.0f, 1.0f, -0.5f)));
                    models.add(new SecondQuadrantModel(new PointVector(-1.0f, 1.0f, -0.5f)));
                    models.add(new ThirdQuadrantModel(new PointVector(-1.0f, -1.0f, -0.5f)));
                    models.add(new FourthQuadrantModel(new PointVector(1.0f, -1.0f, -0.5f)));

                    break;
                case 2: //the user pressed edges
                    explanationFragment.setExplanation(R.string.edges, R.string.firtstext);
                    break;
                }
                break;
            case 1:
                switch (childPosition) {
                case 0: //The user pressed point projection
                    pointVectors.add(new PointVector(0.75f, 0.25f, 0.0f));
                    pointVectors.add(new PointVector(0.4f, 0.6f, 0.0f));

                    explanationFragment.setExplanation(R.string.pointProjection, R.string.pointProjectionInfo);
                    break;
                case 1: ////The user pressed line projection
                    lineVectors.add(new LineVector(0.0f, 0.8f, 0.4f, 0.9f, 0.0f, -0.4f));

                    explanationFragment.setExplanation(R.string.lineProjection, R.string.lineProjectionInfo);
                    break;
                }
                break;
            case 2:
                switch (childPosition) {
                case 0: //the user pressed crosswideLine
                    lineVectors.add(new LineVector(0.0f, 0.8f, 0.4f, 0.9f, 0.0f, -0.4f));

                    explanationFragment.setExplanation(R.string.crosswideLine, R.string.crosswideLineInfo);
                    break;
                case 1: //the user pressed horizontal line
                    lineVectors.add(new LineVector(0.9f, 0.0f, 0.4f, 0.9f, 0.9f, -0.4f));

                    explanationFragment.setExplanation(R.string.horizontalLine, R.string.horizontalLineInfo);
                    break;
                case 2: //the user pressed frontal line
                    lineVectors.add(new LineVector(0.0f, 0.5f, 0.4f, 0.9f, 0.5f, -0.4f));

                    explanationFragment.setExplanation(R.string.frontalLine, R.string.frontalLineInfo);
                    break;
                case 3: //the user pressed rigid Line
                    lineVectors.add(new LineVector(0.5f, 0.0f, 0.0f, 0.5f, 0.9f, 0.0f));

                    explanationFragment.setExplanation(R.string.rigidLine, R.string.rigidLineInfo);
                    break;
                case 4: //the user pressed vertical lne
                    lineVectors.add(new LineVector(0.0f, 0.5f, 0.0f, 0.9f, 0.5f, 0.0f));

                    explanationFragment.setExplanation(R.string.verticalLine, R.string.verticalLineInfo);
                    break;
                case 5: //the user pressed ground line parallel line
                    lineVectors.add(new LineVector(0.5f, 0.5f, 0.4f, 0.5f, 0.5f, -0.4f));

                    explanationFragment.setExplanation(R.string.groundLineParallelLine,
                            R.string.groundLineParallelLineInfo);
                    break;
                case 6: //the user pressed profileLine
                    lineVectors.add(new LineVector(0.9f, 0.0f, 0.0f, 0.0f, 0.9f, 0.0f));

                    explanationFragment.setExplanation(R.string.profileLine, R.string.profileLine);
                    break;
                case 7: //the user pressed ground line cutted line
                    lineVectors.add(new LineVector(0.0f, 0.0f, 0.0f, 0.9f, 0.9f, 0.0f));

                    explanationFragment.setExplanation(R.string.groundLineCuttedLine,
                            R.string.groundLineCuttedLineInfo);
                    break;
                }
                break;
            case 3:
                switch (childPosition) {
                case 0: //the user pressed crosswide plane
                    planeVectors.add(new PlaneVector(new PointVector(0.0f, 0.0f, 0.4f),
                            new PointVector(0.0f, 1.0f, -0.5f), new PointVector(0.5f, 0.5f, -0.5f),
                            new PointVector(1.0f, 0.0f, -0.5f)));

                    explanationFragment.setExplanation(R.string.crosswidePlane, R.string.crosswidePlanoInfo);
                    break;
                case 1: //the user pressed horizontal plane
                    planeVectors.add(new PlaneVector(new PointVector(0.0f, 0.5f, -0.5f),
                            new PointVector(0.0f, 0.5f, 0.5f), new PointVector(0.9f, 0.5f, 0.5f),
                            new PointVector(0.9f, 0.5f, -0.5f)));

                    explanationFragment.setExplanation(R.string.horizontalPlane, R.string.horizontalPlaneInfo);
                    break;
                case 2: //the user pressed frontal plane
                    planeVectors.add(new PlaneVector(new PointVector(0.5f, 0.0f, 0.5f),
                            new PointVector(0.5f, 0.0f, -0.5f), new PointVector(0.5f, 1.0f, -0.5f),
                            new PointVector(0.5f, 1.0f, 0.5f)));

                    explanationFragment.setExplanation(R.string.frontalPlane, R.string.frontalPlaneInfo);
                    break;
                case 3: //the user pressed horizontal projection plane
                    planeVectors.add(new PlaneVector(new PointVector(0.0f, 1.0f, 0.4f),
                            new PointVector(0.0f, 0.0f, 0.4f), new PointVector(0.5f, 0.0f, -0.5f),
                            new PointVector(0.5f, 1.0f, -0.5f)));

                    explanationFragment.setExplanation(R.string.horizontalProjectionPlane,
                            R.string.horizontalProjectionPlaneInfo);
                    break;
                case 4: //the user pressed vertical projection plane
                    planeVectors.add(new PlaneVector(new PointVector(0.0f, 0.0f, 0.4f),
                            new PointVector(0.0f, 1.0f, -0.5f), new PointVector(1.0f, 1.0f, -0.5f),
                            new PointVector(1.0f, 0.0f, 0.4f)));

                    explanationFragment.setExplanation(R.string.verticalProjectionPlane,
                            R.string.verticalProjectionPlaneInfo);
                    break;
                case 5: //the user pressed groundLineParallelPlane
                    planeVectors.add(new PlaneVector(new PointVector(0.5f, 0.0f, 0.5f),
                            new PointVector(0.5f, 0.0f, -0.5f), new PointVector(0.0f, 0.7f, -0.5f),
                            new PointVector(0.0f, 0.7f, 0.5f)));

                    explanationFragment.setExplanation(R.string.groundLineParallelPlane,
                            R.string.groundLineParallelPlaneInfo);
                    break;
                case 6: //the user pressed groundline cutted plane
                    planeVectors.add(new PlaneVector(new PointVector(0.0f, 0.0f, 0.5f),
                            new PointVector(1.0f, 1.0f, 0.5f), new PointVector(1.0f, 1.0f, -0.5f),
                            new PointVector(0.0f, 0.0f, -0.5f)));

                    explanationFragment.setExplanation(R.string.groundLineCuttedPlane,
                            R.string.groundLineCuttedPlaneInfo);
                    break;
                case 7: //the user pressed profile plane
                    planeVectors.add(new PlaneVector(new PointVector(0.0f, 0.0f, 0.0f),
                            new PointVector(1.0f, 0.0f, 0.0f), new PointVector(1.0f, 1.0f, 0.0f),
                            new PointVector(0.0f, 1.0f, 0.0f)));

                    explanationFragment.setExplanation(R.string.profilePlane, R.string.profilePlaneInfo);
                    break;
                }
                break;
            case 4:
                break;
            }

            diedrico = new Diedrico(pointVectors, lineVectors, planeVectors, models); //To put the renderer with the points lines and planes (OpenGL)

            projectionFragment.changeRenderer(new MyGLRenderer(diedrico));
            projectionFragment.newInstance();

            diedricoFragment.setDiedrico(diedrico); //To create the diedrico (projection)

            drawer.closeDrawer(GravityCompat.START); //Closing the navigation View when the user select an option

            return false;
        }
    };
}

From source file:com.alainesp.fan.sanderson.MainActivity.java

@Override
public boolean onNavigationItemSelected(MenuItem item) {
    // Handle navigation view item clicks here.
    int id = item.getItemId();

    if (!item.isChecked()) {
        if (id != R.id.nav_about) {
            this.setTitle(item.getTitle());
            item.setChecked(true);/*from w  w w .  jav  a2s. com*/
        }

        if (id == R.id.nav_main) {
            getFragmentManager().beginTransaction().replace(R.id.main_fragment, new SummaryFragment()).commit();
            app_state = APP_STATE_SUMMARY;
        } else if (id == R.id.nav_blog) {
            getFragmentManager().beginTransaction().replace(R.id.main_fragment, new BlogPostsFragment())
                    .commit();
            app_state = APP_STATE_BLOG;
        } else if (id == R.id.nav_events) {
            getFragmentManager().beginTransaction().replace(R.id.main_fragment, new EventsFragment()).commit();
            app_state = APP_STATE_EVENTS;
        } else if (id == R.id.nav_books) {
            getFragmentManager().beginTransaction().replace(R.id.main_fragment, new BooksFragment()).commit();
            app_state = APP_STATE_BOOKS;
        } else if (id == R.id.nav_twitter) {
            getFragmentManager().beginTransaction().replace(R.id.main_fragment, new TwitterFragment()).commit();
            app_state = APP_STATE_TWITTER;
        } else if (id == R.id.nav_tor0) {
            Uri webpage = Uri.parse("http://www.tor.com/features/series/the-way-of-kings-reread-on-torcom/");
            Intent webIntent = new Intent(Intent.ACTION_VIEW, webpage);
            if (isIntentSafe(webIntent))
                startActivity(webIntent);

            getFragmentManager().beginTransaction().replace(R.id.main_fragment, new TorWoKRereadFragment())
                    .commit();
            app_state = APP_STATE_WOK;
            this.setTitle("The Way of Kings Reread");
        } else if (id == R.id.nav_tor1) {
            //Uri webpage = Uri.parse("http://www.tor.com/series/words-of-radiance-reread-on-torcom/");
            getFragmentManager().beginTransaction().replace(R.id.main_fragment, new TorWoRRereadFragment())
                    .commit();
            app_state = APP_STATE_WOR;
            this.setTitle("Words of Radiance Reread");
        } else if (id == R.id.nav_17shard)// TODO: Handle posts and news in the app
        {
            Uri webpage = Uri.parse("http://www.17thshard.com/forum/");
            Intent webIntent = new Intent(Intent.ACTION_VIEW, webpage);
            if (isIntentSafe(webIntent))
                startActivity(webIntent);

            getFragmentManager().beginTransaction().replace(R.id.main_fragment, new Shard17thFragment())
                    .commit();
            app_state = APP_STATE_17SHARD;
        } else if (id == R.id.nav_settings) {
            getFragmentManager().beginTransaction().replace(R.id.main_fragment, new SettingsFragment())
                    .commit();
            app_state = APP_STATE_SETTINGS;
        } else if (id == R.id.nav_about) {
            try {
                new AlertDialog.Builder(this).setTitle("About")
                        .setMessage(Html.fromHtml("<em>Fan of Sanderson</em> "
                                + getPackageManager().getPackageInfo(getPackageName(), 0).versionName + " BETA"
                                + "<br/><br/>Application made by fans to fans.<br/><br/>"
                                + "Developer: Alain Espinosa &lt;alainesp@gmail.com&gt;"))
                        .setPositiveButton("OK", new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialog, int which) {
                                dialog.dismiss();
                            }
                        }).create().show();
            } catch (PackageManager.NameNotFoundException ignored) {
            }
        }
    }

    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    drawer.closeDrawer(GravityCompat.START);
    return true;
}

From source file:com.github.akinaru.rfdroid.activity.BtDevicesActivity.java

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // The action bar home/up action should open or close the drawer.
    Log.i(TAG, "option selected : " + item.getItemId());
    switch (item.getItemId()) {
    case android.R.id.home:
        mDrawer.openDrawer(GravityCompat.START);
        return true;
    }//w  ww. j  a v  a  2  s . c om

    return super.onOptionsItemSelected(item);
}

From source file:alaindc.memenguage.View.MainActivity.java

@SuppressWarnings("StatementWithEmptyBody")
@Override/*from ww w .  j  a  va2 s . c o  m*/
public boolean onNavigationItemSelected(MenuItem item) {
    // Handle navigation view item clicks here.
    int id = item.getItemId();

    if (id == R.id.nav_home) {

    } else if (id == R.id.nav_settings) {
        Intent settingsActivity = new Intent(this, SettingsActivity.class);
        startActivity(settingsActivity);
    } else if (id == R.id.nav_send) {

        AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this, R.style.MyDialogTheme);
        builder.setTitle("Upload Database").setMessage("Are you sure?")
                .setPositiveButton("Yes", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int id) {
                        progressDialog.setTitle("Upload");
                        progressDialog.setMessage("Uploading to server... please wait");
                        progressDialog.show();
                        ServerRequests.uploadFile(personId,
                                getApplicationContext().getDatabasePath(Constants.DBNAME),
                                getApplicationContext());
                    }
                }).setNegativeButton("No", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int id) {
                        dialog.cancel();
                    }
                }).create().show();

    } else if (id == R.id.nav_get) {

        AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this, R.style.MyDialogTheme);
        builder.setTitle("Download Database").setMessage("Are you sure?")
                .setPositiveButton("Yes", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int id) {
                        progressDialog.setTitle("Download");
                        progressDialog.setMessage("Downloading from server... please wait");
                        progressDialog.show();
                        ServerRequests.downloadFile(personId,
                                getApplicationContext().getDatabasePath(Constants.DBNAME),
                                getApplicationContext());
                    }
                }).setNegativeButton("No", new DialogInterface.OnClickListener() {
                    @Override
                    public void onClick(DialogInterface dialog, int id) {
                        dialog.cancel();
                    }
                }).create().show();

    } else if (id == R.id.nav_share) {
        Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
        sharingIntent.setType("text/plain");
        String shareBody = "Memenguage, the best app on the world! Maybe.";
        sharingIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Memento mori!");
        sharingIntent.putExtra(android.content.Intent.EXTRA_TEXT, shareBody);
        startActivity(Intent.createChooser(sharingIntent, "Share via"));
    } else if (id == R.id.nav_signin) {
        Intent signinintent = new Intent(this, SignInActivity.class);
        signinintent.setAction(Constants.SIGNIN_LOGOUT);
        startActivity(signinintent);
    } else if (id == R.id.nav_play) {
        Intent playActivity = new Intent(this, PlayActivity.class);
        startActivity(playActivity);
    } else if (id == R.id.nav_stats) {
        Intent statsActivity = new Intent(this, StatsActivity.class);
        startActivity(statsActivity);
    }

    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    drawer.closeDrawer(GravityCompat.START);
    return true;
}