示例#1
0
    // add by yejc 20130402
    private View addView(final Info info, final int index) {
      View convertView = mInflater.inflate(R.layout.buy_jc_main_listview_item_others, null);
      View divider = (View) convertView.findViewById(R.id.jc_main_divider_up);
      if (index == 0) {
        divider.setVisibility(View.VISIBLE);
      } else {
        divider.setVisibility(View.GONE);
      }
      TextView gameName = (TextView) convertView.findViewById(R.id.game_name);
      TextView gameNum = (TextView) convertView.findViewById(R.id.game_num);
      TextView gameDate = (TextView) convertView.findViewById(R.id.game_date);
      TextView gameTime = (TextView) convertView.findViewById(R.id.game_time);
      final TextView homeTeam = (TextView) convertView.findViewById(R.id.home_team_name);
      final TextView guestTeam = (TextView) convertView.findViewById(R.id.guest_team_name);

      final Button 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);
      final LinearLayout layout =
          (LinearLayout) convertView.findViewById(R.id.jc_play_detail_layout);

      gameName.setText(info.getTeam());
      String num = info.getTeamId();
      String date = PublicMethod.getTime(info.getTimeEnd());
      String time = PublicMethod.getEndTime(info.getTimeEnd()) + " " + "(截)";
      //			String date = getWeek(info.getWeeks()) + " " + info.getTeamId()
      //					+ "\n" + PublicMethod.getEndTime(info.getTimeEnd()) + " "
      //					+ "(截)";
      gameNum.setText(num);
      gameDate.setText(date);
      gameTime.setText(time);
      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();
              }
            }
          });
      guestTeam.setText(info.getAway());

      btn.setOnClickListener(
          new OnClickListener() {
            @Override
            public void onClick(View v) {
              LinearLayout detailLayout =
                  (LinearLayout) mFactory.inflate(R.layout.buy_jc_zq_bqc_layout, null);
              showLayout(layout, detailLayout, index, info, FootBQC.titleStrs, btn);
              isNoDan(info, btnDan);
            }
          });
      if (isDanguan) {
        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(android.R.color.transparent);
                  btnDan.setTextColor(black);
                } else if (info.onclikNum > 0 && isDanCheckTeam() && isDanCheck()) {
                  info.setDan(true);
                  btnDan.setBackgroundResource(R.drawable.jc_btn_b);
                  btnDan.setTextColor(white);
                }
              }
            });
      }
      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);
        btnDan.setTextColor(white);
      } else {
        btnDan.setBackgroundResource(android.R.color.transparent);
        btnDan.setTextColor(black);
      }
      /** add by pnegcx 20130624 end */
      return convertView;
    }
示例#2
0
 private View addLayout(final Info info) {
   View convertView;
   convertView = mInflater.inflate(R.layout.buy_jc_main_listview_item, null);
   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_vs);
   TextView timeEnd = (TextView) convertView.findViewById(R.id.jc_main_list_item_text_time_end);
   final Button btn1 = (Button) convertView.findViewById(R.id.jc_main_list_item_button1);
   final Button btn2 = (Button) convertView.findViewById(R.id.jc_main_list_item_button2);
   final Button btn3 = (Button) convertView.findViewById(R.id.jc_main_list_item_button3);
   final Button btnDan = (Button) convertView.findViewById(R.id.jc_main_list_item_button_dan);
   final Button btnXi = (Button) convertView.findViewById(R.id.buy_jc_main_list_item_btn_xi);
   time.setText(
       info.getTime()
           + "  "
           + context.getString(R.string.jc_main_team_id_title)
           + info.getTeamId());
   team.setText(info.getTeam());
   score.setText(info.getLetPoint());
   score.setTextColor(Color.BLUE);
   home.setText(info.getHome() + "(主)");
   away.setText(info.getAway() + "(客)");
   timeEnd.setText(info.getTimeEnd());
   btn1.setText("胜" + info.getWin());
   btn2.setText("平" + info.getLevel());
   btn3.setText("负" + info.getFail());
   if (info.isFail()) {
     btn3.setBackgroundResource(R.drawable.jc_btn_b);
   } else {
     btn3.setBackgroundResource(R.drawable.jc_btn);
   }
   if (info.isWin()) {
     btn1.setBackgroundResource(R.drawable.jc_btn_b);
   } else {
     btn1.setBackgroundResource(R.drawable.jc_btn);
   }
   if (info.isLevel()) {
     btn2.setBackgroundResource(R.drawable.jc_btn_b);
   } else {
     btn2.setBackgroundResource(R.drawable.jc_btn);
   }
   btn1.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++;
               btn1.setBackgroundResource(R.drawable.jc_btn_b);
             } else {
               info.onclikNum--;
               btn1.setBackgroundResource(R.drawable.jc_btn);
             }
             isNoDan(info, btnDan);
             setTeamNum();
           }
         }
       });
   btn2.setOnClickListener(
       new OnClickListener() {
         @Override
         public void onClick(View v) {
           // TODO Auto-generated method stub
           if (info.onclikNum > 0 || isCheckTeam()) {
             info.setLevel(!info.isLevel());
             if (info.isLevel()) {
               info.onclikNum++;
               btn2.setBackgroundResource(R.drawable.jc_btn_b);
             } else {
               info.onclikNum--;
               btn2.setBackgroundResource(R.drawable.jc_btn);
             }
             isNoDan(info, btnDan);
             setTeamNum();
           }
         }
       });
   btn3.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++;
               btn3.setBackgroundResource(R.drawable.jc_btn_b);
             } else {
               info.onclikNum--;
               btn3.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);
             }
           }
         });
   }
   btnXi.setVisibility(Button.VISIBLE);
   btnXi.setOnClickListener(
       new OnClickListener() {
         @Override
         public void onClick(View v) {
           // TODO Auto-generated method stub
           trunExplain(getEvent(Constants.JCFOOT, info), info.getHome(), info.getAway());
         }
       });
   return convertView;
 }