Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions core/src/main/java/com/alamkanak/weekview/ViewStateFactory.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.alamkanak.weekview
import android.content.Context
import android.content.res.TypedArray
import android.graphics.Color
import android.graphics.DashPathEffect
import android.graphics.Paint
import android.graphics.Typeface
import android.os.Build
Expand Down Expand Up @@ -73,6 +74,12 @@ internal object ViewStateFactory {
viewState.hourSeparatorPaint.apply {
color = a.getColor(R.styleable.WeekView_hourSeparatorColor, context.lineColor)
strokeWidth = a.getDimension(R.styleable.WeekView_hourSeparatorStrokeWidth, context.dp(1))
val hourSeparator = a.getInt(R.styleable.WeekView_hourSeparator, LINE)
if (hourSeparator == DASH_LINE) {
val dashGap = a.getDimension(R.styleable.WeekView_hourSeparatorDashGap, context.dp(8))
val dashWidth = a.getDimension(R.styleable.WeekView_hourSeparatorDashWidth, context.dp(8))
pathEffect = DashPathEffect(floatArrayOf(dashWidth, dashGap), 0f)
}
}

viewState.daySeparatorPaint.apply {
Expand Down Expand Up @@ -221,6 +228,9 @@ internal fun Int.toPaint(): Paint {
return Paint().apply { color = this@toPaint }
}

private const val LINE = 0
private const val DASH_LINE = 1

private const val SANS = 1
private const val SERIF = 2
private const val MONOSPACE = 3
Expand Down
6 changes: 6 additions & 0 deletions core/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,12 @@

<!-- Hour separators -->
<attr name="showHourSeparator" format="boolean" />
<attr name="hourSeparator" format="enum">
<enum name="line" value="0" />
<enum name="dashLine" value="1" />
</attr>
<attr name="hourSeparatorDashGap" format="dimension" />
<attr name="hourSeparatorDashWidth" format="dimension" />
<attr name="hourSeparatorColor" format="color" />
<attr name="hourSeparatorStrokeWidth" format="dimension" />

Expand Down