Android Open Source - AndroSol Standard Deck






From Project

Back to project page AndroSol.

License

The source code is released under:

MIT License

If you think the Android project AndroSol listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.example.androsol;
//from  w  w w . jav  a  2 s  .c  o  m
import java.util.HashMap;
import java.util.Locale;

import lib.cards.models.Card;
import lib.cards.utilities.Size;

public class StandardDeck extends AndroidDeck {

    @SuppressWarnings("serial")
    private static final HashMap<String, Integer> textures = new HashMap<String, Integer>() {
        {
            put("s1", R.drawable.standard_s1);
            put("s2", R.drawable.standard_s2);
            put("s3", R.drawable.standard_s3);
            put("s4", R.drawable.standard_s4);
            put("s5", R.drawable.standard_s5);
            put("s6", R.drawable.standard_s6);
            put("s7", R.drawable.standard_s7);
            put("s8", R.drawable.standard_s8);
            put("s9", R.drawable.standard_s9);
            put("s10", R.drawable.standard_s10);
            put("sj", R.drawable.standard_sj);
            put("sk", R.drawable.standard_sk);
            put("sq", R.drawable.standard_sq);

            put("d1", R.drawable.standard_d1);
            put("d2", R.drawable.standard_d2);
            put("d3", R.drawable.standard_d3);
            put("d4", R.drawable.standard_d4);
            put("d5", R.drawable.standard_d5);
            put("d6", R.drawable.standard_d6);
            put("d7", R.drawable.standard_d7);
            put("d8", R.drawable.standard_d8);
            put("d9", R.drawable.standard_d9);
            put("d10", R.drawable.standard_d10);
            put("dj", R.drawable.standard_dj);
            put("dk", R.drawable.standard_dk);
            put("dq", R.drawable.standard_dq);

            put("h1", R.drawable.standard_h1);
            put("h2", R.drawable.standard_h2);
            put("h3", R.drawable.standard_h3);
            put("h4", R.drawable.standard_h4);
            put("h5", R.drawable.standard_h5);
            put("h6", R.drawable.standard_h6);
            put("h7", R.drawable.standard_h7);
            put("h8", R.drawable.standard_h8);
            put("h9", R.drawable.standard_h9);
            put("h10", R.drawable.standard_h10);
            put("hj", R.drawable.standard_hj);
            put("hk", R.drawable.standard_hk);
            put("hq", R.drawable.standard_hq);

            put("c1", R.drawable.standard_c1);
            put("c2", R.drawable.standard_c2);
            put("c3", R.drawable.standard_c3);
            put("c4", R.drawable.standard_c4);
            put("c5", R.drawable.standard_c5);
            put("c6", R.drawable.standard_c6);
            put("c7", R.drawable.standard_c7);
            put("c8", R.drawable.standard_c8);
            put("c9", R.drawable.standard_c9);
            put("c10", R.drawable.standard_c10);
            put("cj", R.drawable.standard_cj);
            put("ck", R.drawable.standard_ck);
            put("cq", R.drawable.standard_cq);

            put("blank", R.drawable.standard_blank);
            put("b2fv", R.drawable.standard_b2fv);
        }
    };

    public StandardDeck() {
        this.setCardSize(new Size(71, 96));
    }

    @Override
    protected String getBlankTextureUrl() {
        return "blank";
    }

    @Override
    protected String getBackTextureUrl() {
        return "b2fv";
    }

    @Override
    protected String cardTextureUrl(Card card) {
        String suitPart = card.getSuit().toString().substring(0, 1)
                .toLowerCase(Locale.getDefault());
        String valuePart = (card.getValue().toInt()).toString();

        switch (card.getValue()) {
        case JACK:
        case QUEEN:
        case KING:
            valuePart = card.getValue().toString().substring(0, 1)
                    .toLowerCase(Locale.getDefault());
            break;
        default:
        }

        return suitPart + valuePart;
    }

    @Override
    protected int getTextureId(String name) {
        return textures.get(name);
    }

}




Java Source Code List

com.example.androsol.AndroidDeck.java
com.example.androsol.AndroidGameBoard.java
com.example.androsol.CardSpriteImpl.java
com.example.androsol.DeckTheme.java
com.example.androsol.DisplayMessageActivity.java
com.example.androsol.GameSurface.java
com.example.androsol.MainActivity.java
com.example.androsol.SpriteImpl.java
com.example.androsol.StackSpriteImpl.java
com.example.androsol.StandardDeck.java
lib.cards.controllers.Actions.java
lib.cards.controllers.DealAction.java
lib.cards.controllers.GameActionState.java
lib.cards.controllers.GameAction.java
lib.cards.controllers.GameController.java
lib.cards.controllers.NewGameActionState.java
lib.cards.controllers.NewGameAction.java
lib.cards.controllers.StackMoveAction.java
lib.cards.controllers.StackMoveState.java
lib.cards.models.CardColor.java
lib.cards.models.CardStackId.java
lib.cards.models.CardStack.java
lib.cards.models.CardState.java
lib.cards.models.CardSuit.java
lib.cards.models.CardValue.java
lib.cards.models.Card.java
lib.cards.models.CardsMovedEventHandler.java
lib.cards.models.CardsMovedEventObject.java
lib.cards.models.EmptyTableauPileFilledBy.java
lib.cards.models.EventHandler.java
lib.cards.models.FoundationBaseCard.java
lib.cards.models.FoundationSequence.java
lib.cards.models.Foundation.java
lib.cards.models.FreeCell.java
lib.cards.models.GameEventObject.java
lib.cards.models.GameOverEventHandler.java
lib.cards.models.GameOverEventObject.java
lib.cards.models.GameProperties.java
lib.cards.models.GameState.java
lib.cards.models.Game.java
lib.cards.models.MoveGroupsOfCardsAsAUnit.java
lib.cards.models.NewGameEventHandler.java
lib.cards.models.NumberOfCardsDealtFromStock.java
lib.cards.models.RedealsAllowed.java
lib.cards.models.RestoreGameEventHandler.java
lib.cards.models.ScoreChangedEventHandler.java
lib.cards.models.ScoreChangedEventObject.java
lib.cards.models.StackType.java
lib.cards.models.Stock.java
lib.cards.models.SubStackMovedEventHandler.java
lib.cards.models.SubStackMovedEventObject.java
lib.cards.models.SubStack.java
lib.cards.models.TableauSequence.java
lib.cards.models.TableauType.java
lib.cards.models.Tableau.java
lib.cards.models.Waste.java
lib.cards.utilities.CollectionUtils.java
lib.cards.utilities.CommandImpl.java
lib.cards.utilities.Command.java
lib.cards.utilities.Point.java
lib.cards.utilities.Rect.java
lib.cards.utilities.Size.java
lib.cards.utilities.UndoStack.java
lib.cards.views.CardSprite.java
lib.cards.views.DeckMetrics.java
lib.cards.views.Deck.java
lib.cards.views.GameBoardImpl.java
lib.cards.views.GameBoardMetrics.java
lib.cards.views.GameBoard.java
lib.cards.views.SpriteAddedEventHandler.java
lib.cards.views.SpriteDefaultActionEventHandler.java
lib.cards.views.SpriteEventObject.java
lib.cards.views.SpriteRemovedEventHandler.java
lib.cards.views.SpriteSelectedEventHandler.java
lib.cards.views.Sprite.java
lib.cards.views.StackSprite.java