use of android.support.v4.widget.DrawerLayout 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;
}
use of android.support.v4.widget.DrawerLayout in project NeuCardReader by liuyanyi.
the class MainActivity method onNavigationItemSelected.
@SuppressWarnings("StatementWithEmptyBody")
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
// Handle navigation view item clicks here.
int id = item.getItemId();
if (id == R.id.nav_nfc) {
} else if (id == R.id.nav_share) {
Intent textIntent = new Intent(Intent.ACTION_SEND);
textIntent.setType("text/plain");
textIntent.putExtra(Intent.EXTRA_TEXT, getString(R.string.app_name) + " : https://www.coolapk.com/apk/com.wolfaonliu.cardreader");
startActivity(Intent.createChooser(textIntent, getString(R.string.share) + getString(R.string.app_name)));
} else if (id == R.id.nav_about) {
Intent intent = new Intent(MainActivity.this, AboutActivity.class);
startActivity(intent);
}
DrawerLayout drawer = findViewById(R.id.drawer_layout);
drawer.closeDrawer(GravityCompat.START);
return true;
}
use of android.support.v4.widget.DrawerLayout in project Shuttle by timusus.
the class MainActivity method toolbarAttached.
@Override
public void toolbarAttached(Toolbar toolbar) {
DrawerLayout drawer = findViewById(R.id.drawer_layout);
ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close) {
@Override
public void onDrawerSlide(View drawerView, float slideOffset) {
super.onDrawerSlide(drawerView, 0);
}
};
drawer.addDrawerListener(toggle);
toggle.syncState();
}
use of android.support.v4.widget.DrawerLayout in project cloudrail-si-android-sdk by CloudRail.
the class FileViewer method onNavigationItemSelected.
@Override
public boolean onNavigationItemSelected(MenuItem item) {
int id = item.getItemId();
if (id == R.id.home) {
this.navigateToHome();
}
if (id == R.id.dropbox) {
this.navigateToService(1);
}
if (id == R.id.box) {
this.navigateToService(2);
}
if (id == R.id.google_drive) {
this.navigateToService(3);
}
if (id == R.id.onedrive) {
this.navigateToService(4);
}
if (id == R.id.egnyte) {
this.navigateToService(5);
}
if (id == R.id.onedriveBusiness) {
this.navigateToService(6);
}
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
drawer.closeDrawer(GravityCompat.START);
return true;
}
use of android.support.v4.widget.DrawerLayout in project cloudrail-si-android-sdk by CloudRail.
the class FileViewer method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
Intent intent = getIntent();
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_file_viewer);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
/**
* This is required for Android versions 6.0.0 and above. Android introduced a new permission
* police which requires a developer to not only put the required permissions into the manifest
* file but also prompt the user to grant the required permission during runtime. For this
* purpose we use a library called Ask (https://github.com/00ec454/Ask) since it makes the
* process easier than the using the standard Android API.
*/
Ask.on(this).forPermissions(Manifest.permission.WRITE_EXTERNAL_STORAGE).go();
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();
this.navigationView = (NavigationView) findViewById(R.id.nav_view);
this.navigationView.setNavigationItemSelectedListener(this);
Services.getInstance().prepare(this);
sp = this.getPreferences(Context.MODE_PRIVATE);
int service = sp.getInt("service", 0);
this.navigationView.getMenu().getItem(service).setChecked(true);
if (service == 0) {
this.navigateToHome();
} else {
this.navigateToService(service);
}
}
Aggregations