Java Code Examples for org.threeten.bp.DayOfWeek#getValue()

The following examples show how to use org.threeten.bp.DayOfWeek#getValue() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WeekDatePicker.java    From WeekDatePicker with MIT License 4 votes vote down vote up
private void remakeLayout() {

        if (getWidth() > 0)  {

            LocalDate day = getRelativeFirstDay(-1);

            for (int i = 0; i < layouts.length; i++) {

                String dayText = String.valueOf(day.getDayOfMonth());
                if (layouts[i] == null) {
                    layouts[i] = BoringLayout.make(dayText, dayTextPaint, dayWidth,
                            Layout.Alignment.ALIGN_CENTER, 1f, 1f, dayMetrics, false, ellipsize,
                            dayWidth);
                } else {
                    layouts[i].replaceOrMake(dayText, dayTextPaint, dayWidth,
                            Layout.Alignment.ALIGN_CENTER, 1f, 1f, dayMetrics, false, ellipsize,
                            dayWidth);
                }

                day = day.plusDays(1);
            }

            DayOfWeek dayOfWeek = firstDayOfWeek; // first index is 1
            for (int i = 0; i < dayLabelLayouts.length; i++) {

                CharSequence name;
                if (labelNames == null) {
                    name = dayOfWeek.getDisplayName(TextStyle.SHORT, Locale.getDefault());
                } else {
                    int index = dayOfWeek.getValue() - 1;
                    name = labelNames[index];
                }


                if (dayLabelLayouts[i] == null) {
                    dayLabelLayouts[i] = BoringLayout.make(name, dayLabelTextPain, dayWidth,
                            Layout.Alignment.ALIGN_CENTER, 1f, 1f, dayLabelMetrics, false, ellipsize,
                            dayWidth);
                } else {
                    dayLabelLayouts[i].replaceOrMake(name, dayLabelTextPain, dayWidth,
                            Layout.Alignment.ALIGN_CENTER, 1f, 1f, dayLabelMetrics, false, ellipsize,
                            dayWidth);
                }

                dayOfWeek = dayOfWeek.plus(1);

            }

        }

    }
 
Example 2
Source File: ArrayWeekDayFormatter.java    From material-calendarview with MIT License 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override public CharSequence format(final DayOfWeek dayOfWeek) {
  return weekDayLabels[dayOfWeek.getValue() - 1];
}
 
Example 3
Source File: TemporalAdjusters.java    From threetenbp with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
private DayOfWeekInMonth(int ordinal, DayOfWeek dow) {
    super();
    this.ordinal = ordinal;
    this.dowValue = dow.getValue();
}
 
Example 4
Source File: TemporalAdjusters.java    From threetenbp with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
private RelativeDayOfWeek(int relative, DayOfWeek dayOfWeek) {
    Jdk8Methods.requireNonNull(dayOfWeek, "dayOfWeek");
    this.relative = relative;
    this.dowValue = dayOfWeek.getValue();
}