diff --git a/res/values/colors.xml b/res/values/colors.xml index 5d198b755..2be55adc5 100644 --- a/res/values/colors.xml +++ b/res/values/colors.xml @@ -77,7 +77,7 @@ #FFFFFFFF #FF000000 - #FF555555 + #FFBFBFBF #FF000000 #FF999999 #41c3b1 diff --git a/src/com/android/calendar/month/MonthWeekEventsView.java b/src/com/android/calendar/month/MonthWeekEventsView.java index 5f4465ab5..6a4f6da81 100644 --- a/src/com/android/calendar/month/MonthWeekEventsView.java +++ b/src/com/android/calendar/month/MonthWeekEventsView.java @@ -46,6 +46,7 @@ import android.text.format.DateUtils; import android.text.format.Time; import android.util.Log; +import android.util.TypedValue; import android.view.MotionEvent; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityManager; @@ -59,6 +60,8 @@ import java.util.ListIterator; import java.util.Locale; +import android.graphics.RectF; + import ws.xsoh.etar.R; public class MonthWeekEventsView extends SimpleWeekView { @@ -161,6 +164,18 @@ public class MonthWeekEventsView extends SimpleWeekView { private ObjectAnimator mTodayAnimator = null; private int[] mDayXs; + private static int EVENT_RECT_ROUNDING = 5; + private static int EVENT_RECT_ALLDAY_ROUNDING = 2; + private static int EVENT_RECT_MARGIN_LEFT = 5; + private static int EVENT_RECT_MARGIN_RIGHT = 2; + private static int EVENT_RECT_MARGIN_TOP = 5; + private static int EVENT_RECT_MARGIN_BOTTOM = 5; + + private static int EVENT_RECT_TEXT_MARGIN_LEFT = 15; + private static int EVENT_RECT_TEXT_MARGIN_RIGHT = 5; + private static int EVENT_RECT_TEXT_MARGIN_TOP= 10; + private static int EVENT_RECT_TEXT_MARGIN_BOTTOM = 10; + /** * Shows up as an error if we don't include this. */ @@ -321,7 +336,7 @@ protected void initView() { mMonthNumHeight = (int) (mMonthNumPaint.descent() - mMonthNumPaint.ascent() + 0.5f); mEventPaint = new TextPaint(); - mEventPaint.setFakeBoldText(true); + mEventPaint.setFakeBoldText(false); mEventPaint.setAntiAlias(true); mEventPaint.setTextSize(mTextSizeEventTitle); mEventPaint.setColor(mMonthEventColor); @@ -331,7 +346,7 @@ protected void initView() { mFramedEventPaint = new TextPaint(mSolidBackgroundEventPaint); mDeclinedEventPaint = new TextPaint(); - mDeclinedEventPaint.setFakeBoldText(true); + mDeclinedEventPaint.setFakeBoldText(false); mDeclinedEventPaint.setAntiAlias(true); mDeclinedEventPaint.setTextSize(mTextSizeEventTitle); mDeclinedEventPaint.setColor(mMonthDeclinedEventColor); @@ -592,6 +607,10 @@ private void drawClick(Canvas canvas) { } } + /** + * This draws the weeknumber or the daynumber, depending on the view. + * @param canvas The canvas to draw on + */ @Override protected void drawWeekNums(Canvas canvas) { int y; @@ -618,6 +637,10 @@ protected void drawWeekNums(Canvas canvas) { boolean isBold = false; mMonthNumPaint.setColor(isFocusMonth ? mMonthNumColor : mMonthNumOtherColor); + float twelveDp = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 16, + getResources().getDisplayMetrics()); + mMonthNumPaint.setTextSize(twelveDp); + // Get the julian monday used to show the lunar info. int julianMonday = Utils.getJulianMondayFromWeeksSinceEpoch(mWeek); Time time = new Time(mTimeZone); @@ -1535,11 +1558,24 @@ protected void drawEventRectangle(Canvas canvas, int day) { mBoundaries.setRectangle(mFormat.getDaySpan(day), mFormat.getEventLines()); mEventSquarePaint.setStyle(getRectanglePaintStyle()); mEventSquarePaint.setColor(getRectangleColor()); - canvas.drawRect(r, mEventSquarePaint); + + if(mEvent.allDay){ + r.left += EVENT_RECT_MARGIN_LEFT; + r.right -= EVENT_RECT_MARGIN_RIGHT; + r.top += EVENT_RECT_MARGIN_TOP; + r.bottom += EVENT_RECT_MARGIN_BOTTOM+EVENT_RECT_TEXT_MARGIN_BOTTOM; + canvas.drawRoundRect(new RectF(r), EVENT_RECT_ALLDAY_ROUNDING, EVENT_RECT_ALLDAY_ROUNDING, mEventSquarePaint); + } else { + r.left += EVENT_RECT_MARGIN_LEFT; + r.right += EVENT_RECT_MARGIN_RIGHT; + r.top += EVENT_RECT_MARGIN_TOP+EVENT_RECT_TEXT_MARGIN_TOP; //both so that the bar aligns with the text + r.bottom += EVENT_RECT_TEXT_MARGIN_BOTTOM; + canvas.drawRoundRect(new RectF(r), EVENT_RECT_ROUNDING, EVENT_RECT_ROUNDING, mEventSquarePaint); + } } protected int getAvailableSpaceForText(int spanningDays) { - return mBoundaries.getTextRightEdge(spanningDays) - mBoundaries.getTextX(); + return mBoundaries.getTextRightEdge(spanningDays) - mBoundaries.getTextX() - EVENT_RECT_TEXT_MARGIN_RIGHT; } @Override @@ -1635,7 +1671,7 @@ protected void drawText(Canvas canvas, ViewDetailsPreferences.Preferences prefer lineText = baseText.subSequence(mTextLayout.getLineStart(i), mTextLayout.getLineEnd(i)); } - canvas.drawText(lineText.toString(), mBoundaries.getTextX(), mBoundaries.getTextY(), + canvas.drawText(lineText.toString(), mBoundaries.getTextX() + EVENT_RECT_TEXT_MARGIN_LEFT, mBoundaries.getTextY() + EVENT_RECT_TEXT_MARGIN_TOP, getTextPaint()); mBoundaries.moveLinesDown(1); }