diff options
author | Takaoka G. Tadashi <takaoka@google.com> | 2010-01-22 19:16:43 +0900 |
---|---|---|
committer | Takaoka G. Tadashi <takaoka@google.com> | 2010-01-22 19:24:53 +0900 |
commit | 56adc7b3f9e62ada7f3708c5c7228e8ac5af1755 (patch) | |
tree | 035919aa37ddfc80acc74e76fe64dd64c24be567 /src/com/android/calendar/Utils.java | |
parent | 646054713ee9cd4228b4bc0ef31d9549a1d04b05 (diff) | |
download | android_packages_apps_Calendar-56adc7b3f9e62ada7f3708c5c7228e8ac5af1755.tar.gz android_packages_apps_Calendar-56adc7b3f9e62ada7f3708c5c7228e8ac5af1755.tar.bz2 android_packages_apps_Calendar-56adc7b3f9e62ada7f3708c5c7228e8ac5af1755.zip |
Add color setting for Saturday and Sunday in month view
This also get the colors (in ja_JP locale) slightly lighter than before.
Bug: 1614177
Diffstat (limited to 'src/com/android/calendar/Utils.java')
-rw-r--r-- | src/com/android/calendar/Utils.java | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/com/android/calendar/Utils.java b/src/com/android/calendar/Utils.java index c282798b..f8c69f66 100644 --- a/src/com/android/calendar/Utils.java +++ b/src/com/android/calendar/Utils.java @@ -27,6 +27,8 @@ import android.text.format.Time; import android.view.animation.AlphaAnimation; import android.widget.ViewFlipper; +import java.util.Calendar; + public class Utils { public static void startActivity(Context context, String className, long time) { Intent intent = new Intent(Intent.ACTION_VIEW); @@ -121,4 +123,43 @@ public class Utils { time.minute = 0; time.hour = 0; } + + /** + * Get first day of week as android.text.format.Time constant. + * @return the first day of week in android.text.format.Time + */ + public static int getFirstDayOfWeek() { + int startDay = Calendar.getInstance().getFirstDayOfWeek(); + if (startDay == Calendar.SATURDAY) { + return Time.SATURDAY; + } else if (startDay == Calendar.MONDAY) { + return Time.MONDAY; + } else { + return Time.SUNDAY; + } + } + + /** + * Determine whether the column position is Saturday or not. + * @param column the column position + * @param firstDayOfWeek the first day of week in android.text.format.Time + * @return true if the column is Saturday position + */ + public static boolean isSaturday(int column, int firstDayOfWeek) { + return (firstDayOfWeek == Time.SUNDAY && column == 6) + || (firstDayOfWeek == Time.MONDAY && column == 5) + || (firstDayOfWeek == Time.SATURDAY && column == 0); + } + + /** + * Determine whether the column position is Sunday or not. + * @param column the column position + * @param firstDayOfWeek the first day of week in android.text.format.Time + * @return true if the column is Sunday position + */ + public static boolean isSunday(int column, int firstDayOfWeek) { + return (firstDayOfWeek == Time.SUNDAY && column == 0) + || (firstDayOfWeek == Time.MONDAY && column == 6) + || (firstDayOfWeek == Time.SATURDAY && column == 1); + } } |