protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); RegisterForPushNotifications(); RegisterFragments(bundle); SetContentView(Resource.Layout.MainView); var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); _drawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawer_layout); _drawerLayout.SetDrawerShadow(Resource.Drawable.drawer_shadow_light, (int)GravityFlags.Start); _drawerToggle = new MvxActionBarDrawerToggle(this, _drawerLayout, Resource.String.drawer_open, Resource.String.drawer_close); _drawerToggle.DrawerClosed += (_, e) => InvalidateOptionsMenu(); _drawerToggle.DrawerOpened += (_, e) => InvalidateOptionsMenu(); SupportActionBar.SetDisplayShowTitleEnabled(false); SupportActionBar.SetDisplayHomeAsUpEnabled(true); _drawerToggle.DrawerIndicatorEnabled = true; _drawerLayout.SetDrawerListener(_drawerToggle); _drawerLayout.Post(() => _drawerToggle.SyncState()); _bindableProgress = new BindableProgress(this); SetUpBindings(); Akavache.BlobCache.ApplicationName = "MyHealth"; ViewModel.ShowMenu(); ViewModel.ShowHome(); var authContext = new PlatformParameters(this); Task.Run(() => SignIn(authContext)); }
public void SetUp(int fragmentId, DrawerLayout drawerLayout) { try { mFragmentContainerView = Activity.FindViewById(fragmentId); mDrawerLayout = drawerLayout; mDrawerLayout.SetDrawerShadow(MyTrap.Droid.Resource.Drawable.drawer_shadow, GravityCompat.Start); ActionBar actionBar = GetActionBar(); actionBar.SetDisplayHomeAsUpEnabled(true); actionBar.SetHomeButtonEnabled(true); mDrawerToggle = new MyActionBarDrawerToggle(Activity, mDrawerLayout, MyTrap.Droid.Resource.Drawable.side_menu, MyTrap.Droid.Resource.String.navigation_drawer_open, MyTrap.Droid.Resource.String.navigation_drawer_close); ((MyActionBarDrawerToggle)mDrawerToggle).owner = this; var myRunnable = new MyRunnablePost(); myRunnable.owner = this; mDrawerLayout.Post(myRunnable); mDrawerLayout.SetDrawerListener(mDrawerToggle); } catch (Exception exception) { InsightsUtils.LogException(exception); } }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); RegisterHockeyApp(); // Settings needed by the Microsoft Graph service client. MicrosoftGraphService.SetAuthenticationUiContext(new PlatformParameters(this)); MicrosoftGraphService.SetClientId(AppSettings.DroidClientId); MicrosoftGraphService.SetRedirectUri(AppSettings.RedirectUri); if (Settings.ADAuthenticationEnabled) { Task.Run(() => MicrosoftGraphService.SignInAsync()); } RegisterForPushNotifications(); _fragmentManager = FragmentManager; RegisterFragments(bundle); SetContentView(Resource.Layout.MainView); var toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); _drawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawer_layout); _drawerLayout.SetDrawerShadow(Resource.Drawable.drawer_shadow_light, (int)GravityFlags.Start); _drawerToggle = new MvxActionBarDrawerToggle(this, _drawerLayout, Resource.String.drawer_open, Resource.String.drawer_close); _drawerToggle.DrawerClosed += (_, e) => InvalidateOptionsMenu(); _drawerToggle.DrawerOpened += (_, e) => InvalidateOptionsMenu(); SupportActionBar.SetDisplayShowTitleEnabled(false); SupportActionBar.SetDisplayHomeAsUpEnabled(true); _drawerToggle.DrawerIndicatorEnabled = true; _drawerLayout.SetDrawerListener(_drawerToggle); _drawerLayout.Post(() => _drawerToggle.SyncState()); _bindableProgress = new BindableProgress(this); SetUpBindings(); Akavache.BlobCache.ApplicationName = "MyHealth"; ViewModel.ShowMenu(); ViewModel.ShowHome(); }
public void Setup(int fragmentId, DrawerLayout drawerLayout, Toolbar toolbar) { fragmentContainerView = Activity.FindViewById(fragmentId); DrawerLayout = drawerLayout; drawerLayout.SetStatusBarBackgroundColor(Resources.GetColor(Resource.Color.myPrimaryDarkColor)); ActionBarDrawerToggle = new MyActionBarDrawerToggle(Activity, drawerLayout, toolbar, Resource.String.drawer_open, Resource.String.drawer_close) { OnDrawerClosedCallback = (view) => { if (IsAdded) { return; } Activity.InvalidateOptionsMenu(); }, OnDrawerOpenedCallback = (view) => { if (!IsAdded) { return; } if (!userLearnedDrawer) { userLearnedDrawer = true; SaveSharedSetting(Activity, PrefUserLearnedDrawer, "true"); } Activity.InvalidateOptionsMenu(); } }; if (!userLearnedDrawer && !fromSavedInstanceState) { drawerLayout.OpenDrawer(fragmentContainerView); } drawerLayout.Post(ActionBarDrawerToggle.SyncState); drawerLayout.SetDrawerListener(ActionBarDrawerToggle); }