public View getView(final int arg0, View arg1, final ViewGroup arg2) {
// TODO Auto-generated method stub
final ViewHolder holder;
// i = arg0;
if (arg1 == null) {
holder = new ViewHolder();
arg1 = inflater.inflate(R.layout.agreement_track_list_item, null);
holder.cbTrack = (CheckBox) arg1.findViewById(R.id.cb_track);
holder.tvContractNode = (TextView) arg1
.findViewById(R.id.contract_node);
holder.tvContractTel = (TextView) arg1
.findViewById(R.id.contract_person_tel);
holder.tvContractData = (TextView) arg1
.findViewById(R.id.contract_datas);
holder.tvContractMemo = (TextView) arg1
.findViewById(R.id.contract_memo);
holder.tvContractPserson = (TextView) arg1
.findViewById(R.id.contract_person);
holder.fristView = (View) arg1.findViewById(R.id.id_view_first);
holder.endView = (View) arg1.findViewById(R.id.id_view_end);
holder.ivCirlce = (ImageView) arg1
.findViewById(R.id.iv_cirlce_process);
holder.btLook = (Button) arg1
.findViewById(R.id.bt_look_phone_number);
arg1.setTag(holder);
} else {
holder = (ViewHolder) arg1.getTag();
}
<span style="color:#ff0000;">if (map.get(arg0 + "") == null) {
map.put(arg0 + "", false);
}</span>
//此操作(得到imeOptions)用于button与textView的绑定,否则两者位置会错乱
//final int imeOptions = holder.btLook.getImeOptions();
//final int telOptions = holder.tvContractTel.getImeOptions();
holder.btLook.setTag(arg0);
holder.tvContractTel.setTag(arg0);
<span style="color:#ff0000;">holder.btLook.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
//if (imeOptions == telOptions) {
if(holder.btLook.getTag()==holder.tvContractTel.getTag()){
holder.btLook.setVisibility(View.GONE);
holder.tvContractTel.setVisibility(View.VISIBLE);
</span>map.put(arg0 + "", true);<span style="color:#ff0000;">
}
}
});
</span>
final AgreementList_Item agreementTrace = list.get(arg0);
// 第一次不出现view
if (arg0 == 0) {
holder.fristView.setVisibility(View.INVISIBLE);
} else {
holder.fristView.setVisibility(View.VISIBLE);
}
// 最后一条不出现view
if (arg0 == list.size() - 1) {
holder.endView.setVisibility(View.INVISIBLE);
} else {
holder.endView.setVisibility(View.VISIBLE);
}
// 合同当前状态
holder.tvContractNode.setText(agreementTrace.node);
// 操作人
if (!TextUtils.isEmpty(agreementTrace.usersid)) {
holder.tvContractPserson.setText(" " + agreementTrace.usersid);
} else {
holder.tvContractPserson.setText(" 暂无");
}
// 操作人电话
if (!TextUtils.isEmpty(agreementTrace.usertel.trim())) {
holder.tvContractTel.setText(" " + agreementTrace.usertel);
holder.tvContractTel.setTextColor(Color.BLUE);
holder.tvContractTel.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
Intent intent = new Intent(Intent.ACTION_DIAL, Uri
.parse("tel:" + agreementTrace.usertel));
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
ctx.startActivity(intent);
}
});
} else {
holder.tvContractTel.setText(" 暂无");
holder.tvContractTel.setTextColor(Color.BLACK);
}
// 当前状态是否完成
if ("1".equals(agreementTrace.isfinish)) {
holder.cbTrack.setChecked(true);
arg1.setBackgroundColor(Color.parseColor("#F3F3F3"));
holder.ivCirlce
.setBackgroundResource(R.drawable.shape_circle_style);
} else {
holder.cbTrack.setChecked(false);
arg1.setBackgroundColor(Color.WHITE);
holder.btLook.setVisibility(View.GONE);
holder.ivCirlce
.setBackgroundResource(R.drawable.shape_gray_circle_style);
}
// 合同追踪时间
// 格式化提交时间
String inputDatas = TimestampUtils
.StringDateFormat(agreementTrace.inputdates);
// 格式化完成时间
String finishDatas = TimestampUtils
.StringDateFormat(agreementTrace.redate);
// 设置时间
if (!TextUtils.isEmpty(inputDatas) && !TextUtils.isEmpty(finishDatas)) {
holder.tvContractData.setText(" "+finishDatas.split(" ")[0]);
} else {
holder.tvContractData.setText(" 暂无");
}
// 备注
if (!TextUtils.isEmpty(agreementTrace.memo)) {
String memo = agreementTrace.memo.replace("/", "");
holder.tvContractMemo.setText(" " + Html.fromHtml(memo));
} else {
holder.tvContractMemo.setText(" 暂无");
}
//此处对button的状态进行判断
<span style="color:#cc0000;">if (!map.get(arg0 + "")) {
holder.btLook.setVisibility(View.VISIBLE);
holder.tvContractTel.setVisibility(View.GONE);
} else {
holder.btLook.setVisibility(View.GONE);
holder.tvContractTel.setVisibility(View.VISIBLE);
}</span>