Search in sources :

Example 1 with CalendarFragment

use of in.ac.iitb.gymkhana.iitbapp.fragment.CalendarFragment in project IITB-App by wncc.

the class MainActivity method onNavigationItemSelected.

@SuppressWarnings("StatementWithEmptyBody")
@Override
public boolean onNavigationItemSelected(MenuItem item) {
    // Handle navigation view item clicks here.
    int id = item.getItemId();
    switch(id) {
        case R.id.nav_feed:
            FeedFragment feedFragment = new FeedFragment();
            updateFragment(feedFragment);
            break;
        case R.id.nav_my_events:
            MyEventsFragment myeventsFragment = new MyEventsFragment();
            updateFragment(myeventsFragment);
            break;
        case R.id.nav_pt_cell:
            PTCellFragment ptcellFragment = new PTCellFragment();
            updateFragment(ptcellFragment);
            break;
        case R.id.nav_mess_menu:
            MessMenuFragment messmenuFragment = new MessMenuFragment();
            updateFragment(messmenuFragment);
            break;
        case R.id.nav_gc_rankings:
            GCRankingsFragment gcrankingsFragment = new GCRankingsFragment();
            updateFragment(gcrankingsFragment);
            break;
        case R.id.nav_calendar:
            CalendarFragment calendarFragment = new CalendarFragment();
            updateFragment(calendarFragment);
            break;
        case R.id.nav_cms:
            CMSFragment cmsFragment = new CMSFragment();
            updateFragment(cmsFragment);
            break;
        case R.id.nav_timetable:
            TimetableFragment timetableFragment = new TimetableFragment();
            updateFragment(timetableFragment);
            break;
        case R.id.nav_map:
            MapFragment mapFragment = new MapFragment();
            if (ContextCompat.checkSelfPermission(MainActivity.this, Manifest.permission.ACCESS_FINE_LOCATION) == PackageManager.PERMISSION_GRANTED) {
                updateFragment(mapFragment);
            } else {
                ActivityCompat.requestPermissions(this, new String[] { Manifest.permission.ACCESS_FINE_LOCATION }, MY_PERMISSIONS_REQUEST_ACCESS_LOCATION);
            }
            break;
        case R.id.nav_contacts:
            ContactsFragment contactsFragment = new ContactsFragment();
            updateFragment(contactsFragment);
            break;
        case R.id.nav_about:
            AboutFragment aboutFragment = new AboutFragment();
            updateFragment(aboutFragment);
            break;
        case R.id.nav_people:
            PeopleFragment peopleFragment = new PeopleFragment();
            updateFragment(peopleFragment);
            break;
    }
    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    drawer.closeDrawer(GravityCompat.START);
    return true;
}
Also used : TimetableFragment(in.ac.iitb.gymkhana.iitbapp.fragment.TimetableFragment) AboutFragment(in.ac.iitb.gymkhana.iitbapp.fragment.AboutFragment) CalendarFragment(in.ac.iitb.gymkhana.iitbapp.fragment.CalendarFragment) CMSFragment(in.ac.iitb.gymkhana.iitbapp.fragment.CMSFragment) MapFragment(in.ac.iitb.gymkhana.iitbapp.fragment.MapFragment) GCRankingsFragment(in.ac.iitb.gymkhana.iitbapp.fragment.GCRankingsFragment) MyEventsFragment(in.ac.iitb.gymkhana.iitbapp.fragment.MyEventsFragment) PTCellFragment(in.ac.iitb.gymkhana.iitbapp.fragment.PTCellFragment) MessMenuFragment(in.ac.iitb.gymkhana.iitbapp.fragment.MessMenuFragment) FeedFragment(in.ac.iitb.gymkhana.iitbapp.fragment.FeedFragment) PeopleFragment(in.ac.iitb.gymkhana.iitbapp.fragment.PeopleFragment) DrawerLayout(android.support.v4.widget.DrawerLayout) ContactsFragment(in.ac.iitb.gymkhana.iitbapp.fragment.ContactsFragment)

Aggregations

DrawerLayout (android.support.v4.widget.DrawerLayout)1 AboutFragment (in.ac.iitb.gymkhana.iitbapp.fragment.AboutFragment)1 CMSFragment (in.ac.iitb.gymkhana.iitbapp.fragment.CMSFragment)1 CalendarFragment (in.ac.iitb.gymkhana.iitbapp.fragment.CalendarFragment)1 ContactsFragment (in.ac.iitb.gymkhana.iitbapp.fragment.ContactsFragment)1 FeedFragment (in.ac.iitb.gymkhana.iitbapp.fragment.FeedFragment)1 GCRankingsFragment (in.ac.iitb.gymkhana.iitbapp.fragment.GCRankingsFragment)1 MapFragment (in.ac.iitb.gymkhana.iitbapp.fragment.MapFragment)1 MessMenuFragment (in.ac.iitb.gymkhana.iitbapp.fragment.MessMenuFragment)1 MyEventsFragment (in.ac.iitb.gymkhana.iitbapp.fragment.MyEventsFragment)1 PTCellFragment (in.ac.iitb.gymkhana.iitbapp.fragment.PTCellFragment)1 PeopleFragment (in.ac.iitb.gymkhana.iitbapp.fragment.PeopleFragment)1 TimetableFragment (in.ac.iitb.gymkhana.iitbapp.fragment.TimetableFragment)1