protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); AndroidExtensions.Initialize(this); SetContentView(Resource.Layout.Main); this.drawer = FindViewById <DrawerLayout> (Resource.Id.drawer_layout); this.drawerToggle = new MoyeuActionBarToggle(this, drawer, Resource.Drawable.ic_drawer, Resource.String.open_drawer, Resource.String.close_drawer) { OpenCallback = () => { ActionBar.Title = Title; CurrentFragment.HasOptionsMenu = false; InvalidateOptionsMenu(); }, CloseCallback = () => { var currentFragment = CurrentFragment; if (currentFragment != null) { ActionBar.Title = ((IMoyeuSection)currentFragment).Title; currentFragment.HasOptionsMenu = true; } InvalidateOptionsMenu(); }, }; drawer.SetDrawerShadow(Resource.Drawable.drawer_shadow, (int)GravityFlags.Left); drawer.SetDrawerListener(drawerToggle); ActionBar.SetDisplayHomeAsUpEnabled(true); ActionBar.SetHomeButtonEnabled(true); Hubway.Instance.Subscribe(this); FavoriteManager.FavoritesChanged += (sender, e) => aroundAdapter.Refresh(); drawerMenu = FindViewById <ListView> (Resource.Id.left_drawer); drawerMenu.AddFooterView(new Space(this)); drawerMenu.ItemClick += HandleSectionItemClick; menuNormalTf = Typeface.Create(Resources.GetString(Resource.String.menu_item_fontFamily), TypefaceStyle.Normal); menuHighlightTf = Typeface.Create(Resources.GetString(Resource.String.menu_item_fontFamily), TypefaceStyle.Bold); drawerMenu.Adapter = new DrawerMenuAdapter(this); drawerAround = FindViewById <ListView> (Resource.Id.left_drawer_around); drawerAround.ItemClick += HandleAroundItemClick; drawerAround.Adapter = aroundAdapter = new DrawerAroundAdapter(this); drawerMenu.SetItemChecked(0, true); if (CheckGooglePlayServices()) { client = CreateApiClient(); SwitchTo(mapFragment = new HubwayMapFragment(this)); ActionBar.Title = ((IMoyeuSection)mapFragment).Title; } }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); AndroidExtensions.Initialize(this); AnalyticsHelper.Initialize(ApplicationContext); SetContentView(Resource.Layout.Main); var toolbar = FindViewById <Android.Support.V7.Widget.Toolbar> (Resource.Id.toolbar); ViewCompat.SetElevation(toolbar, TypedValue.ApplyDimension(ComplexUnitType.Dip, 2, Resources.DisplayMetrics)); SetSupportActionBar(toolbar); this.drawer = FindViewById <DrawerLayout> (Resource.Id.drawer_layout); drawer.SetDrawerShadow(Resource.Drawable.drawer_shadow, (int)GravityFlags.Start); drawerToggle = new Android.Support.V7.App.ActionBarDrawerToggle(this, drawer, Resource.String.open_drawer, Resource.String.close_drawer); drawer.AddDrawerListener(drawerToggle); SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetHomeButtonEnabled(true); Hubway.Instance.Subscribe(this); FavoriteManager.FavoritesChanged += (sender, e) => aroundAdapter.Refresh(); drawerAround = FindViewById <ListView> (Resource.Id.left_drawer_around); drawerAround.ItemClick += HandleAroundItemClick; drawerAround.Adapter = aroundAdapter = new DrawerAroundAdapter(this); drawerMenu = FindViewById <NavigationView> (Resource.Id.left_drawer); drawerMenu.NavigationItemSelected += HandlerNavigationItemSelected; if (CheckGooglePlayServices()) { PostCheckGooglePlayServices(); } }