@Override public void onClick(View v) { switch (v.getId()) { case R.id.backBtn: UpdatePwdActivity.this.finish(); break; case R.id.completeBtn: String pwd = pwdText.getText().toString().trim(); if (CommUtil.isBlank(pwd)) { Toast.makeText(UpdatePwdActivity.this, R.string.pwd_null_err, Toast.LENGTH_SHORT) .show(); } else if (pwd.length() < 6 || pwd.length() > 20) { Toast.makeText(UpdatePwdActivity.this, R.string.pwd_length_err, Toast.LENGTH_SHORT) .show(); } else if (!pwdText .getText() .toString() .trim() .equals(confirmPwdText.getText().toString().trim())) { Toast.makeText(UpdatePwdActivity.this, R.string.pwd_confirm_err, Toast.LENGTH_SHORT) .show(); } else { if (phone != null && code != null) { updatePwd(phone, code, pwd); } } break; } }
private void initView(String cont) { if (CommUtil.isBlank(cont)) { return; } String[] conts = cont.split(" *, *"); if (conts.length != 5) { Log.e(Constants.TAG, "指令长度不为10节,长度不对,指令内容:" + cont); return; } String[] time1 = formatTimeStr(conts[1].replaceAll(CmdType.CL.getType() + "=", "")); String[] time2 = formatTimeStr(conts[3]); startTimeTV.setText(time1[0]); endTimeTV.setText(time1[1]); startTimeTV1.setText(time2[0]); endTimeTV1.setText(time2[1]); int j = 2; checkTVOne1.setChecked(!"0".equals(conts[j].charAt(0) + "")); checkTVOne2.setChecked(!"0".equals(conts[j].charAt(1) + "")); checkTVOne3.setChecked(!"0".equals(conts[j].charAt(2) + "")); checkTVOne4.setChecked(!"0".equals(conts[j].charAt(3) + "")); checkTVOne5.setChecked(!"0".equals(conts[j].charAt(4) + "")); checkTVOne6.setChecked(!"0".equals(conts[j].charAt(5) + "")); checkTVOne7.setChecked(!"0".equals(conts[j].charAt(6) + "")); int i = 4; checkTV1.setChecked(!"0".equals(conts[i].charAt(0) + "")); checkTV2.setChecked(!"0".equals(conts[i].charAt(1) + "")); checkTV3.setChecked(!"0".equals(conts[i].charAt(2) + "")); checkTV4.setChecked(!"0".equals(conts[i].charAt(3) + "")); checkTV5.setChecked(!"0".equals(conts[i].charAt(4) + "")); checkTV6.setChecked(!"0".equals(conts[i].charAt(5) + "")); checkTV7.setChecked(!"0".equals(conts[i].charAt(6) + "")); }
@Override public View getView(int position, View view, ViewGroup parent) { ViewHolder holder; if (view == null) { LayoutInflater inflater = LayoutInflater.from(context); view = inflater.inflate(R.layout.warn_msg_item, null); holder = new ViewHolder(); holder.checkBox = (CheckBox) view.findViewById(R.id.check_msg); holder.msg = (TextView) view.findViewById(R.id.warn_msg); holder.wtime = (TextView) view.findViewById(R.id.warn_msg_wtime); holder.ctime = (TextView) view.findViewById(R.id.warn_msg_ctime); view.setTag(holder); } else { holder = (ViewHolder) view.getTag(); } // 获取消息实体类 PushMsg pushMsg = msgList.get(position); // 设置消息内容 holder.msg.setText(pushMsg.getMsg()); // 判断是否已读,0未读,1已读 if (pushMsg.getMsgState() == 0) { holder.msg.setTextColor(Color.BLACK); } else { holder.msg.setTextColor(readColor); } Long wtime = pushMsg.getUploadTime(); String wdt = wtime == null ? "" : CommUtil.getDateTime(new Date(wtime)); holder.wtime.setText(context.getString(R.string.warn_time) + wdt); Long time = pushMsg.getCreateTime(); String dt = time == null ? "" : CommUtil.getDateTime(new Date(time)); holder.ctime.setText(context.getString(R.string.receive_time) + dt); if (isSelecting) { holder.checkBox.setVisibility(View.VISIBLE); } else { holder.checkBox.setVisibility(View.GONE); } return view; }