use of in.ac.iitb.gymkhana.iitbapp.fragment.MapFragment in project IITB-App by wncc.
the class MainActivity method onRequestPermissionsResult.
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
switch(requestCode) {
case MY_PERMISSIONS_REQUEST_READ_EXTERNAL_STORAGE:
// If request is cancelled, the result arrays are empty.
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
Intent i = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
startActivityForResult(i, RESULT_LOAD_IMAGE);
}
return;
case MY_PERMISSIONS_REQUEST_ACCESS_LOCATION:
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
MapFragment mapFragment = new MapFragment();
updateFragment(mapFragment);
} else {
Toast toast = Toast.makeText(MainActivity.this, "Need Permission", Toast.LENGTH_SHORT);
toast.show();
}
}
}
use of in.ac.iitb.gymkhana.iitbapp.fragment.MapFragment 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;
}
Aggregations