<commit_before>package com.jamieadkins.gwent.deck.list;

import android.content.Context;
import android.support.v4.content.ContextCompat;
import android.util.AttributeSet;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.jamieadkins.gwent.R;
import com.jamieadkins.gwent.data.Deck;
import com.jamieadkins.gwent.data.Position;

/**
 * Wrapper for our card detail view.
 */

public class DeckSummaryView extends LinearLayout {

    private TextView mDeckMelee;
    private TextView mDeckRanged;
    private TextView mDeckSiege;
    private TextView mDeckTotalCards;
    private TextView mDeckTotalAttack;

    private TextView mDeckSilver;
    private TextView mDeckGold;

    public DeckSummaryView(Context context) {
        super(context);
        initialiseView();
    }

    public DeckSummaryView(Context context, AttributeSet attrs) {
        super(context, attrs);
        initialiseView();
    }

    public DeckSummaryView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        initialiseView();
    }

    protected void initialiseView() {
        inflateView();
        mDeckMelee = (TextView) findViewById(R.id.deck_melee);
        mDeckRanged = (TextView) findViewById(R.id.deck_range);
        mDeckSiege = (TextView) findViewById(R.id.deck_siege);
        mDeckTotalCards = (TextView) findViewById(R.id.deck_total_cards);
        mDeckTotalAttack = (TextView) findViewById(R.id.deck_total_attack);
        mDeckSilver = (TextView) findViewById(R.id.deck_silver);
        mDeckGold = (TextView) findViewById(R.id.deck_gold);
    }

    protected void inflateView() {
        inflate(getContext(), R.layout.item_deck_core, this);
    }

    public void setDeck(Deck deck) {

        mDeckMelee.setText(String.valueOf(deck.getStrengthForPosition(Position.MELEE)));
        mDeckRanged.setText(String.valueOf(deck.getStrengthForPosition(Position.RANGED)));
        mDeckSiege.setText(String.valueOf(deck.getStrengthForPosition(Position.SIEGE)));
        mDeckTotalAttack.setText(String.valueOf(deck.getTotalStrength()));

        int totalCardCount = deck.getTotalCardCount();
        int invalidColour = ContextCompat.getColor(getContext(), R.color.monsters);
        int defaultColour = ContextCompat.getColor(getContext(), R.color.textSecondary);

        mDeckTotalCards.setText(String.format(
                mDeckTotalCards.getContext().getString(R.string.deck_total_cards_value),
                totalCardCount, Deck.MAX_CARD_COUNT));
        if (totalCardCount < Deck.MIN_CARD_COUNT || totalCardCount > Deck.MAX_CARD_COUNT) {
            mDeckTotalCards.setTextColor(invalidColour);
        }

        int silverCardCount = deck.getSilverCardCount();
        mDeckSilver.setText(String.format(
                getContext().getString(R.string.deck_total_cards_value),
                silverCardCount, Deck.MAX_SILVER_COUNT));
        if (silverCardCount > Deck.MAX_SILVER_COUNT) {
            mDeckSilver.setTextColor(invalidColour);
        } else {
            mDeckSilver.setTextColor(defaultColour);
        }

        int goldCardCount = deck.getGoldCardCount();
        mDeckGold.setText(String.format(
                getContext().getString(R.string.deck_total_cards_value),
                goldCardCount, Deck.MAX_GOLD_COUNT));
        if (goldCardCount > Deck.MAX_GOLD_COUNT) {
            mDeckGold.setTextColor(invalidColour);
        } else {
            mDeckGold.setTextColor(defaultColour);
        }
    }
}<commit_msg>Ensure Deck summary views are given the correct colour<commit_after>package com.jamieadkins.gwent.deck.list;

import android.content.Context;
import android.support.v4.content.ContextCompat;
import android.util.AttributeSet;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.jamieadkins.gwent.R;
import com.jamieadkins.gwent.data.Deck;
import com.jamieadkins.gwent.data.Position;

/**
 * Wrapper for our card detail view.
 */

public class DeckSummaryView extends LinearLayout {

    private TextView mDeckMelee;
    private TextView mDeckRanged;
    private TextView mDeckSiege;
    private TextView mDeckTotalCards;
    private TextView mDeckTotalAttack;

    private TextView mDeckSilver;
    private TextView mDeckGold;

    public DeckSummaryView(Context context) {
        super(context);
        initialiseView();
    }

    public DeckSummaryView(Context context, AttributeSet attrs) {
        super(context, attrs);
        initialiseView();
    }

    public DeckSummaryView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        initialiseView();
    }

    protected void initialiseView() {
        inflateView();
        mDeckMelee = (TextView) findViewById(R.id.deck_melee);
        mDeckRanged = (TextView) findViewById(R.id.deck_range);
        mDeckSiege = (TextView) findViewById(R.id.deck_siege);
        mDeckTotalCards = (TextView) findViewById(R.id.deck_total_cards);
        mDeckTotalAttack = (TextView) findViewById(R.id.deck_total_attack);
        mDeckSilver = (TextView) findViewById(R.id.deck_silver);
        mDeckGold = (TextView) findViewById(R.id.deck_gold);
    }

    protected void inflateView() {
        inflate(getContext(), R.layout.item_deck_core, this);
    }

    public void setDeck(Deck deck) {

        mDeckMelee.setText(String.valueOf(deck.getStrengthForPosition(Position.MELEE)));
        mDeckRanged.setText(String.valueOf(deck.getStrengthForPosition(Position.RANGED)));
        mDeckSiege.setText(String.valueOf(deck.getStrengthForPosition(Position.SIEGE)));
        mDeckTotalAttack.setText(String.valueOf(deck.getTotalStrength()));

        int totalCardCount = deck.getTotalCardCount();
        int invalidColour = ContextCompat.getColor(getContext(), R.color.monsters);
        int defaultColour = ContextCompat.getColor(getContext(), R.color.textSecondary);

        mDeckTotalCards.setText(String.format(
                mDeckTotalCards.getContext().getString(R.string.deck_total_cards_value),
                totalCardCount, Deck.MAX_CARD_COUNT));
        mDeckTotalCards.setTextColor(
                totalCardCount < Deck.MIN_CARD_COUNT || totalCardCount > Deck.MAX_CARD_COUNT
                        ? invalidColour : defaultColour);

        int silverCardCount = deck.getSilverCardCount();
        mDeckSilver.setText(String.format(
                getContext().getString(R.string.deck_total_cards_value),
                silverCardCount, Deck.MAX_SILVER_COUNT));
        mDeckSilver.setTextColor(silverCardCount > Deck.MAX_SILVER_COUNT ? invalidColour : defaultColour);

        int goldCardCount = deck.getGoldCardCount();
        mDeckGold.setText(String.format(
                getContext().getString(R.string.deck_total_cards_value),
                goldCardCount, Deck.MAX_GOLD_COUNT));
        mDeckGold.setTextColor(goldCardCount > Deck.MAX_GOLD_COUNT ? invalidColour : defaultColour);
    }
}
{'fraction_non_alphanumeric': 0.09688876260832505, 'fraction_numerical': 0.0002841312686461145, 'mean_word_length': 3.367245657568238, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '983045', 'n_tokens_mistral': 2202, 'n_tokens_neox': 2114, 'n_words': 329}