Added README.txt and GPL Header to Source Files
[DHBWCampusApp.git] / app / src / main / java / de / dhbwloe / campusapp / fragments / VorlesungsplanGroupsListItem.java
index 01d6ee755eccb7cd7d9b78075814ae923d3ad1d8..ae0e1e2ae62cdd08dcb704223788234a194ffe05 100644 (file)
@@ -1,8 +1,25 @@
+/* VorlesungsplanGroupsListItem.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 java.text.SimpleDateFormat;
 import java.util.Date;
 
+import de.dhbwloe.campusapp.CampusAppContext;
+import de.dhbwloe.campusapp.R;
+
 /**
  * Created by pk910 on 20.02.2016.
  */
@@ -37,19 +54,25 @@ public class VorlesungsplanGroupsListItem {
     }
 
     public String getFirstEvent() {
-        SimpleDateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy HH:mm");
+        if(firstEvent == 0)
+            return null;
+        SimpleDateFormat dateFormat = new SimpleDateFormat(CampusAppContext.getInstance().getResString(R.string.timeformat_vorlesungsplan_fulldate));
         Date date = new Date(firstEvent*1000);
         return dateFormat.format(date);
     }
 
     public String getLastEvent() {
-        SimpleDateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy HH:mm");
+        if(lastEvent == 0)
+            return null;
+        SimpleDateFormat dateFormat = new SimpleDateFormat(CampusAppContext.getInstance().getResString(R.string.timeformat_vorlesungsplan_fulldate));
         Date date = new Date(lastEvent*1000);
         return dateFormat.format(date);
     }
 
     public String getNextEvent() {
-        SimpleDateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy HH:mm");
+        if(nextEvent == 0)
+            return null;
+        SimpleDateFormat dateFormat = new SimpleDateFormat(CampusAppContext.getInstance().getResString(R.string.timeformat_vorlesungsplan_fulldate));
         Date date = new Date(nextEvent*1000);
         return dateFormat.format(date);
     }
@@ -57,7 +80,7 @@ public class VorlesungsplanGroupsListItem {
     public String getNextKlausurEvent() {
         if(nextKlausurEvent == 0)
             return null;
-        SimpleDateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy HH:mm");
+        SimpleDateFormat dateFormat = new SimpleDateFormat(CampusAppContext.getInstance().getResString(R.string.timeformat_vorlesungsplan_fulldate));
         Date date = new Date(nextKlausurEvent*1000);
         return dateFormat.format(date);
     }