List of usage examples for android.text.format Time SATURDAY
int SATURDAY
To view the source code for android.text.format Time SATURDAY.
Click Source Link
From source file:Main.java
/** * Get first day of week as android.text.format.Time constant. * * @return the first day of week in android.text.format.Time *//*from w ww . j a va2 s.c om*/ public static int getFirstDayOfWeek(Context context) { int startDay = Calendar.SUNDAY; if (startDay == Calendar.SATURDAY) { return Time.SATURDAY; } else if (startDay == Calendar.MONDAY) { return Time.MONDAY; } else { return Time.SUNDAY; } }
From source file:Main.java
/** * Get first day of week as android.text.format.Time constant. * * @return the first day of week in android.text.format.Time *//* w w w . jav a 2 s . c o m*/ 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; } }
From source file:Main.java
/** * Converts the day of the week from android.text.format.Time to java.util.Calendar *//*from www. j a va2s .c o m*/ public static int convertDayOfWeekFromTimeToCalendar(int timeDayOfWeek) { switch (timeDayOfWeek) { case Time.MONDAY: return Calendar.MONDAY; case Time.TUESDAY: return Calendar.TUESDAY; case Time.WEDNESDAY: return Calendar.WEDNESDAY; case Time.THURSDAY: return Calendar.THURSDAY; case Time.FRIDAY: return Calendar.FRIDAY; case Time.SATURDAY: return Calendar.SATURDAY; case Time.SUNDAY: return Calendar.SUNDAY; default: throw new IllegalArgumentException("Argument must be between Time.SUNDAY and " + "Time.SATURDAY"); } }
From source file:Main.java
/** * Get first day of week as android.text.format.Time constant. * * @return the first day of week in android.text.format.Time *///from www. ja v a 2s . c o m public static int getFirstDayOfWeek(Context context) { int startDay = Calendar.getInstance().getFirstDayOfWeek(); if (startDay == Calendar.SATURDAY) { return Time.SATURDAY; } else if (startDay == Calendar.MONDAY) { return Time.MONDAY; } else { return Time.SUNDAY; } }
From source file:com.xandy.calendar.month.SimpleDayPickerFragment.java
/** * Fixes the day names header to provide correct spacing and updates the * label text. Override this to set up a custom header. *//* w w w .ja v a 2 s . c om*/ protected void updateHeader() { TextView label = (TextView) mDayNamesHeader.findViewById(R.id.wk_label); if (mShowWeekNumber) { label.setVisibility(View.VISIBLE); } else { label.setVisibility(View.GONE); } int offset = mFirstDayOfWeek - 1; for (int i = 1; i < 8; i++) { label = (TextView) mDayNamesHeader.getChildAt(i); if (i < mDaysPerWeek + 1) { int position = (offset + i) % 7; label.setText(mDayLabels[position]); label.setVisibility(View.VISIBLE); if (position == Time.SATURDAY) { label.setTextColor(mSaturdayColor); } else if (position == Time.SUNDAY) { label.setTextColor(mSundayColor); } else { label.setTextColor(mDayNameColor); } } else { label.setVisibility(View.GONE); } } mDayNamesHeader.invalidate(); }
From source file:de.tum.in.tumcampus.auxiliary.calendar.DayView.java
private void drawDayHeaderLoop(Rect r, Canvas canvas, Paint p) { p.setTypeface(mBold);/* w w w . j a v a 2s.c o m*/ p.setTextAlign(Align.RIGHT); int cell = mFirstJulianDay; String[] dayNames; if (mDateStrWidthLong < mCellWidth && mNumDays == 1) { dayNames = mDayStrsLong; } else if (mDateStrWidth < mCellWidth) { dayNames = mDayStrs; } else { dayNames = mDayStrs2Letter; } p.setAntiAlias(true); for (int day = 0; day < mNumDays; day++, cell++) { int dayOfWeek = day + mFirstVisibleDayOfWeek; if (dayOfWeek >= 14) { dayOfWeek -= 14; } int color = mCalendarDateBannerTextColor; if (mNumDays == 1) { if (dayOfWeek == Time.SATURDAY) { color = mWeek_saturdayColor; } else if (dayOfWeek == Time.SUNDAY) { color = mWeek_sundayColor; } } else { final int column = day % 7; if (DayUtils.isSaturday(column, mFirstDayOfWeek)) { color = mWeek_saturdayColor; } else if (DayUtils.isSunday(column, mFirstDayOfWeek)) { color = mWeek_sundayColor; } } p.setColor(color); if (mNumDays == 1) { Time time = new Time(); time.setJulianDay(mFirstJulianDay); String s = SimpleDateFormat.getDateInstance().format(new Date(time.toMillis(false))); drawDayHeader(dayNames[dayOfWeek], day, s, canvas, p); } else { int dateNum = mFirstVisibleDate + day; if (dateNum > mMonthLength) { dateNum -= mMonthLength; } drawDayHeader(dayNames[dayOfWeek], day, String.valueOf(dateNum), canvas, p); } } p.setTypeface(null); }