Added README.txt and GPL Header to Source Files
[DHBWCampusApp.git] / app / src / main / java / de / dhbwloe / campusapp / fragments / VorlesungsplanExamsListItem.java
1 /* VorlesungsplanExamsListItem.java
2  *
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.
7  *
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.
12  *
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/>.
15  */
16 package de.dhbwloe.campusapp.fragments;
17 import java.text.SimpleDateFormat;
18 import java.util.Date;
19
20 import de.dhbwloe.campusapp.CampusAppContext;
21 import de.dhbwloe.campusapp.R;
22
23 /**
24  * Created by pk910 on 28.02.2016.
25  */
26 public class VorlesungsplanExamsListItem {
27     private int groupId;
28     private String courseName;
29     private String groupName;
30     private String eventLocation;
31     private long eventStart, eventEnd;
32     private int eventCount;
33
34     public VorlesungsplanExamsListItem(int groupid, String coursename, String groupname, String eventlocation, long eventstart, long eventend, int eventcount) {
35         groupId = groupid;
36         courseName = coursename;
37         groupName = groupname;
38         eventLocation = eventlocation;
39         eventStart = eventstart;
40         eventEnd = eventend;
41         eventCount = eventcount;
42     }
43
44     public int getGroupId() {
45         return groupId;
46     }
47
48     public String getCourseName() {
49         return courseName;
50     }
51
52     public String getGroupName() {
53         return groupName;
54     }
55
56     public String getEventLocation() {
57         return eventLocation;
58     }
59
60     public String getEventDate() {
61         if(eventStart == 0)
62             return null;
63         SimpleDateFormat dateFormat = new SimpleDateFormat(CampusAppContext.getInstance().getResString(R.string.timeformat_vorlesungsplan_date));
64         Date date = new Date(eventStart*1000);
65         return dateFormat.format(date);
66     }
67
68     public String getEventStart() {
69         if(eventStart == 0)
70             return null;
71         SimpleDateFormat dateFormat = new SimpleDateFormat(CampusAppContext.getInstance().getResString(R.string.timeformat_vorlesungsplan_time));
72         Date date = new Date(eventStart*1000);
73         return dateFormat.format(date);
74     }
75
76     public String getEventEnd() {
77         if(eventEnd == 0)
78             return null;
79         SimpleDateFormat dateFormat = new SimpleDateFormat(CampusAppContext.getInstance().getResString(R.string.timeformat_vorlesungsplan_time));
80         Date date = new Date(eventEnd*1000);
81         return dateFormat.format(date);
82     }
83
84     public int getEventCount() {
85         return eventCount;
86     }
87 }