if (cards != null && cards.size() > 0) {
Rectangle rectangle = new Rectangle(Config.dimensions.frameWidth, Config.dimensions.frameHeight);
List<CardView> sortedCards = new ArrayList<>(cards.values());
switch (sortSetting.getSortBy()) {
case NAME:
comparator = new CardViewNameComparator();
break;
case RARITY:
comparator = new CardViewRarityComparator();
break;
case COLOR:
comparator = new CardViewColorComparator();
break;
case COLOR_DETAILED:
comparator = new CardViewColorDetailedComparator();
break;
case CASTING_COST:
comparator = new CardViewCostComparator();
break;
}
if(comparator != null){
Collections.sort(sortedCards, new CardViewNameComparator());
Collections.sort(sortedCards, comparator);
}
CardView lastCard = null;
for (CardView card: sortedCards) {
if (sortSetting.isPilesToggle()) {