Search in sources :

Example 86 with DrawerLayout

use of android.support.v4.widget.DrawerLayout in project NoteText by ViWu.

the class MainActivity method onNavigationItemSelected.

@SuppressWarnings("StatementWithEmptyBody")
@Override
public boolean onNavigationItemSelected(MenuItem item) {
    // Handle navigation view item clicks here.
    int id = item.getItemId();
    if (id == R.id.nav_view_all_sets) {
        Intent intent = new Intent(MainActivity.this, MainMenu.class);
        intent.putExtra("questions", questions);
        intent.putExtra("answers", answers);
        // intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
        fileWrite();
        startActivity(intent);
        finish();
        overridePendingTransition(R.anim.activity_open_scale, R.anim.activity_close_translate);
    } else if (id == R.id.nav_shuffle_review) {
        shuffle("true");
    } else if (id == R.id.nav_review) {
        shuffle("false");
    } else if (id == R.id.nav_notification) {
        setNotification();
    } else /*else if (id == R.id.nav_settings) {
            Toast.makeText(getBaseContext(),"Settings!",Toast.LENGTH_SHORT).show();
            Intent intent = new Intent(MainActivity.this, Settings.class);
            startActivity(intent);

        }*/
    if (id == R.id.nav_save) {
        fileWrite();
        Toast.makeText(getBaseContext(), "Set saved!", Toast.LENGTH_SHORT).show();
    }
    /* else if (id == R.id.nav_share) {
            Toast.makeText(getBaseContext(),"Share!!",Toast.LENGTH_SHORT).show();
        }*/
    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    assert drawer != null;
    drawer.closeDrawer(GravityCompat.START);
    return true;
}
Also used : PendingIntent(android.app.PendingIntent) Intent(android.content.Intent) DrawerLayout(android.support.v4.widget.DrawerLayout)

Example 87 with DrawerLayout

use of android.support.v4.widget.DrawerLayout in project android_frameworks_base by crdroidandroid.

the class DrawerController method create.

/**
     * Returns a controller suitable for {@code Layout}.
     */
static DrawerController create(Activity activity) {
    DrawerLayout layout = (DrawerLayout) activity.findViewById(R.id.drawer_layout);
    if (layout == null) {
        return new DummyDrawerController();
    }
    View drawer = activity.findViewById(R.id.drawer_roots);
    Toolbar toolbar = (Toolbar) activity.findViewById(R.id.roots_toolbar);
    drawer.getLayoutParams().width = calculateDrawerWidth(activity);
    ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(activity, layout, R.drawable.ic_hamburger, R.string.drawer_open, R.string.drawer_close);
    return new RuntimeDrawerController(layout, drawer, toggle, toolbar);
}
Also used : ActionBarDrawerToggle(android.support.v4.app.ActionBarDrawerToggle) DrawerLayout(android.support.v4.widget.DrawerLayout) View(android.view.View) Toolbar(android.widget.Toolbar)

Aggregations

View (android.view.View)54 DrawerLayout (android.support.v4.widget.DrawerLayout)51 ActionBarDrawerToggle (android.support.v4.app.ActionBarDrawerToggle)33 AdapterView (android.widget.AdapterView)22 ListView (android.widget.ListView)21 NavigationView (android.support.design.widget.NavigationView)18 ActionBarDrawerToggle (android.support.v7.app.ActionBarDrawerToggle)17 Intent (android.content.Intent)16 Toolbar (android.support.v7.widget.Toolbar)16 TextView (android.widget.TextView)14 ImageView (android.widget.ImageView)10 ActionBar (android.support.v7.app.ActionBar)9 SharedPreferences (android.content.SharedPreferences)8 FloatingActionButton (android.support.design.widget.FloatingActionButton)7 ViewPager (android.support.v4.view.ViewPager)6 ArrayList (java.util.ArrayList)5 SuppressLint (android.annotation.SuppressLint)4 ActionBar (android.app.ActionBar)4 TypedArray (android.content.res.TypedArray)4 Paint (android.graphics.Paint)4