beta 0.1.1
[DHBWCampusApp.git] / app / src / main / java / de / dhbwloe / campusapp / fragments / VorlesungsplanUpcomingCourseListItem.java
index e706e3f334068022a22e98ce1479fa7493f2f27b..723579556c39a87440b98bd9a3520a255147d86f 100644 (file)
@@ -1,6 +1,7 @@
 package de.dhbwloe.campusapp.fragments;
 
 import android.content.Context;
+import android.os.Bundle;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.widget.TextView;
@@ -11,6 +12,7 @@ import java.util.Date;
 import de.dhbwloe.campusapp.CampusAppContext;
 import de.dhbwloe.campusapp.R;
 import de.dhbwloe.campusapp.vorlesungen.CourseEvent;
+import de.dhbwloe.campusapp.vorlesungen.CourseGroup;
 
 /**
  * Created by pk910 on 20.02.2016.
@@ -24,7 +26,15 @@ public class VorlesungsplanUpcomingCourseListItem {
 
     public void updateContainerView(View view) {
 
-        SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm");
+        android.support.v7.widget.CardView cardView = (android.support.v7.widget.CardView) view.findViewById(R.id.card_upcomingday);
+        cardView.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                onEventClicked();
+            }
+        });
+
+        SimpleDateFormat dateFormat = new SimpleDateFormat(CampusAppContext.getInstance().getResString(R.string.timeformat_vorlesungsplan_time));
         TextView timeFrom = (TextView) view.findViewById(R.id.timeFrom);
         TextView timeTo = (TextView) view.findViewById(R.id.timeTo);
         TextView location = (TextView) view.findViewById(R.id.location);
@@ -39,4 +49,13 @@ public class VorlesungsplanUpcomingCourseListItem {
         location.setText(event.getEventLocation());
         courseTitle.setText(event.getEventTitle());
     }
+
+    private void onEventClicked() {
+        Bundle args = new Bundle();
+        CourseGroup group = event.getCourseGroup();
+        if(group == null)
+            return;
+        args.putString("groupid", Integer.toString(group.getGroupId()));
+        CampusAppContext.getInstance().getNavigationManager().navigatePage("Vorlesungsplan", args);
+    }
 }