From c72dd3cf4021e5ff50a7535ebe80ad93a2cb8216 Mon Sep 17 00:00:00 2001 From: James Peterson Date: Wed, 19 Jan 2011 09:15:55 -0600 Subject: Updated Calendar to show colors on the MonthView Display added back the dna_empty icon and modified it a little bit to show a convex display a more 3D look updated the width of the bits for a little easier viewing Change-Id: Ib932bee555d57135ccfecda7724b570393b45bd6 --- res/drawable-hdpi/app_icon.png | Bin 5495 -> 5561 bytes res/drawable-hdpi/dna_empty.png | Bin 0 -> 2223 bytes res/drawable-mdpi/dna_empty.png | Bin 0 -> 1288 bytes src/com/android/calendar/MonthView.java | 15 +++++++++++---- 4 files changed, 11 insertions(+), 4 deletions(-) create mode 100644 res/drawable-hdpi/dna_empty.png create mode 100644 res/drawable-mdpi/dna_empty.png diff --git a/res/drawable-hdpi/app_icon.png b/res/drawable-hdpi/app_icon.png index d4cafaa1..8b6588e8 100644 Binary files a/res/drawable-hdpi/app_icon.png and b/res/drawable-hdpi/app_icon.png differ diff --git a/res/drawable-hdpi/dna_empty.png b/res/drawable-hdpi/dna_empty.png new file mode 100644 index 00000000..299980fa Binary files /dev/null and b/res/drawable-hdpi/dna_empty.png differ diff --git a/res/drawable-mdpi/dna_empty.png b/res/drawable-mdpi/dna_empty.png new file mode 100644 index 00000000..4d260509 Binary files /dev/null and b/res/drawable-mdpi/dna_empty.png differ diff --git a/src/com/android/calendar/MonthView.java b/src/com/android/calendar/MonthView.java index afee98b1..1f6769a0 100644 --- a/src/com/android/calendar/MonthView.java +++ b/src/com/android/calendar/MonthView.java @@ -32,6 +32,7 @@ import android.graphics.PorterDuff; import android.graphics.Rect; import android.graphics.RectF; import android.graphics.drawable.Drawable; +import android.graphics.drawable.BitmapDrawable; import android.os.Handler; import android.text.format.DateFormat; import android.text.format.DateUtils; @@ -71,7 +72,7 @@ public class MonthView extends View implements View.OnCreateContextMenuListener private static int EVENT_DOT_W_H = 10; private static int EVENT_NUM_DAYS = 31; private static int TEXT_TOP_MARGIN = 7; - private static int BUSY_BITS_WIDTH = 6; + private static int BUSY_BITS_WIDTH = 8; private static int BUSY_BITS_MARGIN = 4; private static int DAY_NUMBER_OFFSET = 10; @@ -907,7 +908,7 @@ public class MonthView extends View implements View.OnCreateContextMenuListener p.setColor(mMonthBgColor); p.setStyle(Style.FILL); - canvas.drawRect(rf, p); + canvas.drawRoundRect(rf, 6, 6, p); } for (int i = 0; i < numEvents; i++) { @@ -917,13 +918,19 @@ public class MonthView extends View implements View.OnCreateContextMenuListener } drawEventRect(rect, event, canvas, p); } + //Draw BusyBits backgrouind for 3D effect + Bitmap bmp=((BitmapDrawable) getResources().getDrawable(R.drawable.dna_empty) ).getBitmap(); + bmp = bmp.createScaledBitmap(bmp,BUSY_BITS_WIDTH,(rect.bottom - BUSY_BITS_MARGIN - top),false); + canvas.drawBitmap( bmp, left, top, p); } // Draw busybits for a single event private RectF drawEventRect(Rect rect, Event event, Canvas canvas, Paint p) { - p.setColor(mBusybitsColor); + //p.setColor(mBusybitsColor); + //Set Calendar Color + p.setColor(event.color); int left = rect.right - BUSY_BITS_MARGIN - BUSY_BITS_WIDTH; int bottom = rect.bottom - BUSY_BITS_MARGIN; @@ -935,7 +942,7 @@ public class MonthView extends View implements View.OnCreateContextMenuListener rf.left = left; rf.right = left + BUSY_BITS_WIDTH; - canvas.drawRect(rf, p); + canvas.drawRoundRect(rf, 4, 4, p); return rf; } -- cgit v1.2.3