2 * Copyright (C) 2013 Tobias Brunner
3 * Hochschule fuer Technik Rapperswil
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16 package org.strongswan.android.ui.adapter;
18 import java.util.List;
20 import org.strongswan.android.R;
21 import org.strongswan.android.logic.imc.RemediationInstruction;
23 import android.content.Context;
24 import android.view.LayoutInflater;
25 import android.view.View;
26 import android.view.ViewGroup;
27 import android.widget.ArrayAdapter;
28 import android.widget.TextView;
30 public class RemediationInstructionAdapter extends ArrayAdapter<RemediationInstruction>
32 public RemediationInstructionAdapter(Context context)
38 * Set new data for this adapter.
40 * @param data the new data (null to clear)
42 public void setData(List<RemediationInstruction> data)
52 public View getView(int position, View convertView, ViewGroup parent)
55 if (convertView != null)
61 LayoutInflater inflater = LayoutInflater.from(getContext());
62 view = inflater.inflate(R.layout.remediation_instruction_item, parent, false);
64 RemediationInstruction item = getItem(position);
65 TextView text = (TextView)view.findViewById(android.R.id.text1);
66 text.setText(item.getTitle());
67 text = (TextView)view.findViewById(android.R.id.text2);
68 text.setText(item.getDescription());