Example usage for android.text.format Time FRIDAY

List of usage examples for android.text.format Time FRIDAY

Introduction

In this page you can find the example usage for android.text.format Time FRIDAY.

Prototype

int FRIDAY

To view the source code for android.text.format Time FRIDAY.

Click Source Link

Usage

From source file:Main.java

/**
 * Converts the day of the week from android.text.format.Time to java.util.Calendar
 *///w  ww.  ja  va 2s  .  co  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:com.android.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.
 *///from w ww .  j a v  a2 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;
    for (int i = 0, j = 6; j >= 0; i++, j--) {
        label = (TextView) mDayNamesHeader.getChildAt(j);
        if (i < mDaysPerWeek) {
            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);
            // }
            if (position == Time.FRIDAY) {
                label.setTextColor(mFridayColor);
            } else {
                label.setTextColor(mDayNameColor);
            }
        } else {
            label.setVisibility(View.GONE);
        }
    }
    mDayNamesHeader.invalidate();
}