Skip to content

Commit

Permalink
add particle color attr
Browse files Browse the repository at this point in the history
  • Loading branch information
ibrahimsn98 committed Dec 16, 2018
1 parent 53dbada commit 78dd15a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion particle/src/main/java/me/ibrahimsn/particle/ParticleView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@ class ParticleView : View {

private var count = 20
private var background = Color.RED
private var color = Color.WHITE
private var minRadius = 5
private var maxRadius = 10

private val paint: Paint = Paint().apply {
isAntiAlias = true
style = Paint.Style.FILL_AND_STROKE
color = Color.WHITE
color = this.color
strokeWidth = 2F
}

Expand All @@ -34,6 +35,7 @@ class ParticleView : View {
minRadius = a.getInt(R.styleable.ParticleView_minParticleRadius, minRadius)
maxRadius = a.getInt(R.styleable.ParticleView_maxParticleRadius, maxRadius)
background = a.getColor(R.styleable.ParticleView_backgroundColor, background)
color = a.getColor(R.styleable.ParticleView_particleColor, color)

if (count > 50)
count = 50
Expand Down
1 change: 1 addition & 0 deletions particle/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<resources>
<declare-styleable name="ParticleView">
<attr name="backgroundColor" format="color" />
<attr name="particleColor" format="color" />
<attr name="particleCount" format="integer" />
<attr name="minParticleRadius" format="integer" />
<attr name="maxParticleRadius" format="integer" />
Expand Down

0 comments on commit 78dd15a

Please sign in to comment.