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;
}
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);
}
Aggregations