Back to project page makler.
The source code is released under:
GNU General Public License
If you think the Android project makler listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package pl.net.newton.Makler.common; // w ww . ja v a 2 s.c o m import java.util.Calendar; import java.util.TimeZone; public final class GpwUtils { private static final TimeZone WARSAW_TIMEZONE = TimeZone.getTimeZone("Europe/Warsaw"); private GpwUtils() { } public static boolean gpwActive() { Calendar c = Calendar.getInstance(); c.setTimeZone(WARSAW_TIMEZONE); return !isWeekend(c) && workingHours(c); } public static boolean isOvertime(Calendar calendar) { if (calendar == null) { return false; } int hour = calendar.get(Calendar.HOUR_OF_DAY); int minute = calendar.get(Calendar.MINUTE); return hour == 17 && minute >= 20 && minute < 30; } private static boolean isWeekend(Calendar calendar) { int dayOfTheWeek = calendar.get(Calendar.DAY_OF_WEEK); return dayOfTheWeek == Calendar.SATURDAY || dayOfTheWeek == Calendar.SUNDAY; } private static boolean workingHours(Calendar calendar) { int hour = calendar.get(Calendar.HOUR_OF_DAY); int minute = calendar.get(Calendar.MINUTE); if (hour < 8 || hour > 17) { return false; } if (hour == 17 && minute > 50) { return false; } return true; } }