+/* Tools.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;
import android.view.View;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
+import java.util.Calendar;
+import java.util.Date;
import javax.crypto.Cipher;
import javax.crypto.spec.SecretKeySpec;
}
}
+ public static String getWeekdayString(long date) {
+ return getWeekdayString(date, true);
+ }
+
+ public static String getWeekdayString(long date, boolean fullString) {
+ return getWeekdayString(new Date(date * 1000), fullString);
+ }
+
+ public static String getWeekdayString(Date date) {
+ return getWeekdayString(date, true);
+ }
+
+ public static String getWeekdayString(Date date, boolean fullString) {
+ int weekdayResIds[];
+ if(fullString)
+ 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 };
+ else
+ weekdayResIds = new int[] { R.string.week_sunday_short, R.string.week_monday_short, R.string.week_tuesday_short, R.string.week_wednesday_short, R.string.week_thursday_short, R.string.week_friday_short, R.string.week_saturday_short };
+ Calendar cal = Calendar.getInstance();
+ cal.setTime(date);
+ int dow = cal.get(Calendar.DAY_OF_WEEK);
+ int weekdayResId = weekdayResIds[dow-1];
+ return CampusAppContext.getInstance().getResString(weekdayResId);
+ }
+
}