1 /* VorlesungsplanExamsListAdapter.java
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
6 * (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 package de.dhbwloe.campusapp.fragments;
17 import android.content.Context;
18 import android.view.LayoutInflater;
19 import android.view.View;
20 import android.view.ViewGroup;
21 import android.widget.ArrayAdapter;
22 import android.widget.TextView;
24 import java.util.ArrayList;
26 import de.dhbwloe.campusapp.CampusAppContext;
27 import de.dhbwloe.campusapp.R;
30 * Created by pk910 on 27.02.2016.
32 public class VorlesungsplanExamsListAdapter extends ArrayAdapter<VorlesungsplanExamsListItem> {
33 private Context context;
34 private int layoutResourceId;
35 private ArrayList<VorlesungsplanExamsListItem> data = new ArrayList<VorlesungsplanExamsListItem>();
37 public VorlesungsplanExamsListAdapter(Context context, int layoutResourceId, ArrayList<VorlesungsplanExamsListItem> data) {
38 super(context, layoutResourceId, data);
39 this.layoutResourceId = layoutResourceId;
40 this.context = context;
45 public View getView(int position, View convertView, ViewGroup parent) {
46 View row = convertView;
47 RecordHolder holder = null;
50 LayoutInflater inflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
51 row = inflater.inflate(layoutResourceId, parent, false);
53 holder = new RecordHolder(row);
56 holder = (RecordHolder) row.getTag();
59 final VorlesungsplanExamsListAdapter that = this;
60 final VorlesungsplanExamsListItem item = data.get(position);
62 holder.groupName.setText(item.getGroupName());
63 holder.eventDate.setText(item.getEventDate());
64 holder.eventStart.setText(item.getEventStart());
65 holder.eventEnd.setText(item.getEventEnd());
66 holder.eventLocation.setText(item.getEventLocation());
71 static class RecordHolder {
74 TextView eventLocation;
78 public RecordHolder(View view) {
79 this.groupName = (TextView) view.findViewById(R.id.courseTitle);
80 this.eventDate = (TextView) view.findViewById(R.id.eventDate);
81 this.eventLocation = (TextView) view.findViewById(R.id.eventLocation);
82 this.eventStart = (TextView) view.findViewById(R.id.eventStart);
83 this.eventEnd = (TextView) view.findViewById(R.id.eventEnd);