alpha 0.0.1
[DHBWCampusApp.git] / app / src / main / java / de / dhbwloe / campusapp / fragments / VorlesungsplanUpcomingCourseListItem.java
1 package de.dhbwloe.campusapp.fragments;
2
3 import android.content.Context;
4 import android.view.LayoutInflater;
5 import android.view.View;
6 import android.widget.TextView;
7
8 import java.text.SimpleDateFormat;
9 import java.util.Date;
10
11 import de.dhbwloe.campusapp.CampusAppContext;
12 import de.dhbwloe.campusapp.R;
13 import de.dhbwloe.campusapp.vorlesungen.CourseEvent;
14
15 /**
16  * Created by pk910 on 20.02.2016.
17  */
18 public class VorlesungsplanUpcomingCourseListItem {
19     private CourseEvent event;
20
21     public VorlesungsplanUpcomingCourseListItem(CourseEvent event) {
22         this.event = event;
23     }
24
25     public void updateContainerView(View view) {
26
27         SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm");
28         TextView timeFrom = (TextView) view.findViewById(R.id.timeFrom);
29         TextView timeTo = (TextView) view.findViewById(R.id.timeTo);
30         TextView location = (TextView) view.findViewById(R.id.location);
31         TextView courseTitle = (TextView) view.findViewById(R.id.courseTitle);
32
33         Date dateFrom = (new Date(event.getEventFrom() * 1000));
34         timeFrom.setText(dateFormat.format(dateFrom));
35
36         Date dateTo = (new Date(event.getEventTo() * 1000));
37         timeTo.setText(dateFormat.format(dateTo));
38
39         location.setText(event.getEventLocation());
40         courseTitle.setText(event.getEventTitle());
41     }
42 }