@@ -79,6 +79,11 @@ public class WeekView extends View {
79
79
private int mFetchedPeriod = -1 ; // the middle period the calendar has fetched.
80
80
private boolean mRefreshEvents = false ;
81
81
private Direction mCurrentFlingDirection = Direction .NONE ;
82
+ private ScaleGestureDetector mScaleDetector ;
83
+ private boolean mIsZooming ;
84
+ private Calendar mFirstVisibleDay ;
85
+ private Calendar mLastVisibleDay ;
86
+ private int mDefaultEventColor ;
82
87
83
88
// Attributes and their default values.
84
89
private int mHourHeight = 50 ;
@@ -101,7 +106,6 @@ public class WeekView extends View {
101
106
private int mFutureWeekendBackgroundColor = 0 ;
102
107
private int mNowLineColor = Color .rgb (102 , 102 , 102 );
103
108
private int mNowLineThickness = 5 ;
104
- private boolean mUseNewColoring = false ;
105
109
private int mHourSeparatorColor = Color .rgb (230 , 230 , 230 );
106
110
private int mTodayBackgroundColor = Color .rgb (239 , 247 , 254 );
107
111
private int mHourSeparatorHeight = 2 ;
@@ -110,20 +114,20 @@ public class WeekView extends View {
110
114
private int mEventTextColor = Color .BLACK ;
111
115
private int mEventPadding = 8 ;
112
116
private int mHeaderColumnBackgroundColor = Color .WHITE ;
113
- private int mDefaultEventColor ;
114
117
private boolean mIsFirstDraw = true ;
115
118
private boolean mAreDimensionsInvalid = true ;
116
119
@ Deprecated private int mDayNameLength = LENGTH_LONG ;
117
120
private int mOverlappingEventGap = 0 ;
118
121
private int mEventMarginVertical = 0 ;
119
122
private float mXScrollingSpeed = 1f ;
120
- private Calendar mFirstVisibleDay ;
121
- private Calendar mLastVisibleDay ;
122
123
private Calendar mScrollToDay = null ;
123
124
private double mScrollToHour = -1 ;
124
- private ScaleGestureDetector mScaleDetector ;
125
- private boolean mIsZooming ;
126
125
private int mEventCornerRadius = 0 ;
126
+ private boolean mUseDifferentPastBackgroundColor = false ;
127
+ private boolean mUseDifferentFutureWeekendBackgroundColor = false ;
128
+ private boolean mShowDistinctWeekendColor = false ;
129
+ private boolean mShowNowLine = false ;
130
+ private boolean mShowDistinctPastFutureColor = false ;
127
131
128
132
// Listeners.
129
133
private EventClickListener mEventClickListener ;
@@ -284,7 +288,6 @@ public WeekView(Context context, AttributeSet attrs, int defStyleAttr) {
284
288
mPastWeekendBackgroundColor = a .getColor (R .styleable .WeekView_pastWeekendBackgroundColor , mPastBackgroundColor );
285
289
mNowLineColor = a .getColor (R .styleable .WeekView_nowLineColor , mNowLineColor );
286
290
mNowLineThickness = a .getDimensionPixelSize (R .styleable .WeekView_nowLineThickness , mNowLineThickness );
287
- mUseNewColoring = a .getBoolean (R .styleable .WeekView_useNewColoringStyle , mUseNewColoring );
288
291
mHourSeparatorColor = a .getColor (R .styleable .WeekView_hourSeparatorColor , mHourSeparatorColor );
289
292
mTodayBackgroundColor = a .getColor (R .styleable .WeekView_todayBackgroundColor , mTodayBackgroundColor );
290
293
mHourSeparatorHeight = a .getDimensionPixelSize (R .styleable .WeekView_hourSeparatorHeight , mHourSeparatorHeight );
@@ -298,6 +301,10 @@ public WeekView(Context context, AttributeSet attrs, int defStyleAttr) {
298
301
mEventMarginVertical = a .getDimensionPixelSize (R .styleable .WeekView_eventMarginVertical , mEventMarginVertical );
299
302
mXScrollingSpeed = a .getFloat (R .styleable .WeekView_xScrollingSpeed , mXScrollingSpeed );
300
303
mEventCornerRadius = a .getDimensionPixelSize (R .styleable .WeekView_eventCornerRadius , mEventCornerRadius );
304
+ mShowDistinctPastFutureColor = a .getBoolean (R .styleable .WeekView_showDistinctPastFutureColor , mShowDistinctPastFutureColor );
305
+ mShowDistinctWeekendColor = a .getBoolean (R .styleable .WeekView_showDistinctWeekendColor , mShowDistinctWeekendColor );
306
+ mShowNowLine = a .getBoolean (R .styleable .WeekView_showNowLine , mShowNowLine );
307
+
301
308
} finally {
302
309
a .recycle ();
303
310
}
@@ -568,10 +575,10 @@ else if (mNewHourHeight > mMaxHourHeight)
568
575
// Draw background color for each day.
569
576
float start = (startPixel < mHeaderColumnWidth ? mHeaderColumnWidth : startPixel );
570
577
if (mWidthPerDay + startPixel - start > 0 ){
571
- if (mUseNewColoring ){
572
- boolean isWeekend = ( day .get (Calendar .DAY_OF_WEEK ) == Calendar .SATURDAY || day .get (Calendar .DAY_OF_WEEK ) == Calendar .SUNDAY ) ;
573
- Paint pastPaint = isWeekend ? mPastWeekendBackgroundPaint : mPastBackgroundPaint ;
574
- Paint futurePaint = isWeekend ? mFutureWeekendBackgroundPaint : mFutureBackgroundPaint ;
578
+ if (mShowDistinctPastFutureColor ){
579
+ boolean isWeekend = day .get (Calendar .DAY_OF_WEEK ) == Calendar .SATURDAY || day .get (Calendar .DAY_OF_WEEK ) == Calendar .SUNDAY ;
580
+ Paint pastPaint = isWeekend && mShowDistinctWeekendColor ? mPastWeekendBackgroundPaint : mPastBackgroundPaint ;
581
+ Paint futurePaint = isWeekend && mShowDistinctWeekendColor ? mFutureWeekendBackgroundPaint : mFutureBackgroundPaint ;
575
582
float startY = mHeaderTextHeight + mHeaderRowPadding * 2 + mTimeTextHeight /2 + mHeaderMarginBottom + mCurrentOrigin .y ;
576
583
577
584
if (sameDay ){
@@ -612,7 +619,7 @@ else if (day.before(today)) {
612
619
drawEvents (day , startPixel , canvas );
613
620
614
621
// Draw the line at the current time.
615
- if (mUseNewColoring && sameDay ){
622
+ if (mShowNowLine && sameDay ){
616
623
float startY = mHeaderTextHeight + mHeaderRowPadding * 2 + mTimeTextHeight /2 + mHeaderMarginBottom + mCurrentOrigin .y ;
617
624
Calendar now = Calendar .getInstance ();
618
625
float beforeNow = (now .get (Calendar .HOUR_OF_DAY ) + now .get (Calendar .MINUTE )/60.0f ) * mHourHeight ;
0 commit comments