use of app.insti.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_LOCATION:
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
// Map
MapFragment mapFragment = (MapFragment) getSupportFragmentManager().findFragmentByTag(MapFragment.TAG);
if (mapFragment != null && mapFragment.isVisible()) {
mapFragment.setupGPS(true);
}
// File complaint
FileComplaintFragment fileComplaintFragment = (FileComplaintFragment) getSupportFragmentManager().findFragmentByTag(FileComplaintFragment.TAG);
if (fileComplaintFragment != null && fileComplaintFragment.isVisible()) {
fileComplaintFragment.getMapReady();
}
} else {
Toast toast = Toast.makeText(MainActivity.this, "Need Permission", Toast.LENGTH_SHORT);
toast.show();
}
}
}
use of app.insti.fragment.MapFragment in project IITB-App by wncc.
the class MainActivity method onNavigationItemSelected.
@Override
public boolean onNavigationItemSelected(MenuItem item) {
// Handle navigation view item clicks here.
int id = item.getItemId();
switch(id) {
case R.id.nav_feed:
feedFragment = new FeedFragment();
updateFragment(feedFragment);
break;
case R.id.nav_explore:
updateFragment(ExploreFragment.newInstance());
break;
case R.id.nav_news:
updateFragment(new NewsFragment());
break;
case R.id.nav_placement_blog:
openPlacementBlog();
break;
case R.id.nav_training_blog:
openTrainingBlog();
break;
case R.id.nav_mess_menu:
MessMenuFragment messMenuFragment = new MessMenuFragment();
updateFragment(messMenuFragment);
break;
case R.id.nav_calendar:
CalendarFragment calendarFragment = new CalendarFragment();
updateFragment(calendarFragment);
break;
case R.id.nav_qlinks:
QuickLinksFragment quickLinksFragment = new QuickLinksFragment();
updateFragment(quickLinksFragment);
break;
case R.id.nav_map:
MapFragment mapFragment = new MapFragment();
updateFragment(mapFragment);
break;
case R.id.nav_achievements:
WebViewFragment webViewFragment = new WebViewFragment();
Bundle bundle = new Bundle();
bundle.putString(Constants.WV_TYPE, Constants.WV_TYPE_ACHIEVEMENTS);
webViewFragment.setArguments(bundle);
updateFragment(webViewFragment);
break;
case R.id.nav_complaint:
if (session.isLoggedIn()) {
ComplaintsFragment complaintsFragment = new ComplaintsFragment();
updateFragment(complaintsFragment);
} else {
Toast.makeText(this, Constants.LOGIN_MESSAGE, Toast.LENGTH_LONG).show();
}
break;
case R.id.nav_settings:
SettingsFragment settingsFragment = new SettingsFragment();
updateFragment(settingsFragment);
break;
default:
break;
}
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
drawer.closeDrawer(GravityCompat.START);
return true;
}
Aggregations