Search in sources :

Example 1 with ChampionInGame

use of fr.neamar.lolgamedata.pojo.ChampionInGame in project teamward-client by Neamar.

the class PremadeTipHolder method drawChampions.

private void drawChampions(Team team) {
    LinearLayout linearLayout = team.teamId == 100 ? blueTeamLayout : redTeamLayout;
    int dpConversion = (int) itemView.getResources().getDimension(R.dimen.tip_premade_champion_thumbnail);
    int spConversion = (int) itemView.getResources().getDimension(R.dimen.tip_premade_champion_text_separator);
    // Clean up old views
    linearLayout.removeAllViews();
    for (List<Integer> subPremade : team.premades) {
        for (int summonerId : subPremade) {
            Player p = findPlayerById(team, summonerId);
            if (p == null) {
                continue;
            }
            ChampionInGame champion = p.champion;
            ImageView imageview = new ImageView(itemView.getContext());
            imageview.setImageResource(R.drawable.default_champion);
            imageview.setLayoutParams(new LinearLayout.LayoutParams(dpConversion, dpConversion));
            linearLayout.addView(imageview);
            ImageLoader.getInstance().displayImage(champion.imageUrl, imageview);
            imageview.setContentDescription(champion.name);
        }
        if (subPremade != team.premades.get(team.premades.size() - 1)) {
            TextView textView = new TextView(itemView.getContext());
            textView.setText("—");
            textView.setGravity(Gravity.CENTER);
            textView.setTextSize(spConversion);
            linearLayout.addView(textView);
        }
    }
}
Also used : Player(fr.neamar.lolgamedata.pojo.Player) ChampionInGame(fr.neamar.lolgamedata.pojo.ChampionInGame) TextView(android.widget.TextView) ImageView(android.widget.ImageView) LinearLayout(android.widget.LinearLayout)

Aggregations

ImageView (android.widget.ImageView)1 LinearLayout (android.widget.LinearLayout)1 TextView (android.widget.TextView)1 ChampionInGame (fr.neamar.lolgamedata.pojo.ChampionInGame)1 Player (fr.neamar.lolgamedata.pojo.Player)1