void ToggleActions() { if (!showActions) { LegacyBar.RemoveActionAtMenuId(Resource.Id.menu_leave_room); LegacyBar.RemoveActionAtMenuId(Resource.Id.menu_connection); return; } if (LegacyBar.ActionCount <= 1) { var connectionActionBarAction = new MenuItemLegacyBarAction( this, Resource.Id.menu_leave_room, Resource.Drawable.icon_green_circle_small, Resource.String.menu_string_exit) { ActionType = ActionType.Always, }; LegacyBar.AddAction(connectionActionBarAction); var itemActionBarAction = new MenuItemLegacyBarAction( this, Resource.Id.menu_leave_room, Resource.Drawable.icon_exit, Resource.String.menu_string_exit) { ActionType = ActionType.CollapseActionView, }; LegacyBar.AddAction(itemActionBarAction); } }
protected override void OnViewModelSet() { viewModel = ViewModel as EditAccountViewModel; SetContentView(Resource.Layout.View_EditAccount); MenuId = Resource.Menu.EditAccountMenu; LegacyBar = FindViewById <LegacyBar.Library.Bar.LegacyBar>(Resource.Id.actionbar); AddHomeAction(() => { this.Finish(); }, Resource.Drawable.jabbr_home_icon); if (!viewModel.NewAccount) { var deleteActionBarAction = new MenuItemLegacyBarAction( this, Resource.Id.menu_delete, Resource.Drawable.icon_delete, Resource.String.menu_string_delete) { ActionType = ActionType.Always }; LegacyBar.AddAction(deleteActionBarAction); } var itemActionBarAction = new MenuItemLegacyBarAction( this, Resource.Id.menu_save, Resource.Drawable.icon_save, Resource.String.menu_string_save) { ActionType = ActionType.Always }; LegacyBar.AddAction(itemActionBarAction); //LegacyBar.Title = viewModel.NewAccount ? "Add Account" : "Edit Account"; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); MenuId = Resource.Menu.mainmenu; SetContentView(Resource.Layout.fragment_tabs); _tabHost = FindViewById <TabHost>(Android.Resource.Id.TabHost); _tabHost.Setup(); _viewPager = FindViewById <ViewPager>(Resource.Id.pager); _tabsAdapter = new TabsAdapter(this, _tabHost, _viewPager); LegacyBar = FindViewById <Library.Bar.LegacyBar>(Resource.Id.actionbar); LegacyBar.Title = "Look Fragments"; AddHomeAction(typeof(HomeActivity), Resource.Drawable.icon); var action = new MenuItemLegacyBarAction(this, Resource.Id.menu_search, Resource.Drawable.ic_action_search_dark, Resource.String.menu_string_search); LegacyBar.AddAction(action); TabHost.TabSpec spec = _tabHost.NewTabSpec("tv"); spec.SetIndicator("Tab 1", Resources.GetDrawable(Resource.Drawable.icon)); _tabsAdapter.AddTab(spec, Class.FromType(typeof(FramgmentTab1)), null); spec = _tabHost.NewTabSpec("tab2"); spec.SetIndicator("Tab 2", Resources.GetDrawable(Resource.Drawable.icon)); _tabsAdapter.AddTab(spec, Class.FromType(typeof(FramgmentTab2)), null); if (bundle != null) { _tabHost.SetCurrentTabByTag(bundle.GetString("tab")); } else { _tabHost.CurrentTab = 0; } }
protected override void OnViewModelSet() { viewModel = this.ViewModel as AccountsViewModel; SetContentView(Resource.Layout.View_Accounts); LegacyBar = FindViewById <LegacyBar.Library.Bar.LegacyBar>(Resource.Id.actionbar); MenuId = Resource.Menu.AccountsMenu; AddHomeAction(() => { this.Finish(); }, Resource.Drawable.jabbr_home_icon, true); var itemActionBarAction = new MenuItemLegacyBarAction( this, Resource.Id.menu_add, Resource.Drawable.icon_add, Resource.String.menu_string_save) { ActionType = ActionType.Always }; LegacyBar.AddAction(itemActionBarAction); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Order); #region ActionBars settings //TopActionBar settings MenuId = Resource.Menu.ListMenu; LegacyBar = FindViewById <LegacyBar.Library.Bar.LegacyBar>(Resource.Id.ActionBar); LegacyBar.SetHomeLogo(Resource.Drawable.Icon); LegacyBar.Title = "Заказ"; var itemActionBarAction = new MenuItemLegacyBarAction( this, Resource.Id.btnRefresh, Resource.Drawable.ic_refresh, Resource.String.Refresh) { ActionType = ActionType.Always }; LegacyBar.AddAction(itemActionBarAction); itemActionBarAction = new MenuItemLegacyBarAction( this, Resource.Id.btnGetBalance, Resource.Drawable.ic_balance, Resource.String.Balance) { ActionType = ActionType.IfRoom }; LegacyBar.AddAction(itemActionBarAction); //BottomActionBar settings var bottomActionBar = FindViewById <LegacyBar.Library.Bar.LegacyBar>(Resource.Id.bottomActionbar); var action = new MenuItemLegacyBarAction(this, Resource.Id.btnMagicCall, Resource.Drawable.ic_call, Resource.String.CallMagicNumber) { ActionType = ActionType.Always }; bottomActionBar.AddAction(action); action = new MenuItemLegacyBarAction( this, Resource.Id.btnSetArea, Resource.Drawable.ic_location, Resource.String.ChooseArea) { ActionType = ActionType.Always }; bottomActionBar.AddAction(action); action = new MenuItemLegacyBarAction( this, Resource.Id.btnLogout, Resource.Drawable.ic_exit, Resource.String.Logout) { ActionType = ActionType.Always }; bottomActionBar.AddAction(action); action = new MenuItemLegacyBarAction(this, Resource.Id.btnSettings, Resource.Drawable.ic_settings, Resource.String.Settings) { ActionType = ActionType.Always }; bottomActionBar.AddAction(action); #endregion if (UserInfo.State == StateTypes.Free) { AddHomeAction(typeof(ListActivity), Resource.Drawable.Icon); } txtFrom = FindViewById <TextView>(Resource.Id.txtFrom); txtThru = FindViewById <TextView>(Resource.Id.txtThru); txtTo = FindViewById <TextView>(Resource.Id.txtTo); txtTime = FindViewById <TextView>(Resource.Id.txtTime); txtPrice = FindViewById <TextView>(Resource.Id.txtPrice); lblThru = FindViewById <TextView>(Resource.Id.lblThru); btnPhone = FindViewById <Button>(Resource.Id.btnPhone); btnTake = FindViewById <Button>(Resource.Id.btnTake); btnArrived = FindViewById <Button>(Resource.Id.btnArrived); btnPersonInCar = FindViewById <Button>(Resource.Id.btnPersonInCar); btnCompleted = FindViewById <Button>(Resource.Id.btnCompleted); ThreadPool.QueueUserWorkItem(o => Refresh( )); btnPhone.Click += (o, e) => { var callIntent = new Intent(Intent.ActionCall); callIntent.SetData(Android.Net.Uri.Parse("tel:" + UserInfo.CurrentOrder.Phone)); StartActivity(callIntent); }; tmrState.Elapsed += tmrState_Elapsed; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); var theme = (LegacyBarTheme)Intent.GetIntExtra("Theme", 0); switch (theme) { case LegacyBarTheme.HoloBlack: SetContentView(Resource.Layout.black_theme); break; case LegacyBarTheme.HoloBlue: SetContentView(Resource.Layout.blue_theme); break; case LegacyBarTheme.HoloGray: SetContentView(Resource.Layout.gray_theme); break; case LegacyBarTheme.HoloLight: SetContentView(Resource.Layout.light_theme); break; default: SetContentView(Resource.Layout.other); break; } //First we will specify the menu we are using. MenuId = Resource.Menu.othermainmenu; LegacyBar = FindViewById <Library.Bar.LegacyBar>(Resource.Id.actionbar); // You can also assign the title programmatically by passing a // CharSequence or resource id. LegacyBar.Title = "Other Activity"; //Set the Up button to go home, also much set current activity on the Legacy Bar AddHomeAction(typeof(HomeActivity), Resource.Drawable.icon); //always show the search icon no matter what. var itemActionBarAction = new MenuItemLegacyBarAction( this, Resource.Id.menu_search, LegacyBar.LightIcons ? Resource.Drawable.ic_action_search : Resource.Drawable.ic_action_search_dark, Resource.String.menu_string_search) { ActionType = ActionType.Always }; LegacyBar.AddAction(itemActionBarAction); //the rest of them I will say NEVER show. now on devices with a menu button you can press it and it will show old menus with the icon you specifies in the menu.xml file //on newer devices without a menu button an overflow will appear. itemActionBarAction = new MenuItemLegacyBarAction( this, Resource.Id.menu_refresh, LegacyBar.LightIcons ? Resource.Drawable.ic_action_refresh : Resource.Drawable.ic_action_refresh_dark, Resource.String.menu_string_refresh) { ActionType = ActionType.Never }; LegacyBar.AddAction(itemActionBarAction); itemActionBarAction = new MenuItemLegacyBarAction( this, Resource.Id.menu_test1, LegacyBar.LightIcons ? Resource.Drawable.ic_action_refresh : Resource.Drawable.ic_action_refresh_dark, Resource.String.menu_string_refresh) { ActionType = ActionType.Never }; LegacyBar.AddAction(itemActionBarAction); itemActionBarAction = new MenuItemLegacyBarAction( this, Resource.Id.menu_test2, LegacyBar.LightIcons ? Resource.Drawable.ic_action_refresh : Resource.Drawable.ic_action_refresh_dark, Resource.String.menu_string_refresh) { ActionType = ActionType.Never }; LegacyBar.AddAction(itemActionBarAction); itemActionBarAction = new MenuItemLegacyBarAction( this, Resource.Id.menu_test3, LegacyBar.LightIcons ? Resource.Drawable.ic_action_refresh : Resource.Drawable.ic_action_refresh_dark, Resource.String.menu_string_refresh) { ActionType = ActionType.Never }; LegacyBar.AddAction(itemActionBarAction); var bottomActionBar = FindViewById <Library.Bar.LegacyBar>(Resource.Id.bottomActionbar); var action = new MenuItemLegacyBarAction(this, Resource.Id.menu_up, bottomActionBar.LightIcons ? Resource.Drawable.ic_action_up : Resource.Drawable.ic_action_up_dark, Resource.String.menu_string_down) { ActionType = ActionType.Always }; bottomActionBar.AddAction(action); action = new MenuItemLegacyBarAction(this, Resource.Id.menu_down, bottomActionBar.LightIcons ? Resource.Drawable.ic_action_down : Resource.Drawable.ic_action_down_dark, Resource.String.menu_string_down) { ActionType = ActionType.Always }; bottomActionBar.AddAction(action); action = new MenuItemLegacyBarAction(this, Resource.Id.menu_left, bottomActionBar.LightIcons ? Resource.Drawable.ic_action_left : Resource.Drawable.ic_action_left_dark, Resource.String.menu_string_left) { ActionType = ActionType.Always }; bottomActionBar.AddAction(action); action = new MenuItemLegacyBarAction(this, Resource.Id.menu_right, bottomActionBar.LightIcons ? Resource.Drawable.ic_action_right : Resource.Drawable.ic_action_right_dark, Resource.String.menu_string_right) { ActionType = ActionType.Always }; bottomActionBar.AddAction(action); LegacyBar.SetDropDown(this, new string[] { "My First Account", "My Second Account", "My Third Account" }, DropDownSelected); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.main); LegacyBar = FindViewById <Library.Bar.LegacyBar>(Resource.Id.actionbar); LegacyBar.SetHomeLogo(Resource.Drawable.icon); /* * You can also set the title of the LegacyBar with: * LegacyBar.Title = "MyAwesomeTitle"; * * or * * LegacyBar.Title = Resource.String.<yourStringId>; * * Title Color can be set with: * LegacyBar.TitleColor = Color.Blue; //Or any other Color you want * * The Separator between the Action Bar Items can be set with: * LegacyBar.SeparatorColor = Color.Blue; * * and with a drawable: * * LegacyBar.SeparatorDrawable = myDrawable; */ //always put these 2 in there since they are NOT in my menu.xml MenuId = Resource.Menu.mainmenu; LegacyBarAction shareAction = new DefaultLegacyBarAction(this, CreateShareIntent(), LegacyBar.LightIcons ? Resource.Drawable.ic_action_sort : Resource.Drawable.ic_action_sort_dark) { ActionType = ActionType.Always }; LegacyBar.AddAction(shareAction); var otherAction = new DefaultLegacyBarAction(this, new Intent(this, typeof(OtherActivity)), LegacyBar.LightIcons ? Resource.Drawable.ic_action_share : Resource.Drawable.ic_action_share_dark) { ActionType = ActionType.Always }; LegacyBar.AddAction(otherAction); //only put in if there is room var searchMenuItemAction = new MenuItemLegacyBarAction( this, Resource.Id.menu_search, LegacyBar.LightIcons ? Resource.Drawable.ic_action_share : Resource.Drawable.ic_action_share_dark, Resource.String.menu_string_search) { ActionType = ActionType.IfRoom }; LegacyBar.AddAction(searchMenuItemAction); //never put this guy in there searchMenuItemAction = new MenuItemLegacyBarAction( this, Resource.Id.menu_refresh, LegacyBar.LightIcons ? Resource.Drawable.ic_action_refresh : Resource.Drawable.ic_action_refresh_dark, Resource.String.menu_string_refresh) { ActionType = ActionType.Never }; LegacyBar.AddAction(searchMenuItemAction); var startProgress = FindViewById <Button>(Resource.Id.start_progress); startProgress.Click += (s, e) => LegacyBar.ProgressBarVisibility = ViewStates.Visible; var stopProgress = FindViewById <Button>(Resource.Id.stop_progress); stopProgress.Click += (s, e) => LegacyBar.ProgressBarVisibility = ViewStates.Gone; var removeActions = FindViewById <Button>(Resource.Id.remove_actions); removeActions.Click += (s, e) => LegacyBar.RemoveAllActions(); var removeShareAction = FindViewById <Button>(Resource.Id.remove_share_action); removeShareAction.Click += (s, e) => LegacyBar.RemoveAction(shareAction); var addAction = FindViewById <Button>(Resource.Id.add_action); addAction.Click += (s, e) => { var action = new MyOtherActionBarAction(this, null, LegacyBar.LightIcons ? Resource.Drawable.ic_action_share : Resource.Drawable.ic_action_share_dark); LegacyBar.AddAction(action); }; var removeAction = FindViewById <Button>(Resource.Id.remove_action); removeAction.Click += (s, e) => { LegacyBar.RemoveActionAt(LegacyBar.ActionCount - 1); Toast.MakeText(this, "Removed legacyBarAction.", ToastLength.Short).Show(); }; var otherActivity = FindViewById <Button>(Resource.Id.other_activity); otherActivity.Click += (s, e) => { var intent = new Intent(this, typeof(OtherActivity)); StartActivity(intent); }; var black = FindViewById <Button>(Resource.Id.black_activity); black.Click += (s, e) => { var intent = new Intent(this, typeof(OtherActivity)); intent.PutExtra("Theme", (int)LegacyBarTheme.HoloBlack); StartActivity(intent); }; var blue = FindViewById <Button>(Resource.Id.blue_activity); blue.Click += (s, e) => { var intent = new Intent(this, typeof(OtherActivity)); intent.PutExtra("Theme", (int)LegacyBarTheme.HoloBlue); StartActivity(intent); }; var light = FindViewById <Button>(Resource.Id.light_activity); light.Click += (s, e) => { var intent = new Intent(this, typeof(OtherActivity)); intent.PutExtra("Theme", (int)LegacyBarTheme.HoloLight); StartActivity(intent); }; var gray = FindViewById <Button>(Resource.Id.gray_activity); gray.Click += (s, e) => { var intent = new Intent(this, typeof(OtherActivity)); intent.PutExtra("Theme", (int)LegacyBarTheme.HoloGray); StartActivity(intent); }; var fragmentActivity = FindViewById <Button>(Resource.Id.fragment_activity); fragmentActivity.Click += (s, e) => { var intent = new Intent(this, typeof(FragmentTabActivity)); StartActivity(intent); }; var spinnerActivity = FindViewById <Button>(Resource.Id.dropdown_activity); spinnerActivity.Click += (s, e) => { var intent = new Intent(this, typeof(SpinnerActivity)); StartActivity(intent); }; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.List); tmrState.Elapsed += tmrState_Elapsed; tmrState.Start( ); #region ActionBars settings //TopActionBar settings MenuId = Resource.Menu.ListMenu; LegacyBar = FindViewById <LegacyBar.Library.Bar.LegacyBar>(Resource.Id.ActionBar); LegacyBar.SetHomeLogo(Resource.Drawable.Icon); LegacyBar.Title = "Баланс: " + UserInfo.Balance + " р."; var itemActionBarAction = new MenuItemLegacyBarAction( this, Resource.Id.btnRefresh, Resource.Drawable.ic_refresh, Resource.String.Refresh) { ActionType = ActionType.Always }; LegacyBar.AddAction(itemActionBarAction); itemActionBarAction = new MenuItemLegacyBarAction( this, Resource.Id.btnGetBalance, Resource.Drawable.ic_balance, Resource.String.Balance) { ActionType = ActionType.IfRoom }; LegacyBar.AddAction(itemActionBarAction); //BottomActionBar settings var bottomActionBar = FindViewById <LegacyBar.Library.Bar.LegacyBar>(Resource.Id.bottomActionbar); var action = new MenuItemLegacyBarAction(this, Resource.Id.btnMagicCall, Resource.Drawable.ic_call, Resource.String.CallMagicNumber) { ActionType = ActionType.Always }; bottomActionBar.AddAction(action); action = new MenuItemLegacyBarAction( this, Resource.Id.btnSetArea, Resource.Drawable.ic_location, Resource.String.ChooseArea) { ActionType = ActionType.Always }; bottomActionBar.AddAction(action); action = new MenuItemLegacyBarAction( this, Resource.Id.btnLogout, Resource.Drawable.ic_exit, Resource.String.Logout) { ActionType = ActionType.Always }; bottomActionBar.AddAction(action); action = new MenuItemLegacyBarAction(this, Resource.Id.btnSettings, Resource.Drawable.ic_settings, Resource.String.Settings) { ActionType = ActionType.Always }; bottomActionBar.AddAction(action); #endregion lstOrders = FindViewById <ListView>(Resource.Id.lstOrders); txtNoOrders = FindViewById <TextView>(Resource.Id.txtNoOrders); lstOrders.ItemClick += lstOrders_ItemClick; LegacyBar.ProgressBarVisibility = ViewStates.Visible; ThreadPool.QueueUserWorkItem(o => Refresh( )); }