1 /* VorlesungsplanUpcomingCourseListItem.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.os.Bundle;
19 import android.view.LayoutInflater;
20 import android.view.View;
21 import android.widget.TextView;
23 import java.text.SimpleDateFormat;
24 import java.util.Date;
26 import de.dhbwloe.campusapp.CampusAppContext;
27 import de.dhbwloe.campusapp.R;
28 import de.dhbwloe.campusapp.vorlesungen.CourseEvent;
29 import de.dhbwloe.campusapp.vorlesungen.CourseGroup;
32 * Created by pk910 on 20.02.2016.
34 public class VorlesungsplanUpcomingCourseListItem {
35 private CourseEvent event;
37 public VorlesungsplanUpcomingCourseListItem(CourseEvent event) {
41 public void updateContainerView(View view) {
43 android.support.v7.widget.CardView cardView = (android.support.v7.widget.CardView) view.findViewById(R.id.card_upcomingday);
44 cardView.setOnClickListener(new View.OnClickListener() {
46 public void onClick(View v) {
51 SimpleDateFormat dateFormat = new SimpleDateFormat(CampusAppContext.getInstance().getResString(R.string.timeformat_vorlesungsplan_time));
52 TextView timeFrom = (TextView) view.findViewById(R.id.timeFrom);
53 TextView timeTo = (TextView) view.findViewById(R.id.timeTo);
54 TextView location = (TextView) view.findViewById(R.id.location);
55 TextView courseTitle = (TextView) view.findViewById(R.id.courseTitle);
57 Date dateFrom = (new Date(event.getEventFrom() * 1000));
58 timeFrom.setText(dateFormat.format(dateFrom));
60 Date dateTo = (new Date(event.getEventTo() * 1000));
61 timeTo.setText(dateFormat.format(dateTo));
63 location.setText(event.getEventLocation());
64 courseTitle.setText(event.getEventTitle());
67 private void onEventClicked() {
68 Bundle args = new Bundle();
69 CourseGroup group = event.getCourseGroup();
72 args.putString("groupid", Integer.toString(group.getGroupId()));
73 CampusAppContext.getInstance().getNavigationManager().navigatePage("Vorlesungsplan", args);