@@ -93,6 +93,7 @@ private enum Direction {
93
93
private boolean mIsZooming ;
94
94
private Calendar mFirstVisibleDay ;
95
95
private Calendar mLastVisibleDay ;
96
+ private boolean mShowFirstDayOfWeekFirst = false ;
96
97
private int mDefaultEventColor ;
97
98
private int mMinimumFlingVelocity = 0 ;
98
99
private int mScaledTouchSlop = 0 ;
@@ -319,6 +320,7 @@ public WeekView(Context context, AttributeSet attrs, int defStyleAttr) {
319
320
mColumnGap = a .getDimensionPixelSize (R .styleable .WeekView_columnGap , mColumnGap );
320
321
mHeaderColumnTextColor = a .getColor (R .styleable .WeekView_headerColumnTextColor , mHeaderColumnTextColor );
321
322
mNumberOfVisibleDays = a .getInteger (R .styleable .WeekView_noOfVisibleDays , mNumberOfVisibleDays );
323
+ mShowFirstDayOfWeekFirst = a .getBoolean (R .styleable .WeekView_showFirstDayOfWeekFirst , mShowFirstDayOfWeekFirst );
322
324
mHeaderRowPadding = a .getDimensionPixelSize (R .styleable .WeekView_headerRowPadding , mHeaderRowPadding );
323
325
mHeaderRowBackgroundColor = a .getColor (R .styleable .WeekView_headerRowBackgroundColor , mHeaderRowBackgroundColor );
324
326
mDayBackgroundColor = a .getColor (R .styleable .WeekView_dayBackgroundColor , mDayBackgroundColor );
@@ -564,8 +566,8 @@ private void drawHeaderRowAndEvents(Canvas canvas) {
564
566
mIsFirstDraw = false ;
565
567
566
568
// If the week view is being drawn for the first time, then consider the first day of the week.
567
- if (mNumberOfVisibleDays >= 7 && today .get (Calendar .DAY_OF_WEEK ) != mFirstDayOfWeek ) {
568
- int difference = 7 + (today .get (Calendar .DAY_OF_WEEK ) - mFirstDayOfWeek );
569
+ if (mNumberOfVisibleDays >= 7 && today .get (Calendar .DAY_OF_WEEK ) != mFirstDayOfWeek && mShowFirstDayOfWeekFirst ) {
570
+ int difference = (today .get (Calendar .DAY_OF_WEEK ) - mFirstDayOfWeek );
569
571
mCurrentOrigin .x += (mWidthPerDay + mColumnGap ) * difference ;
570
572
}
571
573
}
@@ -1418,6 +1420,14 @@ public void setFirstDayOfWeek(int firstDayOfWeek) {
1418
1420
invalidate ();
1419
1421
}
1420
1422
1423
+ public boolean isShowFirstDayOfWeekFirst () {
1424
+ return mShowFirstDayOfWeekFirst ;
1425
+ }
1426
+
1427
+ public void setShowFirstDayOfWeekFirst (boolean show ) {
1428
+ mShowFirstDayOfWeekFirst = show ;
1429
+ }
1430
+
1421
1431
public int getTextSize () {
1422
1432
return mTextSize ;
1423
1433
}
0 commit comments