1 /*
2  * Copyright (C) 2013 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.datetimepicker.date;
18 
19 import android.content.Context;
20 import android.graphics.Canvas;
21 
22 import java.util.Calendar;
23 
24 class SimpleMonthView extends MonthView {
25 
SimpleMonthView(Context context)26     public SimpleMonthView(Context context) {
27         super(context);
28     }
29 
30     @Override
drawMonthDay(Canvas canvas, int year, int month, int day, int x, int y, int startX, int stopX, int startY, int stopY)31     public void drawMonthDay(Canvas canvas, int year, int month, int day,
32             int x, int y, int startX, int stopX, int startY, int stopY) {
33         if (mSelectedDay == day) {
34             canvas.drawCircle(x , y - (MINI_DAY_NUMBER_TEXT_SIZE / 3), DAY_SELECTED_CIRCLE_SIZE,
35                     mSelectedCirclePaint);
36         }
37 
38         // If we have a mindate or maxdate, gray out the day number if it's outside the range.
39         if (isOutOfRange(year, month, day)) {
40             mMonthNumPaint.setColor(mDisabledDayTextColor);
41         } else if (mHasToday && mToday == day) {
42             mMonthNumPaint.setColor(mTodayNumberColor);
43         } else {
44             mMonthNumPaint.setColor(mDayTextColor);
45         }
46         canvas.drawText(String.format("%d", day), x, y, mMonthNumPaint);
47     }
48 }
49