Added README.txt and GPL Header to Source Files
[DHBWCampusApp.git] / app / src / main / java / de / dhbwloe / campusapp / fragments / DashboardVorlesungsplan.java
index e67b364abc7cc9663cd69aa04b36233250c75285..ca143963801ef10ff0ab6bac04c6943acf8e7141 100644 (file)
@@ -1,6 +1,19 @@
+/* DashboardVorlesungsplan.java
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
 package de.dhbwloe.campusapp.fragments;
-
-
 import android.os.Build;
 import android.os.Bundle;
 import android.support.v4.app.Fragment;
@@ -44,7 +57,7 @@ public class DashboardVorlesungsplan extends CampusAppFragment {
         view = inflater.inflate(R.layout.fragment_dashboard_timetable, container, false);
         String kursTag = AppContext.getDatabaseManager().getRuntimeCache("CourseName");
         if(kursTag == null || kursTag.isEmpty()) {
-            return null;
+            return view;
         }
         courseName = kursTag;
         return view;
@@ -140,7 +153,7 @@ public class DashboardVorlesungsplan extends CampusAppFragment {
         Date date;
         TextView leftCol, rightCol = null;
         RelativeLayout.LayoutParams params;
-        SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm");
+        SimpleDateFormat dateFormat = new SimpleDateFormat(AppContext.getResString(R.string.timeformat_dashboard_vorlesungsplan_time));
         int firstLeftColId = 0;
 
         if(events.size() > 0) {
@@ -208,13 +221,10 @@ public class DashboardVorlesungsplan extends CampusAppFragment {
         else if(date1DayId == tomorrowDayId)
             datetext = AppContext.getResString(R.string.dashboard_calendar_tomorrow);
         else {
-            int weekdayResIds[] = new int[] { R.string.week_sunday, R.string.week_monday, R.string.week_tuesday, R.string.week_wednesday, R.string.week_thursday, R.string.week_friday, R.string.week_saturday };
-            Calendar cal = Calendar.getInstance();
-            cal.setTime(eventDate);
-            int dow = cal.get(Calendar.DAY_OF_WEEK);
-            SimpleDateFormat dateFormat = new SimpleDateFormat("dd.MM");
+            String dayStr = Tools.getWeekdayString(eventDate);
+            SimpleDateFormat dateFormat = new SimpleDateFormat(AppContext.getResString(R.string.timeformat_dashboard_vorlesungsplan_date));
 
-            datetext = AppContext.getResString(weekdayResIds[dow]) + ", " + dateFormat.format(eventDate);
+            datetext = dayStr + ", " + dateFormat.format(eventDate);
         }
         return datetext;
     }