Skip to content

Commit

Permalink
Make text field public (cortinico#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
cortinico committed Jan 13, 2018
1 parent 73fe28d commit e02025c
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions slidetoact/src/main/java/com/ncorti/slidetoact/SlideToActView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,12 @@ class SlideToActView(context: Context,
private val mOriginAreaMargin: Int

/** Text message */
private var mTextMessage: String = ""
var text: CharSequence = ""
set(value) {
field = value
invalidate()
}

/** Size for the text message */
private val mTextSize: Int

Expand Down Expand Up @@ -160,7 +165,7 @@ class SlideToActView(context: Context,
val defaultInner = ContextCompat.getColor(this.context, R.color.white)
mOuterColor = layoutAttrs.getColor(R.styleable.SlideToActView_outer_color, defaultOuter)
mInnerColor = layoutAttrs.getColor(R.styleable.SlideToActView_inner_color, defaultInner)
mTextMessage = layoutAttrs.getString(R.styleable.SlideToActView_text)
text = layoutAttrs.getString(R.styleable.SlideToActView_text)

isLocked = layoutAttrs.getBoolean(R.styleable.SlideToActView_slider_locked, false)

Expand Down Expand Up @@ -261,7 +266,7 @@ class SlideToActView(context: Context,
mTextPaint.alpha = (255 * mPositionPercInv).toInt()

// Vertical + Horizontal centering
canvas.drawText(mTextMessage, mTextXPosition, mTextYPosition, mTextPaint)
canvas.drawText(text.toString(), mTextXPosition, mTextYPosition, mTextPaint)

// Arrow angle
mArrowAngle = -180 * mPositionPerc
Expand Down

0 comments on commit e02025c

Please sign in to comment.