2 * Copyright (C) 2009 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 package com.android.calendar;
19 import android.content.Context;
20 import android.graphics.Canvas;
21 import android.graphics.Paint;
22 import android.util.AttributeSet;
23 import android.widget.RelativeLayout;
25 import com.android.calendar.AgendaAdapter.ViewHolder;
28 * A custom layout for each item in the Agenda list view.
30 public class AgendaItemView extends RelativeLayout {
31 Paint mPaint = new Paint();
33 public AgendaItemView(Context context) {
37 public AgendaItemView(Context context, AttributeSet attrs) {
38 super(context, attrs);
42 protected void dispatchDraw(Canvas canvas) {
43 super.dispatchDraw(canvas);
44 ViewHolder holder = (ViewHolder) getTag();
46 /* Draw vertical color stripe */
47 mPaint.setColor(holder.calendarColor);
48 canvas.drawRect(0, 0, 5, getHeight(), mPaint);
50 /* Gray out item if the event was declined */
51 if (holder.overLayColor != 0) {
52 mPaint.setColor(holder.overLayColor);
53 canvas.drawRect(0, 0, getWidth(), getHeight(), mPaint);