Skip to content

Commit

Permalink
Merge pull request #5 from SapuSeven/develop
Browse files Browse the repository at this point in the history
Fixed some attributes
  • Loading branch information
thellmund authored Nov 14, 2018
2 parents c3b5ae9 + e649a2d commit ec4bfe4
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,10 @@ private float[] getHourLines() {
}

private void drawGrid(float[] hourLines, float startX, float startPixel, Canvas canvas) {
drawHourLines(hourLines, startX, startPixel, canvas);
drawDaySeparators(startPixel, canvas);
if (config.showHourSeparator)
drawHourLines(hourLines, startX, startPixel, canvas);
if (config.showDaySeparator)
drawDaySeparators(startPixel, canvas);
}

private void drawDaySeparators(float startPixel, Canvas canvas) {
Expand All @@ -64,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 @@ -176,7 +176,7 @@ final class WeekViewConfig {
hourSeparatorStrokeWidth = a.getDimensionPixelSize(R.styleable.WeekView_hourSeparatorStrokeWidth, hourSeparatorStrokeWidth);

// Day separators
showDaySeparator = a.getBoolean(R.styleable.WeekView_showHourSeparator, showDaySeparator);
showDaySeparator = a.getBoolean(R.styleable.WeekView_showDaySeparator, showDaySeparator);
daySeparatorColor = a.getColor(R.styleable.WeekView_daySeparatorColor, daySeparatorColor);
daySeparatorStrokeWidth = a.getDimensionPixelSize(R.styleable.WeekView_daySeparatorStrokeWidth, daySeparatorStrokeWidth);

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 ec4bfe4

Please sign in to comment.