use of com.cleveroad.testrecycler.models.AthleticModel in project FanLayoutManager by Cleveroad.
the class FullInfoTabFragment method onViewCreated.
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
toolbar.setTitle(sportCardModel.getSportTitle());
toolbar.setNavigationIcon(R.drawable.ic_back);
toolbar.setNavigationOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
getActivity().onBackPressed();
}
});
toolbar.setBackgroundColor(ContextCompat.getColor(getContext(), sportCardModel.getBackgroundColorResId()));
ivPhoto.setImageResource(sportCardModel.getImageResId());
List<AthleticModel> items = new ArrayList<>();
for (int i = 10; i > 0; i--) {
int points = i * 100;
items.add(new AthleticModel("Vae, mirabilis tumultumque", Country.ITALY, --points));
items.add(new AthleticModel("Cobaltums favere", Country.USA, --points));
items.add(new AthleticModel("Stella de peritus lixa", Country.ROK, --points));
}
ScoreAdapter scoreAdapter = new ScoreAdapter();
scoreAdapter.addItems(items);
rvAthletics.setAdapter(scoreAdapter);
rvAthletics.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.VERTICAL, false));
rvAthletics.setItemAnimator(new DefaultItemAnimator());
rvAthletics.addItemDecoration(new DividerItemDecoration(getContext()));
}
use of com.cleveroad.testrecycler.models.AthleticModel in project FanLayoutManager by Cleveroad.
the class ScoreAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(AthleticHolder holder, int position) {
AthleticModel item = mItems.get(position);
holder.tvAthleticName.setText(item.getName());
holder.tvCountry.setText(item.getCountry().getCountry());
holder.tvScore.setText(String.valueOf(item.getScore()));
switch(item.getCountry()) {
case USA:
{
holder.ivAthleticFlag.setImageResource(R.drawable.us_flag);
break;
}
case ROK:
{
holder.ivAthleticFlag.setImageResource(R.drawable.flag_korea);
break;
}
case ITALY:
{
holder.ivAthleticFlag.setImageResource(R.drawable.italy_flag);
break;
}
}
}
Aggregations