Skip to content

Commit 8678909

Browse files
Luca CastenettoLuca Castenetto
authored andcommitted
Allowed showFirstDayOfWeekFirst to be set on layout
1 parent 441ee53 commit 8678909

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

library/src/main/java/com/alamkanak/weekview/WeekView.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ private enum Direction {
9292
private boolean mIsZooming;
9393
private Calendar mFirstVisibleDay;
9494
private Calendar mLastVisibleDay;
95-
private boolean mshowFirstDayOfWeekFirst = false;
95+
private boolean mShowFirstDayOfWeekFirst = false;
9696
private int mDefaultEventColor;
9797
private int mMinimumFlingVelocity = 0;
9898
private int mScaledTouchSlop = 0;
@@ -318,6 +318,7 @@ public WeekView(Context context, AttributeSet attrs, int defStyleAttr) {
318318
mColumnGap = a.getDimensionPixelSize(R.styleable.WeekView_columnGap, mColumnGap);
319319
mHeaderColumnTextColor = a.getColor(R.styleable.WeekView_headerColumnTextColor, mHeaderColumnTextColor);
320320
mNumberOfVisibleDays = a.getInteger(R.styleable.WeekView_noOfVisibleDays, mNumberOfVisibleDays);
321+
mShowFirstDayOfWeekFirst = a.getBoolean(R.styleable.WeekView_showFirstDayOfWeekFirst, mShowFirstDayOfWeekFirst);
321322
mHeaderRowPadding = a.getDimensionPixelSize(R.styleable.WeekView_headerRowPadding, mHeaderRowPadding);
322323
mHeaderRowBackgroundColor = a.getColor(R.styleable.WeekView_headerRowBackgroundColor, mHeaderRowBackgroundColor);
323324
mDayBackgroundColor = a.getColor(R.styleable.WeekView_dayBackgroundColor, mDayBackgroundColor);
@@ -537,7 +538,7 @@ private void drawHeaderRowAndEvents(Canvas canvas) {
537538
mIsFirstDraw = false;
538539

539540
// If the week view is being drawn for the first time, then consider the first day of the week.
540-
if(mNumberOfVisibleDays >= 7 && today.get(Calendar.DAY_OF_WEEK) != mFirstDayOfWeek && mshowFirstDayOfWeekFirst) {
541+
if(mNumberOfVisibleDays >= 7 && today.get(Calendar.DAY_OF_WEEK) != mFirstDayOfWeek && mShowFirstDayOfWeekFirst) {
541542
int difference = (today.get(Calendar.DAY_OF_WEEK) - mFirstDayOfWeek);
542543
mCurrentOrigin.x += (mWidthPerDay + mColumnGap) * difference;
543544
}
@@ -1341,11 +1342,11 @@ public void setFirstDayOfWeek(int firstDayOfWeek) {
13411342
}
13421343

13431344
public boolean isShowFirstDayOfWeekFirst() {
1344-
return mshowFirstDayOfWeekFirst;
1345+
return mShowFirstDayOfWeekFirst;
13451346
}
13461347

13471348
public void setShowFirstDayOfWeekFirst(boolean show) {
1348-
mshowFirstDayOfWeekFirst = show;
1349+
mShowFirstDayOfWeekFirst = show;
13491350
}
13501351

13511352
public int getTextSize() {

library/src/main/res/values/attrs.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
<attr name="columnGap" format="dimension"/>
2121
<attr name="headerColumnTextColor" format="color"/>
2222
<attr name="noOfVisibleDays" format="integer"/>
23+
<attr name="showFirstDayOfWeekFirst" format="boolean"/>
2324
<attr name="headerRowBackgroundColor" format="color"/>
2425
<attr name="dayBackgroundColor" format="color"/>
2526
<attr name="hourSeparatorColor" format="color"/>

0 commit comments

Comments
 (0)