Skip to content

Commit

Permalink
Fixed daySeparatorColor and hourSeparatorColor
Browse files Browse the repository at this point in the history
  • Loading branch information
SapuSeven committed Nov 14, 2018
1 parent 833ec5f commit e649a2d
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ private void drawDaySeparators(float startPixel, Canvas canvas) {

for (int i = 0; i < days; i++) {
final float start = startPixel + widthPerDay * (i + 1);
canvas.drawLine(start, top, start, top + height, drawConfig.hourSeparatorPaint);
canvas.drawLine(start, top, start, top + height, drawConfig.daySeparatorPaint);
}
}

Expand Down
1 change: 1 addition & 0 deletions library/src/main/java/com/alamkanak/weekview/WeekView.java
Original file line number Diff line number Diff line change
Expand Up @@ -831,6 +831,7 @@ public int getDaySeparatorColor() {

public void setDaySeparatorColor(int daySeparatorColor) {
config.daySeparatorColor = daySeparatorColor;
config.drawingConfig.daySeparatorPaint.setColor(daySeparatorColor);
invalidate();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
import static java.util.Calendar.HOUR_OF_DAY;

class WeekViewDrawingConfig {

Paint timeTextPaint;
float timeTextWidth;
float timeTextHeight;
Expand All @@ -31,6 +31,7 @@ class WeekViewDrawingConfig {
float widthPerDay;
Paint dayBackgroundPaint;
Paint hourSeparatorPaint;
Paint daySeparatorPaint;
float headerMarginBottom;

Paint todayBackgroundPaint;
Expand All @@ -52,7 +53,7 @@ class WeekViewDrawingConfig {
int newHourHeight = -1;

DateTimeInterpreter dateTimeInterpreter;

WeekViewDrawingConfig(Context context, WeekViewConfig config) {
// Measure settings for time column.
timeTextPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
Expand Down Expand Up @@ -101,6 +102,12 @@ class WeekViewDrawingConfig {
hourSeparatorPaint.setStrokeWidth(config.hourSeparatorStrokeWidth);
hourSeparatorPaint.setColor(config.hourSeparatorColor);

// Prepare day separator color paint.
daySeparatorPaint = new Paint();
daySeparatorPaint.setStyle(Paint.Style.STROKE);
daySeparatorPaint.setStrokeWidth(config.daySeparatorStrokeWidth);
daySeparatorPaint.setColor(config.daySeparatorColor);

// Prepare the "now" line color paint
nowLinePaint = new Paint();
nowLinePaint.setStrokeWidth(config.nowLineStrokeWidth);
Expand Down Expand Up @@ -263,5 +270,5 @@ public String interpretTime(int hour) {
}
};
}

}

0 comments on commit e649a2d

Please sign in to comment.