/** * Used to set the play and draw buttons to enable or disabled Also if it is the player's turn * then set the cards to be greyed out if they are not playable. if it is not the player's turn * then do not grey out any cards * * @param isEnabled */ private void setButtonsEnabled(boolean isEnabled) { play.setEnabled(isEnabled); bet.setEnabled(isEnabled); goAlone.setEnabled(isEnabled); if (isEnabled && currentState == MSG_PLAY_CARD) { // it is your turn grey out cards for (Card c : cardHand) { boolean isPlayable = gameRules.checkCard(c, trumpSuit, cardLead, cardHand); playerContext.setCardPlayable( c.getIdNum(), isPlayable || currentState == PICK_IT_UP || currentState == PLAY_LEAD_CARD); } } else { // it is not your turn make cards normal if (playerHandLayout != null) { for (int i = 0; i < playerHandLayout.getChildCount(); i++) { ImageView v = (ImageView) playerHandLayout.getChildAt(i); playerContext.setCardPlayable(v.getId(), true); } } } }