Search in sources :

Example 1 with FeedFragment

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

the class MainActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    session = new SessionManager(getApplicationContext());
    session.checkLogin();
    Toast.makeText(getApplicationContext(), "Log In status: " + session.isLoggedIn(), Toast.LENGTH_LONG).show();
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    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.addDrawerListener(toggle);
    toggle.syncState();
    FeedFragment feedFragment = new FeedFragment();
    updateFragment(feedFragment);
    fetchNotifications();
}
Also used : ActionBarDrawerToggle(android.support.v7.app.ActionBarDrawerToggle) DrawerLayout(android.support.v4.widget.DrawerLayout) FeedFragment(in.ac.iitb.gymkhana.iitbapp.fragment.FeedFragment) Toolbar(android.support.v7.widget.Toolbar)

Example 2 with FeedFragment

use of in.ac.iitb.gymkhana.iitbapp.fragment.FeedFragment 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)2 FeedFragment (in.ac.iitb.gymkhana.iitbapp.fragment.FeedFragment)2 ActionBarDrawerToggle (android.support.v7.app.ActionBarDrawerToggle)1 Toolbar (android.support.v7.widget.Toolbar)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 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