Example #1
0
  @Override
  public View getView(int position, View bankView, ViewGroup parent) {
    // set the rowview
    View rowView = bankView;
    // reuse views
    if (rowView == null) {
      // if the row view is not null then inflate for display
      LayoutInflater inflater =
          (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
      rowView = inflater.inflate(R.layout.password_bank_item, null);
    }

    // get the text views and set the values to the values in the list
    TextView username = (TextView) rowView.findViewById(R.id.value_username);
    TextView website = (TextView) rowView.findViewById(R.id.value_website);
    TextView password = (TextView) rowView.findViewById(R.id.value_password);
    TextView expiration = (TextView) rowView.findViewById(R.id.value_expires);

    username.setText(PasswordInfoArrayList.get(position).getUsername());
    website.setText(PasswordInfoArrayList.get(position).getWebsite());
    password.setText(PasswordInfoArrayList.get(position).getPassword());

    DateHelper expires = PasswordInfoArrayList.get(position).getExpiration();
    boolean expired = expires.isLaterThan(DateHelper.getCurrentDate());
    if (expired) {
      expiration.setTextColor(Color.RED);
    }
    String expStr = PasswordInfoArrayList.get(position).getExpiration().toString();
    expiration.setText(expStr);

    return rowView;
  }