Skip to content

Commit

Permalink
Use highlightViewProperty
Browse files Browse the repository at this point in the history
  • Loading branch information
skydoves committed Dec 11, 2021
1 parent 502e508 commit 086278e
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 76 deletions.
6 changes: 3 additions & 3 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ android {
viewBinding true
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = "1.8"
jvmTarget = "11"
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,91 +37,39 @@ public class HighlightView(
private val bodyView = LinearLayout(context)
private val strokeView = View(context)

public var highlighting: Boolean = false
set(value) {
field = value
updateHighlighting()
}
public var highlighting: Boolean by highlightViewProperty(false)

@Px
public var highlightThickness: Int = dp2Px(0)
set(value) {
field = value
updateHighlightView()
}
@get:Px
public var highlightThickness: Int by highlightViewProperty(dp2Px(0))

@ColorInt
public var highlightColor: Int = accentColor()
set(value) {
field = value
updateHighlightView()
}
@get:ColorInt
public var highlightColor: Int by highlightViewProperty(accentColor())

@FloatRange(from = 0.0, to = 1.0)
public var highlightAlpha: Float = 1.0f
set(value) {
field = value
updateHighlightView()
}
@get:FloatRange(from = 0.0, to = 1.0)
public var highlightAlpha: Float by highlightViewProperty(1.0f)

public var radius: Float = dp2Px(5).toFloat()
set(value) {
field = value
updateHighlightView()
}
public var radius: Float by highlightViewProperty(dp2Px(5).toFloat())

public var radiusArray: FloatArray? = null
set(value) {
field = value
updateHighlightView()
}
public var radiusArray: FloatArray? by highlightViewProperty(null)

@Px
public var padding: Int = dp2Px(0)
set(value) {
field = value
updateHighlightView()
}
@get:Px
public var padding: Int by highlightViewProperty(dp2Px(0))

@ColorInt
public var color: Int = accentColor()
set(value) {
field = value
updateHighlightView()
}
@get:ColorInt
public var color: Int by highlightViewProperty(accentColor())

@ColorInt
public var colorGradientStart: Int = NO_COLOR
set(value) {
field = value
updateHighlightView()
}
@get:ColorInt
public var colorGradientStart: Int by highlightViewProperty(NO_COLOR)

@ColorInt
public var colorGradientCenter: Int = NO_COLOR
set(value) {
field = value
updateHighlightView()
}
@get:ColorInt
public var colorGradientCenter: Int by highlightViewProperty(NO_COLOR)

@ColorInt
public var colorGradientEnd: Int = NO_COLOR
set(value) {
field = value
updateHighlightView()
}
@get:ColorInt
public var colorGradientEnd: Int by highlightViewProperty(NO_COLOR)

public var highlight: Drawable? = null
set(value) {
field = value
updateHighlightView()
}
public var highlight: Drawable? by highlightViewProperty(null)

public var orientation: ProgressViewOrientation = ProgressViewOrientation.HORIZONTAL
set(value) {
field = value
updateHighlightView()
}
public var orientation: ProgressViewOrientation by highlightViewProperty(ProgressViewOrientation.HORIZONTAL)

public var onProgressClickListener: OnProgressClickListener? = null

Expand Down

0 comments on commit 086278e

Please sign in to comment.