// get experied date // Get Login State public boolean isExperied() { String storedDate = pref.getString(KEY_VALID_DATE, null); // String storedDate = "2015-10-15 15:30:33"; if (storedDate != null) { Date expDate = Utility.converStringToDate(storedDate, "yyyy-MM-dd kk:mm:ss"); return new Date().after(expDate); } return false; }
@Override public View getView(final int position, View convertView, ViewGroup parent) { View row = convertView; SmsInfoHolder holder = null; // // if (row == null){ LayoutInflater inflater = ((Activity) context).getLayoutInflater(); row = inflater.inflate(layoutResourceId, parent, false); holder = new SmsInfoHolder(); holder.lblSender = (TextView) row.findViewById(R.id.lblSenderName); holder.lblDate = (TextView) row.findViewById(R.id.lblDateTime); holder.btnApprove = (Button) row.findViewById(R.id.btnApprove); holder.btnDecline = (Button) row.findViewById(R.id.btnDeline); holder.txtMessage = (EditText) row.findViewById(R.id.txtMessage); final EditText textMessage = holder.txtMessage; final Button btnApproved = holder.btnApprove; final Button btnDecline = holder.btnDecline; btnDecline.setVisibility(View.GONE); btnApproved.setText("SEND"); row.setTag(holder); // } // else{ // // holder = (SmsInfoHolder)row.getTag(); // } final TongHopTatCa slSms = data.get(position); // slSms = data.get(position); holder.btnApprove.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { sendSMS(slSms.getPersonSdt(), textMessage.getText().toString(), position); // sendSMSFake(position); } }); holder.btnDecline.setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) {} }); DanhBa danhBa = null; if (slSms.getDlTinNhanNhanVe() != null) { danhBa = slSms.getDlTinNhanNhanVe().getDanhBa(); } else if (slSms.getDlTinNhanChuyenDi() != null) { danhBa = slSms.getDlTinNhanChuyenDi().getDanhBa(); } holder.lblSender.setText(danhBa == null ? slSms.getPersonSdt() : danhBa.getHoten()); holder.lblDate.setText("Unknow"); String smsGenerated = ""; smsGenerated += "Ngay: " + Utility.getTodayDate() + "\n"; // generate nhan ve body if (slSms.getDlTinNhanNhanVe() != null) smsGenerated += generateBody(slSms.getDlTinNhanNhanVe(), 0); if (slSms.getDlTinNhanNhanVe() != null && slSms.getDlTinNhanChuyenDi() != null) smsGenerated += "\n-\n"; if (slSms.getDlTinNhanChuyenDi() != null) { smsGenerated += generateBody(slSms.getDlTinNhanChuyenDi(), 1); } if (slSms.getDlTinNhanNhanVe() != null && slSms.getDlTinNhanChuyenDi() != null) { smsGenerated += "\nTong cong:\n"; double revelueMoney = slSms.getDlTinNhanNhanVe().getRevelueMoney() - slSms.getDlTinNhanChuyenDi().getRevelueMoney(); if (revelueMoney > 0) { smsGenerated += danhBa == null ? "BAN" : danhBa.getChitiet().getNgoi2(); smsGenerated += " bu cho "; smsGenerated += danhBa == null ? "MINH" : danhBa.getChitiet().getNgoi1(); smsGenerated += ": " + df.format(revelueMoney) + "n"; } else { smsGenerated += danhBa == null ? "MINH" : danhBa.getChitiet().getNgoi1(); smsGenerated += " bu cho "; smsGenerated += danhBa == null ? "BAN" : danhBa.getChitiet().getNgoi2(); smsGenerated += ": " + df.format(revelueMoney * -1) + "n"; } } holder.txtMessage.setText(smsGenerated); return row; }