Ejemplo n.º 1
0
    private View addLayout(final Info info) {
      View convertView;
      convertView = mInflater.inflate(R.layout.buy_lq_main_listview_item, null);
      final ViewHolder holder = new ViewHolder();
      TextView time = (TextView) convertView.findViewById(R.id.jc_main_list_item_text_time);
      TextView team = (TextView) convertView.findViewById(R.id.jc_main_list_item_text_team);
      TextView home = (TextView) convertView.findViewById(R.id.jc_main_list_item_text_team_name1);
      TextView away = (TextView) convertView.findViewById(R.id.jc_main_list_item_text_team_name2);
      TextView score = (TextView) convertView.findViewById(R.id.jc_main_list_item_text_team_score);
      TextView timeEnd = (TextView) convertView.findViewById(R.id.jc_main_list_item_text_time_end);
      final Button btnFail = (Button) convertView.findViewById(R.id.jc_main_list_item_button1);
      final Button btnWin = (Button) convertView.findViewById(R.id.jc_main_list_item_button3);
      final Button btnDan = (Button) convertView.findViewById(R.id.jc_main_list_item_button_dan);

      time.setText(
          info.getTime()
              + "  "
              + context.getString(R.string.jc_main_team_id_title)
              + info.getTeamId());
      team.setText(info.getTeam());
      home.setText(info.getAway() + "(客)");
      away.setText(info.getHome() + "(主)");
      timeEnd.setText(info.getTimeEnd());
      if (type == B_RF) {
        score.setText(info.getLetPoint());
        btnFail.setText("主负" + info.getLetFail());
        btnWin.setText("主胜" + info.getLetWin());
      } else if (type == B_DX) {
        btnFail.setText("大" + info.getBig());
        btnWin.setText("小" + info.getSmall());
        score.setText(info.getBasePoint());
      } else {
        btnFail.setText("主负" + info.getFail());
        btnWin.setText("主胜" + info.getWin());
      }
      if (info.isFail()) {
        btnFail.setBackgroundResource(R.drawable.jc_btn_b);
      } else {
        btnFail.setBackgroundResource(R.drawable.jc_btn);
      }
      if (info.isWin()) {
        btnWin.setBackgroundResource(R.drawable.jc_btn_b);
      } else {
        btnWin.setBackgroundResource(R.drawable.jc_btn);
      }
      btnFail.setOnClickListener(
          new OnClickListener() {
            @Override
            public void onClick(View v) {
              // TODO Auto-generated method stub
              if (info.onclikNum > 0 || isCheckTeam()) {
                info.setFail(!info.isFail());
                if (info.isFail()) {
                  info.onclikNum++;
                  btnFail.setBackgroundResource(R.drawable.jc_btn_b);
                } else {
                  info.onclikNum--;
                  btnFail.setBackgroundResource(R.drawable.jc_btn);
                }
                isNoDan(info, btnDan);
                setTeamNum();
              }
            }
          });
      btnWin.setOnClickListener(
          new OnClickListener() {
            @Override
            public void onClick(View v) {
              // TODO Auto-generated method stub
              if (info.onclikNum > 0 || isCheckTeam()) {
                info.setWin(!info.isWin());
                if (info.isWin()) {
                  info.onclikNum++;
                  btnWin.setBackgroundResource(R.drawable.jc_btn_b);
                } else {
                  info.onclikNum--;
                  btnWin.setBackgroundResource(R.drawable.jc_btn);
                }
                isNoDan(info, btnDan);
                setTeamNum();
              }
            }
          });
      if (isDanguan) {
        btnDan.setVisibility(Button.GONE);
      } else {
        btnDan.setVisibility(Button.VISIBLE);
        btnDan.setOnClickListener(
            new OnClickListener() {
              @Override
              public void onClick(View v) {
                // TODO Auto-generated method stub
                if (info.isDan()) {
                  info.setDan(false);
                  btnDan.setBackgroundResource(R.drawable.jc_btn);
                } else if (info.onclikNum > 0 && isDanCheckTeam() && isDanCheck()) {
                  info.setDan(true);
                  btnDan.setBackgroundResource(R.drawable.jc_btn_b);
                }
              }
            });
      }
      return convertView;
    }
Ejemplo n.º 2
0
    // add by yejc 20130402
    private View addView(final Info info) {
      View convertView = mInflater.inflate(R.layout.buy_jc_main_listview_item_others, null);
      TextView gameName = (TextView) convertView.findViewById(R.id.game_name);
      TextView gameDate = (TextView) convertView.findViewById(R.id.game_date);

      final TextView homeTeam = (TextView) convertView.findViewById(R.id.home_team_name);
      //			homeTeam.getPaint().setFakeBoldText(true);
      //			final TextView textVS = (TextView) convertView
      //					.findViewById(R.id.game_vs);
      //			if (!"".equals(info.getLetPoint()) && !"0".equals(info.getLetPoint())) {
      //				textVS.setText(info.getLetPoint());
      //			}
      final TextView guestTeam = (TextView) convertView.findViewById(R.id.guest_team_name);
      TextView btn = (Button) convertView.findViewById(R.id.jc_main_list_item_button);
      TextView analysis = (TextView) convertView.findViewById(R.id.game_analysis);
      final Button btnDan = (Button) convertView.findViewById(R.id.game_dan);

      gameName.setText(info.getTeam());
      String date =
          getWeek(info.getWeeks())
              + " "
              + info.getTeamId()
              + "\n"
              + PublicMethod.getEndTime(info.getTimeEnd())
              + " "
              + "(截)";
      gameDate.setText(date);
      homeTeam.setText(info.getHome());

      gameName.setOnClickListener(
          new View.OnClickListener() {

            @Override
            public void onClick(View v) {
              if (context instanceof JcMainActivity) {
                JcMainActivity activity = (JcMainActivity) context;
                activity.createTeamDialog();
              }
            }
          });

      // textVS.setText(info.getWin());
      guestTeam.setText(info.getAway());

      if (!info.getBtnStr().equals("")) {
        btn.setText(info.getBtnStr());
      }
      btn.setOnClickListener(
          new OnClickListener() {
            @Override
            public void onClick(View v) {
              if (info.onclikNum > 0 || isCheckTeam()) {
                info.createDialog(FootBF.titleStrs, true, info.getHome() + " VS " + info.getAway());
              }
              isNoDan(info, btnDan);
            }
          });
      if (isDanguan || isHunHe()) {
        btnDan.setVisibility(Button.GONE);
      } else {
        btnDan.setVisibility(Button.VISIBLE);
        btnDan.setOnClickListener(
            new OnClickListener() {
              @Override
              public void onClick(View v) {
                if (info.isDan()) {
                  info.setDan(false);
                  btnDan.setBackgroundResource(R.drawable.jc_btn);
                } else if (info.onclikNum > 0 && isDanCheckTeam() && isDanCheck()) {
                  info.setDan(true);
                  btnDan.setBackgroundResource(R.drawable.jc_btn_b);
                }
              }
            });
      }
      analysis.setOnClickListener(
          new OnClickListener() {
            @Override
            public void onClick(View v) {
              trunExplain(getEvent(Constants.JCFOOT, info), info.getHome(), info.getAway());
            }
          });

      /** add by pnegcx 20130624 start */
      if (info.isDan()) {
        btnDan.setBackgroundResource(R.drawable.jc_btn_b);
      } else {
        btnDan.setBackgroundResource(R.drawable.jc_btn);
      }
      /** add by pnegcx 20130624 end */
      return convertView;
    }