Example #1
0
 @Override
 public void onBindHeaderViewHolder(RecyclerView.ViewHolder holder, int position) {
   TextView matchDateTxtV = (TextView) holder.itemView.findViewById(R.id.matchDateTxtV);
   Match currMatch = this.getItem(position);
   String date = MyApplication.formatDateTime(currMatch.getDateTime())[0];
   matchDateTxtV.setText(date);
   matchDateTxtV.setTypeface(MyApplication.font);
 }
Example #2
0
  @Override
  public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {

    View convertView = holder.itemView;
    Match currMatch = this.getItem(position);
    final Team teamL = currMatch.getTeamL();
    final Team teamR = currMatch.getTeamR();

    TextView matchTimeTxtV = (TextView) convertView.findViewById(R.id.matchTimeTxtV);
    TextView matchTeamRTxtV = (TextView) convertView.findViewById(R.id.matchTeamRTxtV);
    TextView matchTeamLTxtV = (TextView) convertView.findViewById(R.id.matchTeamLTxtV);
    TextView matchReslutRTxtV = (TextView) convertView.findViewById(R.id.matchResultRTxtV);
    TextView matchResultLTxtV = (TextView) convertView.findViewById(R.id.matchResultLTxtV);
    ImageView teamLImgView = (ImageView) convertView.findViewById(R.id.matchTeamLImgV);
    ImageView teamRImgView = (ImageView) convertView.findViewById(R.id.matchTEamRImgV);
    TextView endMatchTxtV = (TextView) convertView.findViewById(R.id.matchEdnTxtV);
    TextView goingMatchtxtV = (TextView) convertView.findViewById(R.id.matchGoingTxtV);

    matchTimeTxtV.setTypeface(MyApplication.font);
    matchTeamRTxtV.setTypeface(MyApplication.font);
    matchTeamLTxtV.setTypeface(MyApplication.font);
    matchReslutRTxtV.setTypeface(MyApplication.font);
    matchResultLTxtV.setTypeface(MyApplication.font);
    endMatchTxtV.setTypeface(MyApplication.font);
    goingMatchtxtV.setTypeface(MyApplication.font);

    if (currMatch.matchProgress() < 0) {
      endMatchTxtV.setVisibility(View.VISIBLE);
      goingMatchtxtV.setVisibility(View.GONE);
    } else if (currMatch.matchProgress() == 0) {
      goingMatchtxtV.setVisibility(View.VISIBLE);
      endMatchTxtV.setVisibility(View.VISIBLE);
    } else {
      goingMatchtxtV.setVisibility(View.GONE);
      endMatchTxtV.setVisibility(View.GONE);
    }

    String time = MyApplication.formatDateTime(currMatch.getDateTime())[1];

    matchTimeTxtV.setText(time);
    matchTeamRTxtV.setText(teamR.getTeamName());

    matchReslutRTxtV.setText(currMatch.getResultR());
    matchResultLTxtV.setText(currMatch.getResultL());

    matchTeamLTxtV.setText(teamL.getTeamName());

    teamRImgView.setImageDrawable(ctx.getResources().getDrawable(teamR.getTeamLogo()));
    teamLImgView.setImageDrawable(ctx.getResources().getDrawable(teamL.getTeamLogo()));

    teamLImgView.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            Intent toTeamDetail = new Intent(ctx, TeamDetailsActivity.class);
            toTeamDetail.putExtra("TEAM_ID", teamL.getId());
            ctx.startActivity(toTeamDetail);
          }
        });

    teamRImgView.setOnClickListener(
        new View.OnClickListener() {
          @Override
          public void onClick(View v) {
            Intent toTeamDetail = new Intent(ctx, TeamDetailsActivity.class);
            toTeamDetail.putExtra("TEAM_ID", teamR.getId());
            ctx.startActivity(toTeamDetail);
          }
        });

    setAnimation(convertView, position);
  }