public void OnItemSelected(AdapterView parent, View view, int position, long id)
        {
            if (parent.Id == Resource.Id.drawerLocationSpinner)
            {
                this.drawer.DrawerLocation = DrawerLocation.Values() [position];
            }

            if (parent.Id == Resource.Id.drawerTransitionsSpinner)
            {
                this.drawer.DrawerTransition = this.transitions[position];
            }
        }
        private View LoadMainContent(LayoutInflater inflater)
        {
            View    result          = inflater.Inflate(Resource.Layout.side_drawer_features_main_content, null);
            Spinner locationSpinner = (Spinner)result.FindViewById(Resource.Id.drawerLocationSpinner);
            ArrayAdapter <DrawerLocation> locationAdapter = new ArrayAdapter <DrawerLocation>(this.Activity, Android.Resource.Layout.SimpleListItem1, DrawerLocation.Values());

            locationSpinner.Adapter = locationAdapter;
            locationSpinner.OnItemSelectedListener = this;
            Spinner transitionsSpinner = (Spinner)result.FindViewById(Resource.Id.drawerTransitionsSpinner);

            ArrayAdapter <DrawerTransitionBase> transitionsAdapter = new ArrayAdapter <DrawerTransitionBase>(this.Activity, Android.Resource.Layout.SimpleListItem1, transitions);

            transitionsSpinner.Adapter = transitionsAdapter;
            transitionsSpinner.OnItemSelectedListener = this;
            return(result);
        }
Ejemplo n.º 3
0
        private View LoadMainContent(LayoutInflater inflater)
        {
            View result = inflater.Inflate(Resource.Layout.side_drawer_features_main_content, null);

            Spinner locationSpinner = (Spinner)result.FindViewById(Resource.Id.drawerLocationSpinner);
            ArrayAdapter <DrawerLocation> locationAdapter = new ArrayAdapter <DrawerLocation>(this.Activity, Android.Resource.Layout.SimpleListItem1, DrawerLocation.Values());

            locationSpinner.Adapter = locationAdapter;
            locationSpinner.OnItemSelectedListener = this;

            Spinner transitionsSpinner = (Spinner)result.FindViewById(Resource.Id.drawerTransitionsSpinner);

            transitions = new List <DrawerTransitionBase>();
            transitions.Add(new SlideInOnTopTransition());
            transitions.Add(new FallDownTransition());
            transitions.Add(new PushTransition());
            transitions.Add(new RevealTransition());
            transitions.Add(new ReverseSlideOutTransition());
            transitions.Add(new ScaleDownPusherTransition());
            transitions.Add(new ScaleUpTransition());
            transitions.Add(new SlideAlongTransition());
            ArrayAdapter <DrawerTransitionBase> transitionsAdapter = new ArrayAdapter <DrawerTransitionBase>(this.Activity, Android.Resource.Layout.SimpleListItem1, transitions);

            transitionsSpinner.Adapter = transitionsAdapter;
            transitionsSpinner.OnItemSelectedListener = this;

            CheckBox closeOnBackPress = (CheckBox)result.FindViewById(Resource.Id.drawerCloseOnBackPress);

            closeOnBackPress.CheckedChange += (object sender, CompoundButton.CheckedChangeEventArgs e) => {
                drawer.CloseOnBackPress = e.IsChecked;
            };

            Android.Support.V7.Widget.Toolbar toolbar = (Android.Support.V7.Widget.Toolbar)result.FindViewById(Resource.Id.drawerToolbar);
            toolbar.SetTitleTextColor(Android.Graphics.Color.White);

            AppCompatActivity actionBarActivity = (AppCompatActivity)this.Activity;
            ActionBar         supportActionBar  = actionBarActivity.SupportActionBar;

            if (supportActionBar != null)
            {
                String title = (String)supportActionBar.Title;
                toolbar.Title = title;
                supportActionBar.Hide();
            }

            SideDrawerToggle drawerToggle = new SideDrawerToggle(drawer, toolbar);

            return(result);
        }