public override View GetView(int position, View convertView, ViewGroup parent) { View v = convertView; if (v == null) { v = ((LayoutInflater)Context.GetSystemService(Context.LayoutInflaterService)).Inflate(Resource.Layout.WhiteCard, null); } if (_list.Count() > position) { var item = _list.ElementAt(position); UIAssets.PrepareWhiteCard(v, item); } return(v); }
private void ShowWinnerModal() { var RoundWinner = (CardsAgainstHumility.RoundWinner == CardsAgainstHumility.PlayerName ? "You" : CardsAgainstHumility.RoundWinner); var currentQuestion = CardsAgainstHumility.CurrentQuestion; var winningAnswer = new WhiteCard(CardsAgainstHumility.WinningCard, 20); RunOnUiThread(() => { // Prepare the builder var dlg = new Dialog(this); var view = LayoutInflater.Inflate(Resource.Layout.RoundWinnerAnnouncement, null); // Show the winner's name var winnerName = view.FindViewById <TextView>(Resource.Id.wm_Winner); winnerName.SetTypeface(UIAssets.AppFont, TypefaceStyle.Normal); winnerName.Text = $"{RoundWinner} won the round"; winnerName.SetTextSize(ComplexUnitType.Dip, 16); // Prepare the black card var blackCard = view.FindViewById <View>(Resource.Id.wm_BlackCard); UIAssets.PrepareBlackCard(blackCard, currentQuestion); // Prepare the white card var whiteCard = view.FindViewById <FrameLayout>(Resource.Id.wm_WhiteCard); UIAssets.PrepareWhiteCard(whiteCard, winningAnswer); // Place the white card just below the bottom of the black card's text PlaceWhiteCardBelowBlackCardText(whiteCard, blackCard); // Link up the close button var closeBtn = view.FindViewById <Button>(Resource.Id.wm_closeBtn); closeBtn.SetTypeface(UIAssets.AppFont, TypefaceStyle.Normal); closeBtn.Click += (owner, args) => { dlg.Dismiss(); }; // Show the modal dlg.AddContentView(view, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent)); dlg.Window.SetBackgroundDrawable(new ColorDrawable(Color.Transparent)); dlg.Show(); }); }
private void UpdateSelectedCardView() { bool showSelectedCardView = false; WhiteCard whiteCard = _selectedCard; if (CardsAgainstHumility.GameStarted) { if (CardsAgainstHumility.IsCardCzar) { if (CardsAgainstHumility.WinningCard != null) { if (whiteCard == null) { whiteCard = new WhiteCard(CardsAgainstHumility.WinningCard, 20); } showSelectedCardView = true; } } else { if (CardsAgainstHumility.SelectedCard != null) { showSelectedCardView = true; } } } if (CardsAgainstHumility.GameOver) { showSelectedCardView = false; } if (showSelectedCardView) { UIAssets.PrepareWhiteCard(SelectedAnswerView, whiteCard); // Place the white card just below the bottom of the black card's text PlaceWhiteCardBelowBlackCardText(SelectedAnswerView, CurrentQuestionView); SelectedAnswerView.Visibility = ViewStates.Visible; } else { SelectedAnswerView.Visibility = ViewStates.Invisible; } }