use of co.mobiwise.sample.fragment.MainFragment in project MaterialIntroView by iammert.
the class ToolbarMenuItemActivity method onNavigationItemSelected.
@Override
public boolean onNavigationItemSelected(MenuItem item) {
// Handle navigation view item clicks here.
switch(item.getItemId()) {
case R.id.nav_demo:
getSupportFragmentManager().beginTransaction().replace(R.id.container, new MainFragment()).commit();
break;
case R.id.nav_gravity:
getSupportFragmentManager().beginTransaction().replace(R.id.container, new GravityFragment()).commit();
break;
case R.id.nav_focus:
getSupportFragmentManager().beginTransaction().replace(R.id.container, new FocusFragment()).commit();
break;
case R.id.nav_recyclerview:
getSupportFragmentManager().beginTransaction().replace(R.id.container, new RecyclerviewFragment()).commit();
break;
case R.id.nav_toolbar:
startActivity(new Intent(getApplicationContext(), ToolbarMenuItemActivity.class));
break;
case R.id.nav_tab:
break;
default:
break;
}
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
drawer.closeDrawer(GravityCompat.START);
return true;
}
use of co.mobiwise.sample.fragment.MainFragment in project MaterialIntroView by iammert.
the class MainActivity method onNavigationItemSelected.
@Override
public boolean onNavigationItemSelected(MenuItem item) {
// Handle navigation view item clicks here.
switch(item.getItemId()) {
case R.id.nav_demo:
getSupportFragmentManager().beginTransaction().replace(R.id.container, new MainFragment()).commit();
break;
case R.id.nav_gravity:
getSupportFragmentManager().beginTransaction().replace(R.id.container, new GravityFragment()).commit();
break;
case R.id.nav_focus:
getSupportFragmentManager().beginTransaction().replace(R.id.container, new FocusFragment()).commit();
break;
case R.id.nav_recyclerview:
getSupportFragmentManager().beginTransaction().replace(R.id.container, new RecyclerviewFragment()).commit();
break;
case R.id.nav_toolbar:
startActivity(new Intent(getApplicationContext(), ToolbarMenuItemActivity.class));
break;
case R.id.nav_tab:
break;
default:
break;
}
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
drawer.closeDrawer(GravityCompat.START);
return true;
}
use of co.mobiwise.sample.fragment.MainFragment in project MaterialIntroView by iammert.
the class MainActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
if (savedInstanceState == null)
getSupportFragmentManager().beginTransaction().add(R.id.container, new MainFragment()).commit();
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.setDrawerListener(toggle);
toggle.syncState();
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
navigationView.setNavigationItemSelectedListener(this);
}
Aggregations