Exemple #1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_main);

            mToolbar = FindViewById <Toolbar>(Resource.Id.mToolbar);
            SetSupportActionBar(mToolbar);
            this.SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            this.SupportActionBar.SetHomeButtonEnabled(true);

            mDrawerTitle  = this.Title;
            mPlanetTitles = this.Resources.GetStringArray(Resource.Array.planets_array);
            mDrawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);
            mDrawerList   = FindViewById <RecyclerView>(Resource.Id.left_drawer);

            mDrawerLayout.SetDrawerShadow(Resource.Drawable.drawer_shadow, GravityCompat.Start);
            mDrawerList.HasFixedSize = true;
            mDrawerList.SetLayoutManager(new LinearLayoutManager(this));

            mDrawerList.SetAdapter(new PlanetAdapter(mPlanetTitles, this));


            mDrawerToggle = new ActionBarDrawerToggle(
                this, mDrawerLayout, mToolbar, Resource.String.drawer_open, Resource.String.drawer_close);

            mDrawerLayout.AddDrawerListener(mDrawerToggle);

            var fragment        = AgendaFragment.NewInstance();
            var fragmentManager = this.SupportFragmentManager;
            var ft = fragmentManager.BeginTransaction();

            ft.Replace(Resource.Id.content_frame, fragment);
            ft.Commit();
        }
Exemple #2
0
        public static Fragment NewInstance()
        {
            Fragment fragment = new AgendaFragment();
            Bundle   args     = new Bundle();

            fragment.Arguments = args;
            return(fragment);
        }