private void ViewSwitchGroup_CheckedChanged(object sender, EventArgs e) { var group = sender as ItemIdHolderRadioGroup; ItemHolderRadioButton selectedButton = group.GetSelected(); if (selectedButton.Text.Equals("Aanvallen")) { viewFlipper.DisplayedChild = viewFlipper.IndexOfChild(viewFlipper.FindViewById(Resource.Id.attacksList)); SetAttacksView(); } else { viewFlipper.DisplayedChild = viewFlipper.IndexOfChild(viewFlipper.FindViewById(Resource.Id.overView)); LoadStats(); } }
protected override void OnCreate(Bundle bundle) { Console.WriteLine("MainActivity - OnCreate"); base.OnCreate(bundle); _messengerHub = Bootstrapper.GetContainer().Resolve<ITinyMessengerHub>(); _messengerHub.Subscribe<MobileLibraryBrowserItemClickedMessage>(MobileLibraryBrowserItemClickedMessageReceived); RequestWindowFeature(WindowFeatures.ActionBar); SetContentView(Resource.Layout.Main); _actionBarSpinnerAdapter = ArrayAdapter.CreateFromResource(this, Resource.Array.action_list, Resource.Layout.actionbar_spinner_item); ActionBar.NavigationMode = ActionBarNavigationMode.List; ActionBar.Title = string.Empty; ActionBar.SetListNavigationCallbacks(_actionBarSpinnerAdapter, this); ActionBar.SetSelectedNavigationItem(1); _viewFlipper = FindViewById<ViewFlipper>(Resource.Id.main_viewflipper); _miniPlayer = FindViewById<LinearLayout>(Resource.Id.main_miniplayer); _miniPlaylist = FindViewById<LinearLayout>(Resource.Id.main_miniplaylist); _lblArtistName = FindViewById<TextView>(Resource.Id.main_miniplayer_lblArtistName); _lblAlbumTitle = FindViewById<TextView>(Resource.Id.main_miniplayer_lblAlbumTitle); _lblSongTitle = FindViewById<TextView>(Resource.Id.main_miniplayer_lblSongTitle); //_lblNextArtistName = FindViewById<TextView>(Resource.Id.main_miniplaylist_lblNextArtistName); //_lblNextAlbumTitle = FindViewById<TextView>(Resource.Id.main_miniplaylist_lblNextAlbumTitle); //_lblNextSongTitle = FindViewById<TextView>(Resource.Id.main_miniplaylist_lblNextSongTitle); _lblPlaylistCount = FindViewById<TextView>(Resource.Id.main_miniplaylist_lblPlaylistCount); _btnPrevious = FindViewById<ImageButton>(Resource.Id.main_miniplayer_btnPrevious); _btnPlayPause = FindViewById<ImageButton>(Resource.Id.main_miniplayer_btnPlayPause); _btnNext = FindViewById<ImageButton>(Resource.Id.main_miniplayer_btnNext); _btnPlaylist = FindViewById<ImageButton>(Resource.Id.main_miniplaylist_btnPlaylist); _btnShuffle = FindViewById<ImageButton>(Resource.Id.main_miniplaylist_btnShuffle); _btnRepeat = FindViewById<ImageButton>(Resource.Id.main_miniplaylist_btnRepeat); _btnLeft = FindViewById<ImageButton>(Resource.Id.main_miniplaylist_btnLeft); _cboPlaylist = FindViewById<Spinner>(Resource.Id.main_miniplaylist_cboPlaylist); _btnRight = FindViewById<ImageButton>(Resource.Id.main_miniplayer_btnRight); _imageAlbum = FindViewById<SquareImageView>(Resource.Id.main_miniplayer_imageAlbum); _miniPlayer.Click += (sender, args) => _messengerHub.PublishAsync<MobileNavigationManagerCommandMessage>(new MobileNavigationManagerCommandMessage(this, MobileNavigationManagerCommandMessageType.ShowPlayerView)); _btnLeft.SetOnTouchListener(this); _btnRight.SetOnTouchListener(this); _btnPrevious.SetOnTouchListener(this); _btnPlayPause.SetOnTouchListener(this); _btnNext.SetOnTouchListener(this); _btnPlaylist.SetOnTouchListener(this); _btnShuffle.SetOnTouchListener(this); _btnRepeat.SetOnTouchListener(this); _btnPrevious.Click += (sender, args) => OnPlayerPrevious(); _btnPlayPause.Click += (sender, args) => OnPlayerPlayPause(); _btnNext.Click += (sender, args) => OnPlayerNext(); _btnPlaylist.Click += (sender, args) => OnOpenPlaylist(); _btnShuffle.Click += (sender, args) => OnPlayerShuffle(); _btnRepeat.Click += (sender, args) => OnPlayerRepeat(); _btnLeft.Click += BtnLeftOnClick; _btnRight.Click += BtnRightOnClick; // Set initial view flipper item int realIndex = _viewFlipper.IndexOfChild(_miniPlayer); _viewFlipper.DisplayedChild = realIndex; // Create bitmap cache Point size = new Point(); WindowManager.DefaultDisplay.GetSize(size); int maxMemory = (int)(Runtime.GetRuntime().MaxMemory() / 1024); int cacheSize = maxMemory / 16; BitmapCache = new BitmapCache(this, cacheSize, size.X / 6, size.X / 6); _playlistSpinnerAdapter = new ArrayAdapter<string>(this, Resource.Layout.playlist_spinner_item, new string[2] {"Hello", "World"}); _cboPlaylist.Adapter = _playlistSpinnerAdapter; _cboPlaylist.ItemSelected += CboPlaylistOnItemSelected; Console.WriteLine("MainActivity - OnCreate - Binding presenters..."); var navigationManager = (AndroidNavigationManager)Bootstrapper.GetContainer().Resolve<MobileNavigationManager>(); navigationManager.MainActivity = this; // Watch out, this can lead to memory leaks! navigationManager.BindOptionsMenuView(this); navigationManager.BindPlayerStatusView(this); navigationManager.BindMobileMainView(this); }
private void CancelButtonClicked(object sender, EventArgs e) { statInputSwitcher.DisplayedChild = statInputSwitcher.IndexOfChild(statInputSwitcher.FindViewById <LinearLayout>(Resource.Id.buttonLayout)); actionButtonLayout.Visibility = ViewStates.Gone; myViewModel.RemoveCommand(); }