Exemplo n.º 1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            mToolbar      = FindViewById <SupportToolbar>(Resource.Id.toolbar);
            mDrawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);
            mLeftDrawer   = FindViewById <ListView>(Resource.Id.left_drawer);
            mRightDrawer  = FindViewById <ListView>(Resource.Id.right_drawer);

            mLeftDrawer.Tag  = 0;
            mRightDrawer.Tag = 1;

            SetSupportActionBar(mToolbar);

            mLeftDataSet = new List <string>();
            mLeftDataSet.Add("    PARTEA PRACTICA");
            mLeftDataSet.Add("Proprietatile unui grup");
            mLeftDataSet.Add("Prop. prod. 2 grupuri");
            mLeftDataSet.Add("Izotopii grupului");
            mLeftDataSet.Add("Compunerea substitutiilor");
            mLeftDataSet.Add("Laboratorul 4");
            mLeftAdapter        = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleListItem1, mLeftDataSet);
            mLeftDrawer.Adapter = mLeftAdapter;

            mRightDataSet = new List <string>();
            mRightDataSet.Add("      PARTEA TEORETICA");
            mRightDataSet.Add("Cap I");
            mRightDataSet.Add("Cap II");
            mRightDataSet.Add("Lucrari laborator ex.");
            mRightAdapter        = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleListItem1, mRightDataSet);
            mRightDrawer.Adapter = mRightAdapter;

            mDrawerToggle = new MenuActionManager(
                this,                           //Host Activity
                mDrawerLayout,                  //DrawerLayout
                Resource.String.openDrawer,     //Opened Message
                Resource.String.closeDrawer     //Closed Message
                );

            mDrawerLayout.SetDrawerListener(mDrawerToggle);
            SupportActionBar.SetHomeButtonEnabled(true);
            SupportActionBar.SetDisplayShowTitleEnabled(true);
            mDrawerToggle.SyncState();

            if (bundle != null)
            {
                if (bundle.GetString("DrawerState") == "Opened")
                {
                    SupportActionBar.SetTitle(Resource.String.openDrawer);
                }

                else
                {
                    SupportActionBar.SetTitle(Resource.String.closeDrawer);
                }
            }

            else
            {
                //This is the first the time the activity is ran
                SupportActionBar.SetTitle(Resource.String.closeDrawer);
            }


            mLeftDrawer.ItemClick  += MLeftDrawer_ItemClick;
            mRightDrawer.ItemClick += MRightDrawer_ItemClick;
        }
Exemplo n.º 2
0
 protected override void OnPostCreate(Bundle savedInstanceState)
 {
     base.OnPostCreate(savedInstanceState);
     mDrawerToggle.SyncState();
 }