Skip to content

Commit

Permalink
- added restrictions to minimum stepsCount and strokeWidth
Browse files Browse the repository at this point in the history
  • Loading branch information
haytham-c01 authored and haytham-c01 committed Apr 25, 2020
1 parent 707db54 commit be9a740
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class RectangularStepView @JvmOverloads constructor(

companion object{
private const val DEFAULT_STEPS_COUNT= 3
private const val MINIMUM_STEPS_COUNT= 2
private const val DEFAULT_HEIGHT_WIDTH_RATIO= 0.08f
}

Expand Down Expand Up @@ -88,11 +89,11 @@ class RectangularStepView @JvmOverloads constructor(
strokeWidth= getDimension(
R.styleable.RectangularStepView_stepViewStrokeWidth,
resources.getDimension(R.dimen.RectangularStepViewStrokeWidth)
)
).coerceAtLeast(0f)
shapePaint.strokeWidth= strokeWidth


stepsCount= getInteger(R.styleable.RectangularStepView_stepsCount, DEFAULT_STEPS_COUNT)
stepsCount= getInteger(R.styleable.RectangularStepView_stepsCount, DEFAULT_STEPS_COUNT).coerceAtLeast(MINIMUM_STEPS_COUNT)
_currentStep= getInteger(R.styleable.RectangularStepView_initialStep, 0).coerceIn(0, stepsCount-1)

heightToWidthRatio= getFloat(R.styleable.RectangularStepView_heightToWidthRatio, DEFAULT_HEIGHT_WIDTH_RATIO).coerceIn(0.01f, 0.2f)
Expand Down

0 comments on commit be9a740

Please sign in to comment.