2 * Copyright (C) 2012 Tobias Brunner
4 * Copyright (C) secunet Security Networks AG
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 package org
.strongswan
.android
.ui
.adapter
;
19 import java
.util
.List
;
21 import org
.strongswan
.android
.R
;
22 import org
.strongswan
.android
.security
.TrustedCertificateEntry
;
24 import android
.content
.Context
;
25 import android
.view
.LayoutInflater
;
26 import android
.view
.View
;
27 import android
.view
.ViewGroup
;
28 import android
.widget
.ArrayAdapter
;
29 import android
.widget
.TextView
;
31 public class TrustedCertificateAdapter
extends ArrayAdapter
<TrustedCertificateEntry
>
33 public TrustedCertificateAdapter(Context context
)
35 super(context
, R
.layout
.trusted_certificates_item
);
39 * Set new data for this adapter.
41 * @param data the new data (null to clear)
43 public void setData(List
<TrustedCertificateEntry
> data
)
53 public View
getView(int position
, View convertView
, ViewGroup parent
)
56 if (convertView
!= null)
62 LayoutInflater inflater
= LayoutInflater
.from(getContext());
63 view
= inflater
.inflate(R
.layout
.trusted_certificates_item
, parent
, false);
65 TrustedCertificateEntry item
= getItem(position
);
66 TextView text
= (TextView
)view
.findViewById(R
.id
.subject_primary
);
67 text
.setText(item
.getSubjectPrimary());
68 text
= (TextView
)view
.findViewById(R
.id
.subject_secondary
);
69 text
.setText(item
.getSubjectSecondary());