Skip to content

Commit 1599e2f

Browse files
author
Jens Claes
committed
Merge branch 'pr-278' into develop
2 parents 09f9bde + 8567625 commit 1599e2f

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ Customization
9696

9797
You can customize the look of the `WeekView` in xml. Use the following attributes in xml. All these attributes also have getters and setters to enable you to change the style dynamically.
9898

99+
- `allDayEventHeight`
99100
- `columnGap`
100101
- `dayBackgroundColor`
101102
- `dayNameLength`

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ private enum Direction {
140140
private boolean mShowDistinctPastFutureColor = false;
141141
private boolean mHorizontalFlingEnabled = true;
142142
private boolean mVerticalFlingEnabled = true;
143-
private int mAllDayEventHeight= 100;
143+
private int mAllDayEventHeight = 100;
144144

145145
// Listeners.
146146
private EventClickListener mEventClickListener;
@@ -348,7 +348,7 @@ public WeekView(Context context, AttributeSet attrs, int defStyleAttr) {
348348
mShowNowLine = a.getBoolean(R.styleable.WeekView_showNowLine, mShowNowLine);
349349
mHorizontalFlingEnabled = a.getBoolean(R.styleable.WeekView_horizontalFlingEnabled, mHorizontalFlingEnabled);
350350
mVerticalFlingEnabled = a.getBoolean(R.styleable.WeekView_verticalFlingEnabled, mVerticalFlingEnabled);
351-
mAllDayEventHeight = a.getInt(R.styleable.WeekView_allDayEventHeight, mAllDayEventHeight);
351+
mAllDayEventHeight = a.getDimensionPixelSize(R.styleable.WeekView_allDayEventHeight, mAllDayEventHeight);
352352
} finally {
353353
a.recycle();
354354
}
@@ -486,9 +486,6 @@ private void initTextTimeWidth() {
486486
protected void onDraw(Canvas canvas) {
487487
super.onDraw(canvas);
488488

489-
// Hide everything in the first cell (top left corner).
490-
canvas.drawRect(0, 0, mTimeTextWidth + mHeaderColumnPadding * 2, mHeaderHeight + mHeaderRowPadding * 2, mHeaderBackgroundPaint);
491-
492489
// Draw the header row.
493490
drawHeaderRowAndEvents(canvas);
494491

@@ -711,6 +708,9 @@ else if (day.before(today)) {
711708
startPixel += mWidthPerDay + mColumnGap;
712709
}
713710

711+
// Hide everything in the first cell (top left corner).
712+
canvas.clipRect(0, 0, mTimeTextWidth + mHeaderColumnPadding * 2, mHeaderHeight + mHeaderRowPadding * 2, Region.Op.REPLACE);
713+
canvas.drawRect(0, 0, mTimeTextWidth + mHeaderColumnPadding * 2, mHeaderHeight + mHeaderRowPadding * 2, mHeaderBackgroundPaint);
714714

715715
// Clip to paint header row only.
716716
canvas.clipRect(mHeaderColumnWidth, 0, getWidth(), mHeaderHeight + mHeaderRowPadding * 2, Region.Op.REPLACE);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,6 @@
4949
<attr name="nowLineThickness" format="dimension"/>
5050
<attr name="horizontalFlingEnabled" format="boolean"/>
5151
<attr name="verticalFlingEnabled" format="boolean"/>
52-
<attr name="allDayEventHeight" format="integer"/>
52+
<attr name="allDayEventHeight" format="dimension"/>
5353
</declare-styleable>
5454
</resources>

0 commit comments

Comments
 (0)