public bool OnNavigationItemSelected(IMenuItem item) { int id = item.ItemId; if (id == Resource.Id.nav_contacts) { var intent = new Intent(this, typeof(ContactsActivity)); StartActivity(intent); } else if (id == Resource.Id.nav_map) { var intent = new Intent(this, typeof(MapsActivity)); StartActivity(intent); } else if (id == Resource.Id.nav_aboutMe) { var intent = new Intent(this, typeof(AboutMe)); StartActivity(intent); } DrawerLayout drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout); drawer.CloseDrawer(GravityCompat.Start); return(true); }
protected override void OnCreate(Bundle savedInstanceState) { //BitopiSingelton.Instance.CurrentActivity = "Approval Activity"; base.OnCreate(savedInstanceState); //bitopiApplication = (BitopiApplication)this.ApplicationContext; bitopiApplication.CurrentActivity = "Approval Activity"; //bitopiApplication.ReceivingMessages= new Dictionary<string, List<string>>(); //PushNotificationSingleton.Instance.SaveNotification(""); //BitopiSingelton.Instance.ReceivingMessages = new Dictionary<string, List<string>>(); SetContentView(Resource.Layout.ApprovalList); SupportActionBar.SetDisplayShowCustomEnabled(true); SupportActionBar.SetCustomView(Resource.Layout.custom_actionbar); rlApproval = FindViewById <RelativeLayout>(Resource.Id.rlApproval); rlApprovalList = FindViewById <RelativeLayout>(Resource.Id.rlApprovalList); tvMsg = FindViewById <TextView>(Resource.Id.tvMsg); mDrawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawer_layout); FindViewById <ImageButton>(Resource.Id.btnDrawermenu).Visibility = ViewStates.Visible; RLleft_drawer = FindViewById <RelativeLayout>(Resource.Id.RLleft_drawer); FindViewById <ImageButton>(Resource.Id.btnDrawermenu).Click += (s, e) => { if (mDrawerLayout.IsDrawerOpen(RLleft_drawer)) { mDrawerLayout.CloseDrawer(RLleft_drawer); } else { mDrawerLayout.OpenDrawer(RLleft_drawer); } }; // base.LoadDrawerView(); }
public bool OnNavigationItemSelected(IMenuItem item) { int id = item.ItemId; if (id == Resource.Id.nav_my_cars) { // showFragment(mMyCarsFragment); Intent live_try = new Intent(this, typeof(review)); live_try.PutExtra("carId", "7029774"); live_try.PutExtra("renter_id", "2"); live_try.PutExtra("cost", "25.4₪"); StartActivity(live_try); } if (id == Resource.Id.nav_home) { showFragment(mMainFragment); } else if (id == Resource.Id.nav_history) { showFragment(mHistoryFragment); } else if (id == Resource.Id.nav_logout) { Preferences.Clear(); Intent login_try = new Intent(this, typeof(loginActivity)); StartActivity(login_try); Finish(); } DrawerLayout drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout); drawer.CloseDrawer(GravityCompat.Start); return(true); }
private void SetMenu() { var home = drawerLayout.FindViewById <LinearLayout>(Resource.Id.lytHome); home.Click += (sender, e) => { ViewModel.MainScreenCommand.Execute(null); drawerLayout.CloseDrawer(drawerMenu); }; var second = drawerLayout.FindViewById <LinearLayout>(Resource.Id.lytSecondView); second.Click += (sender, e) => { ViewModel.SecondScreenCommand.Execute(null); drawerLayout.CloseDrawer(drawerMenu); }; }
public bool OnNavigationItemSelected(IMenuItem item) { int id = item.ItemId; if (id == Resource.Id.FinnishSauna) { StartActivity(typeof(FinnishSaunaActivity)); } else if (id == Resource.Id.TurkishBath) { StartActivity(typeof(TurkishBathsActivity)); } else if (id == Resource.Id.Kneipp) { StartActivity(typeof(KneippsActivity)); } else if (id == Resource.Id.Jacuzzi) { StartActivity(typeof(JacuzzisActivity)); } else if (id == Resource.Id.logout_button) { BLL.GestioneUsers.LogoutUser(BE.User.CurrentUser); if (AccessToken.CurrentAccessToken != null) { LoginManager.Instance.LogOut(); } StartActivity(typeof(FirstPageActivity)); } DrawerLayout drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout); drawer.CloseDrawer(GravityCompat.Start); return(true); }
public bool OnNavigationItemSelected(IMenuItem item) { int id = item.ItemId; if (id == Resource.Id.nav_appoint) { // tabLayout.Visibility = ViewStates.Visible; tabLayout.AddTab(tabLayout.NewTab().SetText("New")); tabLayout.AddTab(tabLayout.NewTab().SetText("Renew")); ReplaceFragment(new NewDFrag()); } else if (id == Resource.Id.nav_cancel) { } else if (id == Resource.Id.nav_preset) { Toast.MakeText(this, "Action selected: Appoint", ToastLength.Short).Show(); ReplaceFragment(new PresetFrag()); } else if (id == Resource.Id.nav_share) { } else if (id == Resource.Id.nav_send) { } DrawerLayout drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout); drawer.CloseDrawer(GravityCompat.Start); return(true); }
public bool OnNavigationItemSelected(IMenuItem item) { int id = item.ItemId; if (id == Resource.Id.nav_gallery) { Intent intent = new Intent(this, typeof(Home)); StartActivity(intent); } else if (id == Resource.Id.nav_uploaded) { return(false); } else if (id == Resource.Id.nav_search) { Intent intent = new Intent(this, typeof(SearchInGallery)); StartActivity(intent); } else if (id == Resource.Id.nav_favorites) { Intent intent = new Intent(this, typeof(FavoriteActivity)); StartActivity(intent); } else if (id == Resource.Id.nav_disconnect) { LoginActivity.Disconnect(); Intent intent = new Intent(this, typeof(LoginActivity)); StartActivity(intent); FinishAffinity(); } DrawerLayout drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout); drawer.CloseDrawer(GravityCompat.Start); return(true); }
public bool OnNavigationItemSelected(IMenuItem item) { int id = item.ItemId; if (id == Resource.Id.nav_home) { Android.Support.V4.App.Fragment fragment_home = SupportFragmentManager.FindFragmentByTag("HOME_FRAGMENT"); if (fragment_home == null || !fragment_home.IsVisible) { SupportFragmentManager.BeginTransaction().Replace(Resource.Id.flContent, new MainFragment(), "HOME_FRAGMENT").Commit(); } } else if (id == Resource.Id.nav_workout) { Android.Support.V4.App.Fragment fragment_workout = SupportFragmentManager.FindFragmentByTag("WORKOUT_FRAGMENT"); if (fragment_workout == null || !fragment_workout.IsVisible) { SupportFragmentManager.BeginTransaction().Replace(Resource.Id.flContent, new EditWorkoutFragment(), "WORKOUT_FRAGMENT").Commit(); } } else if (id == Resource.Id.nav_calendar) { } else if (id == Resource.Id.nav_profile) { } DrawerLayout drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout); drawer.CloseDrawer(GravityCompat.Start); return(true); }
public bool OnNavigationItemSelected(IMenuItem item) { int id = item.ItemId; if (id == Resource.Id.nav_camera) { // Handle the camera action } else if (id == Resource.Id.nav_gallery) { } else if (id == Resource.Id.nav_slideshow) { } else if (id == Resource.Id.nav_manage) { } else if (id == Resource.Id.nav_share) { } else if (id == Resource.Id.nav_send) { } DrawerLayout drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout); drawer.CloseDrawer(GravityCompat.Start); return(true); }
public bool OnNavigationItemSelected(IMenuItem item) { int id = item.ItemId; if (id == Resource.Id.nav_camera) { SpyThePyeNavigated(); } else if (id == Resource.Id.nav_gallery) { Intent = new Intent(); Intent.SetType("image/*"); Intent.SetAction(Intent.ActionGetContent); StartActivityForResult(Intent.CreateChooser(Intent, "Select Picture"), PickImageId); } else if (id == Resource.Id.nav_my_pies) { } else if (id == Resource.Id.nav_manage) { } else if (id == Resource.Id.nav_share) { } DrawerLayout drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout); drawer.CloseDrawer(GravityCompat.Start); return(true); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); setup(); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); drawerLayout = FindViewById<DrawerLayout>(Resource.Id.drawer_layout); drawerList = FindViewById<RecyclerView>(Resource.Id.left_drawer); drawerLayout.SetDrawerShadow(Resource.Drawable.drawer_shadow, GravityCompat.Start); drawerList.SetLayoutManager(new LinearLayoutManager(this)); adapter = new MenuAdapter(); drawerList.SetAdapter(adapter); // enable ActionBar app icon to behave as action to toggle nav drawer this.ActionBar.SetDisplayHomeAsUpEnabled(true); this.ActionBar.SetHomeButtonEnabled(true); this.ActionBar.Title = "Test"; drawerToggle = new MainDrawerToggle(this, drawerLayout, Resource.Drawable.ic_drawer, Resource.String.drawer_open, Resource.String.drawer_close); drawerLayout.AddDrawerListener(drawerToggle); drawerLayout.CloseDrawer(drawerList); vm.NavigatedTo(null); }
public bool OnNavigationItemSelected(IMenuItem item) { int id = item.ItemId; if (id == Resource.Id.nav_login) { var intent = new Intent(this, typeof(HomeActivity)); StartActivity(intent); } else if (id == Resource.Id.nav_register) { } else if (id == Resource.Id.nav_share) { } else if (id == Resource.Id.nav_send) { } DrawerLayout drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout); drawer.CloseDrawer(GravityCompat.Start); return(true); }
public bool OnNavigationItemSelected(IMenuItem item) { int id = item.ItemId; if (id == Resource.Id.nav_profile) { StartActivity(new Android.Content.Intent(this, typeof(Profile))); Finish(); } else if (id == Resource.Id.nav_message) { StartActivity(new Android.Content.Intent(this, typeof(MainActivity))); Finish(); } else if (id == Resource.Id.nav_event) { } else if (id == Resource.Id.nav_infbase) { StartActivity(new Android.Content.Intent(this, typeof(Infomenu))); Finish(); } DrawerLayout drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout); drawer.CloseDrawer(GravityCompat.Start); return(true); }
public override void OnBackPressed() { DrawerLayout drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout); if (drawer.IsDrawerOpen(GravityCompat.Start)) { drawer.CloseDrawer(GravityCompat.Start); } else { long currentTime = DateTime.UtcNow.Ticks / TimeSpan.TicksPerMillisecond; if (currentTime - lastPress > 5000) { Toast.MakeText(this, "Press again to exit", ToastLength.Long).Show(); lastPress = currentTime; } else { Action = int.MaxValue; if (Xamarin.Essentials.Connectivity.NetworkAccess.HasInternetAccess()) { SyncData(); } else { FinishAffinity(); } // base.OnBackPressed(); } } }
private void M_navigationView_NavigationItemSelected(object sender, NavigationView.NavigationItemSelectedEventArgs e) { try { switch (e.MenuItem.ItemId) { case Resource.Id.leftmenu_dashboard: GoToFragment(FragmentEnum.Listtrajets); break; case Resource.Id.leftmenu_parameters: GoToFragment(FragmentEnum.Parameters); break; case Resource.Id.leftmenu_disconnect: Settings.UserToken = ""; Settings.UserPassword = ""; StartActivity(typeof(Activity_Login)); Finish(); break; } m_drawerLayout.CloseDrawer(GravityCompat.Start); } catch (Exception ex) { MobileCenter_Helper.ReportError(new FileAccessManager(), ex, GetType().Name, MethodBase.GetCurrentMethod().Name); } }
private void ListViewTargetState_ItemClick(object sender, AdapterView.ItemClickEventArgs e) { drawerLayout = listViewTargetState.Parent as DrawerLayout; drawerLayout.CloseDrawer(listViewTargetState); string state; switch (e.Position) { case 0: state = "New"; break; case 1: state = "InProgress"; break; case 2: state = "Done"; break; default: state = "New"; break; } List <TargetItem> lstTargets = this.GetTargetList(state); targetPagerAdapter.TargetItems = lstTargets; viewPager.CurrentItem = 0; }
private async void Item1_Tapped(object sender, TappedRoutedEventArgs e) { var grid = sender as Grid; if (grid != null) { string menuItemName = grid.Name; CoreDispatcher dispatcher = CoreWindow.GetForCurrentThread().Dispatcher; switch (menuItemName) { case "Item1": await dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => Frame.Navigate(typeof(MainPage))); break; case "Item2": DrawerLayout.CloseDrawer(); break; case "Item3": await Windows.System.Launcher.LaunchUriAsync(new Uri("https://zing.vn/", UriKind.Absolute)); break; case "Item4": break; } } }
public bool OnNavigationItemSelected(IMenuItem item) { int id = item.ItemId; if (id == Resource.Id.nav_add) { StartActivity(typeof(AddMealActivity)); } else if (id == Resource.Id.nav_history) { StartActivity(typeof(HistoryActivity)); } else if (id == Resource.Id.nav_excercise) { StartActivity(typeof(WorkoutActivity)); } else if (id == Resource.Id.nav_calc) { StartActivity(typeof(CalculatorActivity)); } else if (id == Resource.Id.nav_workout_history) { StartActivity(typeof(WorkoutHistory)); } DrawerLayout drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout); drawer.CloseDrawer(GravityCompat.Start); return(true); }
public bool OnNavigationItemSelected(IMenuItem item) { int id = item.ItemId; if (id == Resource.Id.nav_camera) { // Handle the camera action } else if (id == Resource.Id.nav_gallery) { } else if (id == Resource.Id.nav_slideshow) { } else if (id == Resource.Id.nav_manage) { } else if (id == Resource.Id.nav_share) { } else if (id == Resource.Id.nav_send) { } else if (id == Resource.Id.log_out) { SupportFragmentManager.PopBackStack(); StartActivity(typeof(MainActivity)); } DrawerLayout drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout); drawer.CloseDrawer(GravityCompat.Start); return(true); }
public override bool OnOptionsItemSelected(IMenuItem item) { Intent contactsIntent; switch (item.ItemId) { case Resource.Id.myContacts: // Intent это объект, который обеспечивает связывание отдельных компонент во время выполнения (например, двух активити ) contactsIntent = new Intent(this, typeof(ContactsActivity)); StartActivity(contactsIntent); break; case Resource.Id.settings: if (m_DrawerLayout.IsDrawerOpen(m_RightDrawerList)) { //Right Drawer is already open, close it m_DrawerLayout.CloseDrawer(m_RightDrawerList); } else { //Right Drawer is closed, open it m_DrawerLayout.OpenDrawer(m_RightDrawerList); } break; } return(base.OnOptionsItemSelected(item)); }
private void Init() { drawerLayout = FindViewById <DrawerLayout>(Resource.Id.DrawerLayout); drawerMenu = FindViewById <LinearLayout>(Resource.Id.LeftMenu); var Toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); if (Toolbar != null) { SetActionBar(Toolbar); } drawerToggle = new CustomDrawerToggle(this, drawerLayout, 0, 0); drawerLayout.AddDrawerListener(drawerToggle); drawerToggle.SyncState(); drawerLayout.CloseDrawer(drawerMenu); var bottomNavigation = FindViewById <BottomNavigationView>(Resource.Id.bottom_navigation); var fragments = new List <MvxViewPagerFragmentInfo>() { new MvxViewPagerFragmentInfo("First", typeof(FirstView), new FirstViewModel()), new MvxViewPagerFragmentInfo("Second", typeof(SecondView), new SecondViewModel()) }; var adapter = new MvxCachingFragmentStatePagerAdapter(this, SupportFragmentManager, fragments); viewPager = FindViewById <ViewPager>(Resource.Id.viewPager); viewPager.Adapter = adapter; bottomNavigation.SetOnNavigationItemSelectedListener(this); }
public bool OnNavigationItemSelected(IMenuItem item) { int id = item.ItemId; if (id == Resource.Id.nav_camera) { // Intent intent = new Intent(this, typeof(Activity1)); // StartActivity(intent); var transaction = FragmentManager.BeginTransaction(); transaction.Replace(Resource.Id.container, new Fragment2()); transaction.Commit(); } else if (id == Resource.Id.nav_gallery) { } else if (id == Resource.Id.nav_slideshow) { } else if (id == Resource.Id.nav_manage) { } else if (id == Resource.Id.nav_share) { } else if (id == Resource.Id.nav_send) { } DrawerLayout drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout); drawer.CloseDrawer(GravityCompat.Start); return(true); }
public bool OnNavigationItemSelected(IMenuItem menuItem) { if (menuItem == null) { return(false); } switch (menuItem.ItemId) { case Resource.Id.nav_events: SupportFragmentManager .BeginTransaction() .Replace(Resource.Id.fragment_container, new EventsFragment()) .Commit(); break; case Resource.Id.nav_my_groups: SupportFragmentManager .BeginTransaction() .Replace(Resource.Id.fragment_container, new UserGroupsFragment()) .Commit(); break; case Resource.Id.nav_create_new_event: SupportFragmentManager .BeginTransaction() .Replace(Resource.Id.fragment_container, new CreateNewEventFragment()) .Commit(); break; case Resource.Id.nav_create_new_group: SupportFragmentManager .BeginTransaction() .Replace(Resource.Id.fragment_container, new CreateNewGroupFragment()) .Commit(); break; case Resource.Id.nav_add_to_group: SupportFragmentManager .BeginTransaction() .Replace(Resource.Id.fragment_container, new AddToGroupFragment()) .Commit(); break; } drawer.CloseDrawer(GravityCompat.Start); return(true); }
public void OnClick(View view) { if (view.Id == Resource.Id.home) { home.SetTypeface(null, Android.Graphics.TypefaceStyle.Bold); feedback.SetTypeface(null, Android.Graphics.TypefaceStyle.Normal); faq.SetTypeface(null, Android.Graphics.TypefaceStyle.Normal); aboutSp.SetTypeface(null, Android.Graphics.TypefaceStyle.Normal); if (drawer.IsDrawerOpen(GravityCompat.Start)) { drawer.CloseDrawer(GravityCompat.Start); } } else if (view.Id == Resource.Id.feedback) { home.SetTypeface(null, Android.Graphics.TypefaceStyle.Normal); feedback.SetTypeface(null, Android.Graphics.TypefaceStyle.Bold); faq.SetTypeface(null, Android.Graphics.TypefaceStyle.Normal); aboutSp.SetTypeface(null, Android.Graphics.TypefaceStyle.Normal); if (drawer.IsDrawerOpen(GravityCompat.Start)) { drawer.CloseDrawer(GravityCompat.Start); } } else if (view.Id == Resource.Id.faq) { home.SetTypeface(null, Android.Graphics.TypefaceStyle.Normal); feedback.SetTypeface(null, Android.Graphics.TypefaceStyle.Normal); faq.SetTypeface(null, Android.Graphics.TypefaceStyle.Bold); aboutSp.SetTypeface(null, Android.Graphics.TypefaceStyle.Normal); if (drawer.IsDrawerOpen(GravityCompat.Start)) { drawer.CloseDrawer(GravityCompat.Start); } } else if (view.Id == Resource.Id.aboutSP) { home.SetTypeface(null, Android.Graphics.TypefaceStyle.Normal); feedback.SetTypeface(null, Android.Graphics.TypefaceStyle.Normal); faq.SetTypeface(null, Android.Graphics.TypefaceStyle.Normal); aboutSp.SetTypeface(null, Android.Graphics.TypefaceStyle.Bold); if (drawer.IsDrawerOpen(GravityCompat.Start)) { drawer.CloseDrawer(GravityCompat.Start); } } }
public bool OnNavigationItemSelected(IMenuItem item) { int id = item.ItemId; //var ft = SupportFragmentManager.BeginTransaction(); switch (id) { case Resource.Id.nav_admin_home: SupportActionBar.SetTitle(Resource.String.home_title); break; case Resource.Id.nav_admin_clients: SupportActionBar.SetTitle(Resource.String.clients_title); //ft.Replace(Resource.Id.frame_content, new AdminClientsFragment()).AddToBackStack(null).Commit(); break; case Resource.Id.nav_admin_consultants: SupportActionBar.SetTitle(Resource.String.consultants_title); //ft.Replace(Resource.Id.frame_content, new AdminConsultantsFragment()).AddToBackStack(null).Commit(); break; case Resource.Id.nav_admin_pending: SupportActionBar.SetTitle(Resource.String.pending_title); break; } /* * if (id == Resource.Id.nav_camera) * { * // Handle the camera action * } * else if (id == Resource.Id.nav_gallery) * { * SupportActionBar.SetTitle(Resource.String.gallery_title); * } * else if (id == Resource.Id.nav_slideshow) * { * SupportActionBar.SetTitle(Resource.String.slideshow_title); * } * else if (id == Resource.Id.nav_manage) * { * SupportActionBar.SetTitle(Resource.String.manage_title); * } * else if (id == Resource.Id.nav_share) * { * SupportActionBar.SetTitle(Resource.String.share_title); * } * else if (id == Resource.Id.nav_send) * { * SupportActionBar.SetTitle(Resource.String.send_title); * } */ DrawerLayout drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout); drawer.CloseDrawer(GravityCompat.Start); return(true); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.activity_main); Toolbar toolbar = FindViewById <Toolbar>(Resource.Id.toolbar); //toolbar.setTitleTextColor(0xFFFFFFFF); SetSupportActionBar(toolbar); drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout); home = FindViewById <TextView>(Resource.Id.home); faq = FindViewById <TextView>(Resource.Id.faq); feedback = FindViewById <TextView>(Resource.Id.feedback); aboutSp = FindViewById <TextView>(Resource.Id.aboutSP); fab = FindViewById <FloatingActionButton>(Resource.Id.fab); sign_out = FindViewById <ImageView>(Resource.Id.sign_out); close = FindViewById <ImageView>(Resource.Id.close); home.SetOnClickListener(this); faq.SetOnClickListener(this); feedback.SetOnClickListener(this); aboutSp.SetOnClickListener(this); BottomNavigationView bottomNavigationView = FindViewById <BottomNavigationView>(Resource.Id.navigation); bottomNavigationView.SetOnNavigationItemSelectedListener(this); IsPlayServicesAvailable(); bottomNavigationView.SelectedItemId = (Resource.Id.navigation_home); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar, Resource.String.navigation_drawer_open, Resource.String.navigation_drawer_close); drawer.SetDrawerListener(toggle); toggle.SyncState(); NavigationView navigationView = FindViewById <NavigationView>(Resource.Id.nav_view); close.Click += (o, e) => { if (drawer.IsDrawerOpen(GravityCompat.Start)) { drawer.CloseDrawer(GravityCompat.Start); } }; sign_out.Click += (o, e) => { Intent intent = new Intent(this, typeof(LoginActivity)); intent.AddFlags(ActivityFlags.NewTask); intent.AddFlags(ActivityFlags.ClearTask); StartActivity(intent); }; }
public bool OnNavigationItemSelected(IMenuItem item) { int id = item.ItemId; DrawerLayout drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout); drawer.CloseDrawer(GravityCompat.Start); return(true); }
void ShowFragmentAt(int position) { ViewModel.NavigateTo(position); Title = ViewModel.MenuItems.ElementAt(position); _drawerLayout.CloseDrawer(_drawerListView); }
public override bool OnOptionsItemSelected(IMenuItem item) { switch (item.ItemId) { case Android.Resource.Id.Home: if (drawerLayout.IsDrawerOpen((int)GravityFlags.Start)) { drawerLayout.CloseDrawer((int)GravityFlags.Start); } else { drawerLayout.OpenDrawer(Android.Support.V4.View.GravityCompat.Start); } return(true); } return(base.OnOptionsItemSelected(item)); }
private void NavigationView_NavigationItemSelected(object sender, NavigationView.NavigationItemSelectedEventArgs e) { e.MenuItem.SetChecked(true); //Snackbar.Make(_rootContainer, e.MenuItem.ItemId.ToString(), Snackbar.LengthLong).Show(); NavigateTo(e.MenuItem.ItemId, true); _drawerLayout.CloseDrawer(GravityCompat.Start); }
private void OnMenuClick(int position) { base.FragmentManager.BeginTransaction().Replace(Resource.Id.frameLayout, fragments[position]).Commit(); this.Title = titles[position]; drawerLayout.CloseDrawer(drawerListView); }
#pragma warning restore 414 protected override void OnCreate (Bundle bundle) { base.OnCreate (bundle); SetContentView (Resource.Layout.HomeView); mDrawerLayout = FindViewById<DrawerLayout> (Resource.Id.drawer); mDrawerView = FindViewById (Resource.Id.items); mDrawerToggle = new ActionBarDrawerToggle (this, mDrawerLayout, Resource.Drawable.ic_navigation_drawer, 0, 0); mDrawerLayout.SetDrawerListener (mDrawerToggle); ActionBar.SetHomeButtonEnabled (true); ActionBar.SetDisplayHomeAsUpEnabled (true); _closeDrawerToken = Mvx.Resolve<IMvxMessenger> ().SubscribeOnMainThread<CloseDrawerMessage> ( message => mDrawerLayout.CloseDrawer (mDrawerView)); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); drawerLayout = FindViewById<DrawerLayout>(Resource.Id.myDrawer); notebooks = FindViewById<ListView>(Resource.Id.notebooks); leftSideMenu = FindViewById<LinearLayout>(Resource.Id.leftSideMenu); addNoteButton = FindViewById<Button>(Resource.Id.addButton); notes = FindViewById<ListView>(Resource.Id.notes); menuButton = FindViewById<Button>(Resource.Id.menuButton); syncButton = FindViewById<Button>(Resource.Id.syncButton); addNotebookButton = FindViewById<Button>(Resource.Id.addNotebookButton); drawerToggle = new SideMenuDrawerToggle(this, drawerLayout, Resource.String.open_drawer, Resource.String.close_drawer);//Resource.Drawable.Icon, -- removed drawerLayout.AddDrawerListener(drawerToggle); drawerLayout.CloseDrawer(leftSideMenu); notebooksAdapter = new NotebooksAdapter(this); notebooks.Adapter = notebooksAdapter; chosenNotebookId = Guid.Parse(notebooksAdapter.GetItemAtPosition(0).Id); notesAdapter = new NotesAdapter(this, chosenNotebookId); notes.Adapter = notesAdapter; addNoteButton.Click += AddNoteButton_Click; menuButton.Click += MenuButton_Click; syncButton.Click += SyncButton_Click; addNotebookButton.Click += AddNotebookButton_Click; notebooks.ItemClick += Notebooks_ItemClick; ; notes.ItemClick += Notes_ItemClick; }
protected override void OnCreate(Bundle bundle) { SetTheme (Resource.Style.Theme_Sherlock); base.OnCreate (bundle); // Set our view from the "main" layout resource SetContentView (Resource.Layout.Main); list = FindViewById<ListView> (Resource.Id.list); drawer = FindViewById<DrawerLayout> (Resource.Id.drawer_layout); adapter = new CustomAdapter (this, list_text); list.Adapter = adapter; fragA = new FragmentA (); fragB = new FragmentB (); list.ItemClick += (sender, e) => { ListView item = sender as ListView; int pos = item.CheckedItemPosition; TextView t = (TextView) e.View.FindViewById(Resource.Id.textView1); string mess = t.Text; Bundle args = new Bundle(); args.PutString("message", mess); transaction = SupportFragmentManager.BeginTransaction(); switch (pos){ case 0: if(!fragA.IsVisible){ fragA.Arguments = args; transaction.Replace(Resource.Id.frame, fragA); } break; case 1: if(!fragB.IsVisible){ fragB.Arguments = args; transaction.Replace(Resource.Id.frame, fragB); } break; } transaction.Commit(); list.SetItemChecked(pos, true); drawer.CloseDrawer(list); }; mDrawerToggle = new Android.Support.V4.App.ActionBarDrawerToggle(this, drawer, Resource.Drawable.ic_drawer, Resource.String.drawer_open, Resource.String.drawer_close) { }; drawer.SetDrawerListener(mDrawerToggle); SupportActionBar.SetDisplayHomeAsUpEnabled (true); SupportActionBar.SetHomeButtonEnabled(true); // Get our button from the layout resource, // and attach an event to it }
public void setupToolbar(Toolbar _supporttoolbar, DrawerLayout _drawer, NavigationView _navigationview, int titleID, AppCompatActivity context) { ViewContext = context; _supporttoolbar.SetTitle(titleID); context.SetSupportActionBar(_supporttoolbar); _supporttoolbar.SetNavigationIcon(Resource.Drawable.ic_menu_white_24dp); context.SupportActionBar.SetDisplayHomeAsUpEnabled(false); ErrorHandler error = new ErrorHandler(context); _navigationview.NavigationItemSelected += (sender, e) => { switch (e.MenuItem.ItemId) { case Resource.Id.nav_recentEvents: { _drawer.CloseDrawer(GravityCompat.Start); var intent = new Intent(context, typeof(RecentEventsActivity)); context.StartActivity(intent); } break; case Resource.Id.nav_createEvent: { _drawer.CloseDrawer(GravityCompat.Start); var intent = new Intent(context, typeof(EventCreationActivity)); context.StartActivity(intent); } break; case Resource.Id.nav_deleteEvent: { _drawer.CloseDrawer(GravityCompat.Start); //switch to calendar view var intent = new Intent(context, typeof(EventDeletionActivity)); context.StartActivity(intent); } break; case Resource.Id.nav_calendar: { _drawer.CloseDrawer(GravityCompat.Start); //switch to calendar view var intent = new Intent(context, typeof(CalendarViewActivity)); context.StartActivity(intent); } break; case Resource.Id.nav_createEmployee: { _drawer.CloseDrawer(GravityCompat.Start); //switch to createEmployee view var intent = new Intent(context, typeof(CreateEmployeeActivity)); context.StartActivity(intent); } break; case Resource.Id.nav_overtime: { _drawer.CloseDrawer(GravityCompat.Start); //switch to overtime view var intent = new Intent(context, typeof(OvertimeActivity)); context.StartActivity(intent); } break; case Resource.Id.nav_filter: { _drawer.CloseDrawer(GravityCompat.Start); spawnFilterDialog(); } break; case Resource.Id.logoutitem: { _drawer.CloseDrawer(GravityCompat.Start); OnLogoutClicked(); var intent = new Intent(context, typeof(LoginActivity)); context.StartActivity(intent); } break; } }; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); LogManager.LogFactory = new GenericLogFactory(Console.WriteLine); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); // Get our button from the layout resource, // and attach an event to it Button sendButton = FindViewById<Button>(Resource.Id.sendMessageButton); messageBox = FindViewById<EditText>(Resource.Id.message); SupportToolbar mToolbar = FindViewById<SupportToolbar>(Resource.Id.toolbar); mDrawerLayout = FindViewById<DrawerLayout>(Resource.Id.drawer_layout); navigationView = FindViewById<NavigationView>(Resource.Id.nav_view); mRightDrawer = FindViewById<ListView>(Resource.Id.right_drawer); var messageHistoryList = FindViewById<ListView>(Resource.Id.messageHistory); var chatBackground = FindViewById<ImageView>(Resource.Id.chat_background); InitDefaultBackground(chatBackground); navigationView.Tag = 0; mRightDrawer.Tag = 1; var messageHistoryAdapter = new MessageListViewAdapter(this, new List<ChatMessage>(), () => this.subscriberList); messageHistoryList.Adapter = messageHistoryAdapter; var txtUser = FindViewById<TextView>(Resource.Id.txtUserName); var imgProfile = FindViewById<ImageView>(Resource.Id.imgProfile); var channels = new[] {"home"}; cmdReceiver = new ChatCommandHandler (this, messageHistoryAdapter, "home"); client = new ServerEventsClient(BaseUrl, channels) { OnConnect = connectMsg => { client.UpdateChatHistory(cmdReceiver).ConfigureAwait(false); connectMsg.UpdateUserProfile(txtUser, imgProfile); }, OnCommand = command => { if (command is ServerEventJoin) { client.GetSubscribers().ContinueWith(result => { result.Wait(); subscriberList = result.Result; Application.SynchronizationContext.Post(_ => { // Refresh profile icons when users join messageHistoryAdapter.NotifyDataSetChanged(); }, null); }); } }, OnException = error => { Application.SynchronizationContext.Post( _ => { Toast.MakeText(this, "Error : " + error.Message, ToastLength.Long); }, null); }, //ServiceClient = new JsonHttpClient(BaseUrl), Resolver = new MessageResolver(cmdReceiver) }; client.RegisterNamedReceiver<ChatReceiver>("cmd"); client.RegisterNamedReceiver<TvReciever>("tv"); client.RegisterNamedReceiver<CssReceiver>("css"); SetSupportActionBar(mToolbar); var mRightDataSet = new List<string>(commands.Keys); var mRightAdapter = new ActionListViewAdapter(this, mRightDataSet); mRightDrawer.Adapter = mRightAdapter; mRightDrawer.ItemClick += (sender, args) => { Application.SynchronizationContext.Post(_ => { messageBox.Text = commands[mRightDataSet[args.Position]]; mDrawerLayout.CloseDrawer(mRightDrawer); },null); }; mDrawerToggle = new ChatActionBarDrawerToggle( this, //Host Activity mDrawerLayout, //DrawerLayout mToolbar, // Instance of toolbar, if you use other ctor, the hamburger icon/arrow animation won't work.. Resource.String.openDrawer, //Opened Message Resource.String.closeDrawer //Closed Message ); SupportActionBar.SetHomeButtonEnabled(true); SupportActionBar.SetDisplayShowTitleEnabled(true); mDrawerLayout.SetDrawerListener(mDrawerToggle); mDrawerToggle.SyncState(); navigationView.NavigationItemSelected += OnChannelClick; sendButton.Click += OnSendClick; }