Search in sources :

Example 96 with DrawerLayout

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;
}
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)

Example 97 with DrawerLayout

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;
}
Also used : Intent(android.content.Intent) PendingIntent(android.app.PendingIntent) DrawerLayout(android.support.v4.widget.DrawerLayout)

Example 98 with DrawerLayout

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();
}
Also used : ActionBarDrawerToggle(android.support.v7.app.ActionBarDrawerToggle) DrawerLayout(android.support.v4.widget.DrawerLayout) View(android.view.View)

Example 99 with DrawerLayout

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;
}
Also used : DrawerLayout(android.support.v4.widget.DrawerLayout)

Example 100 with DrawerLayout

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);
    }
}
Also used : ActionBarDrawerToggle(android.support.v7.app.ActionBarDrawerToggle) Intent(android.content.Intent) DrawerLayout(android.support.v4.widget.DrawerLayout) Toolbar(android.support.v7.widget.Toolbar)

Aggregations

DrawerLayout (android.support.v4.widget.DrawerLayout)63 View (android.view.View)59 ActionBarDrawerToggle (android.support.v4.app.ActionBarDrawerToggle)33 ActionBarDrawerToggle (android.support.v7.app.ActionBarDrawerToggle)22 AdapterView (android.widget.AdapterView)22 NavigationView (android.support.design.widget.NavigationView)21 ListView (android.widget.ListView)21 Intent (android.content.Intent)19 Toolbar (android.support.v7.widget.Toolbar)19 TextView (android.widget.TextView)15 ImageView (android.widget.ImageView)12 ActionBar (android.support.v7.app.ActionBar)9 SharedPreferences (android.content.SharedPreferences)8 FloatingActionButton (android.support.design.widget.FloatingActionButton)7 ViewPager (android.support.v4.view.ViewPager)6 SuppressLint (android.annotation.SuppressLint)5 TabLayout (android.support.design.widget.TabLayout)5 ArrayList (java.util.ArrayList)5 ActionBar (android.app.ActionBar)4 TypedArray (android.content.res.TypedArray)4