@Override
  public void initShowDate(
      final ViewHolderUtil viewHolder, final Standard_CK_Table_Item t, int position) {
    viewHolder.setText(R.id.txt_item_description, t.getItem_description());

    if (t.getItem_repairType() != null && !t.getItem_repairType().equals("")) {
      if (t.getItem_repairType().equals("L")) {
        viewHolder.setText(R.id.txt_item_repairType, "限期整改");
        viewHolder.setTextColor(R.id.txt_item_repairType, Color.rgb(253, 113, 0));
        viewHolder.setText(R.id.txt_item_repairLimit, t.getItem_repairLimit());
        viewHolder.setTextColor(R.id.txt_item_repairLimit, Color.rgb(253, 113, 0));
      } else {
        viewHolder.setText(R.id.txt_item_repairType, "立即整改");
        viewHolder.setTextColor(R.id.txt_item_repairType, Color.RED);
        viewHolder.setText(R.id.txt_item_repairLimit, "无");
      }
    } else {
      viewHolder.setText(R.id.txt_item_repairLimit, "无");
      viewHolder.setText(R.id.txt_item_repairLimit, "无");
    }

    final RadioGroup rg_isok = (RadioGroup) viewHolder.getMconvertView().findViewById(R.id.rg_isok);
    final RadioButton rb_ck_stand_yes =
        (RadioButton) viewHolder.getMconvertView().findViewById(R.id.rb_ck_stand_yes);
    final RadioButton rb_ck_stand_no =
        (RadioButton) viewHolder.getMconvertView().findViewById(R.id.rb_ck_stand_no);
    rg_isok.setOnCheckedChangeListener(null);
    rg_isok.clearCheck();
    rb_ck_stand_yes.setTextColor(Color.parseColor("#FF7D899D"));
    rb_ck_stand_no.setTextColor(Color.parseColor("#FF7D899D"));

    viewHolder.setRadioButtonCkecked(R.id.rb_ck_stand_yes, false);
    viewHolder.setRadioButtonCkecked(R.id.rb_ck_stand_no, false);
    if (t.getItem_reviewResult() != null && !t.getItem_reviewResult().equals("")) {
      if (t.getItem_reviewResult().equals("YES")) {
        viewHolder.setRadioButtonCkecked(R.id.rb_ck_stand_yes, true);
        rb_ck_stand_yes.setTextColor(Color.parseColor("#28aae1"));
      } else {
        viewHolder.setRadioButtonCkecked(R.id.rb_ck_stand_no, true);
        rb_ck_stand_no.setTextColor(Color.parseColor("#28aae1"));
      }
    }

    RelativeLayout rel_standitem_measure = viewHolder.getView(R.id.rel_standitem_measure);
    rel_standitem_measure.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            // TODO Auto-generated method stub
            AlertDialog.Builder builder = new AlertDialog.Builder(mContext); // 先得到构造器
            builder.setTitle("整改措施"); // 设置标题
            builder.setMessage(t.getItem_repairMethod()); // 设置内容
            builder.setIcon(R.drawable.note_stand48); // 设置图标,图片id即可
            builder.setNegativeButton(
                "取消",
                new DialogInterface.OnClickListener() { // 设置取消按钮
                  @Override
                  public void onClick(DialogInterface dialog, int which) {
                    dialog.dismiss();
                  }
                });
            // 参数都设置完成了,创建并显示出来
            builder.create().show();
          }
        });

    RelativeLayout rel_standitem_condition = viewHolder.getView(R.id.rel_standitem_condition);
    rel_standitem_condition.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            // TODO Auto-generated method stub
            AlertDialog.Builder builder = new AlertDialog.Builder(mContext); // 先得到构造器
            builder.setTitle("整改情况"); // 设置标题
            builder.setMessage(t.getItem_repairCondition()); // 设置内容
            builder.setIcon(R.drawable.note_stand48); // 设置图标,图片id即可
            builder.setNegativeButton(
                "取消",
                new DialogInterface.OnClickListener() { // 设置取消按钮
                  @Override
                  public void onClick(DialogInterface dialog, int which) {
                    dialog.dismiss();
                  }
                });
            // 参数都设置完成了,创建并显示出来
            builder.create().show();
          }
        });

    rg_isok.setOnCheckedChangeListener(
        new OnCheckedChangeListener() {

          @Override
          public void onCheckedChanged(RadioGroup group, int checkedId) {
            // TODO Auto-generated method stub
            int radioButtonId = group.getCheckedRadioButtonId();
            RadioButton rb = (RadioButton) viewHolder.getMconvertView().findViewById(radioButtonId);

            rb_ck_stand_yes.setTextColor(Color.parseColor("#FF7D899D"));
            rb_ck_stand_no.setTextColor(Color.parseColor("#FF7D899D"));

            rb.setTextColor(Color.parseColor("#28aae1"));

            if (mApcceptOpinionListener != null) {
              switch (radioButtonId) {
                case R.id.rb_ck_stand_yes:
                  mApcceptOpinionListener.setItenApcceptOpinion(t, true);
                  break;
                case R.id.rb_ck_stand_no:
                  mApcceptOpinionListener.setItenApcceptOpinion(t, false);
                  break;
                default:
                  break;
              }
            }
          }
        });
  }
Exemplo n.º 2
0
  @Override
  public void initShowDate(ViewHolderUtil viewHolder, final Standard_CK_Table t, int position) {
    if (t != null) {
      LinearLayout.LayoutParams lp1 =
          new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
      viewHolder.setLayoutParams(R.id.item_left, lp1);
      LinearLayout.LayoutParams lp2 = new LayoutParams(mRightWidth, LayoutParams.MATCH_PARENT);
      viewHolder.setLayoutParams(R.id.item_right, lp2);

      // viewHolder.setImageResource(R.id.img_publishInfo,Integer.valueOf(t.getRemark()));
      viewHolder.setText(R.id.txt_ck_companyName, t.getCompanyName());
      viewHolder.setText(R.id.txt_ck_time, t.getCk_time());
      if (t.getIsExistDanger().equals("YES")) {
        viewHolder.setText(R.id.txt_ck_isExistDanger, "合格");
        viewHolder.setTextColor(R.id.txt_ck_isExistDanger, Color.GREEN);
        viewHolder.setText(R.id.txt_ck_deadLine, "无");
        viewHolder.setTextColor(R.id.txt_ck_deadLine, Color.GREEN);
      } else {
        viewHolder.setText(R.id.txt_ck_isExistDanger, "不合格");
        viewHolder.setTextColor(R.id.txt_ck_isExistDanger, Color.RED);
        if (t.getCk_deadLine() == null || t.getCk_deadLine().equals("")) {
          if (t.getCk_state().equals("CKING")
              || t.getCk_state().equals("CKEND")
              || t.getCk_state().equals("DOING")) {
            viewHolder.setText(R.id.txt_ck_deadLine, "无");
            viewHolder.setTextColor(R.id.txt_ck_deadLine, Color.GREEN);
          } else {
            viewHolder.setText(R.id.txt_ck_deadLine, "立即整改");
            viewHolder.setTextColor(R.id.txt_ck_deadLine, Color.RED);
          }
        } else {
          viewHolder.setText(R.id.txt_ck_deadLine, t.getCk_deadLine());
          viewHolder.setTextColor(R.id.txt_ck_deadLine, Color.rgb(254, 145, 3));
        }
      }

      switch (t.getCk_state()) {
        case "CKING":
          viewHolder.setText(R.id.txt_ck_state, "检查中");
          viewHolder.setTextColor(R.id.txt_ck_state, Color.rgb(119, 34, 129));
          break;
        case "CKEND":
          viewHolder.setText(R.id.txt_ck_state, "未处理");
          viewHolder.setTextColor(R.id.txt_ck_state, Color.rgb(119, 34, 129));
          break;
        case "DOING":
          viewHolder.setText(R.id.txt_ck_state, "处理中");
          viewHolder.setTextColor(R.id.txt_ck_state, Color.rgb(119, 34, 129));
          break;
        case "NONEED":
          viewHolder.setText(R.id.txt_ck_state, "无需整改");
          viewHolder.setTextColor(R.id.txt_ck_state, Color.GREEN);
          break;
        case "NOYET":
          viewHolder.setText(R.id.txt_ck_state, "未整改");
          viewHolder.setTextColor(R.id.txt_ck_state, Color.rgb(119, 34, 129));
          break;
        case "ING":
          viewHolder.setText(R.id.txt_ck_state, "整改中");
          viewHolder.setTextColor(R.id.txt_ck_state, Color.rgb(1, 19, 251));
          break;
        case "FINISH":
          viewHolder.setText(R.id.txt_ck_state, "申请复查");
          viewHolder.setTextColor(R.id.txt_ck_state, Color.rgb(119, 34, 129));
          break;
        case "REVIEWING":
          viewHolder.setText(R.id.txt_ck_state, "复查中");
          viewHolder.setTextColor(R.id.txt_ck_state, Color.rgb(119, 34, 129));
          break;
        case "REVIEWED":
          viewHolder.setText(R.id.txt_ck_state, "已复查");
          viewHolder.setTextColor(R.id.txt_ck_state, Color.rgb(119, 34, 129));
          break;
        case "RECORDED":
          viewHolder.setText(R.id.txt_ck_state, "已立案");
          viewHolder.setTextColor(R.id.txt_ck_state, Color.rgb(119, 34, 129));
          break;
        case "DESTORY":
          viewHolder.setText(R.id.txt_ck_state, "已销号");
          viewHolder.setTextColor(R.id.txt_ck_state, Color.GRAY);
          break;
        default:
          viewHolder.setText(R.id.txt_ck_state, "");
          break;
      }

      RelativeLayout item_right = viewHolder.getView(R.id.item_right);
      item_right.setOnClickListener(
          new OnClickListener() {

            @Override
            public void onClick(View v) {
              // TODO Auto-generated method stub
              if (mListener != null) {
                mListener.onRightItemClick(v, t);
              }
            }
          });
    }
  }