Skip to content

Commit

Permalink
Fixed several Kotlin warnings (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
cortinico authored Oct 19, 2018
1 parent 14bdfb6 commit d68fb94
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions slidetoact/src/main/java/com/ncorti/slidetoact/SlideToActView.kt
Original file line number Diff line number Diff line change
Expand Up @@ -415,17 +415,17 @@ class SlideToActView(context: Context,

// Animator that moves the cursor
val finalPositionAnimator = ValueAnimator.ofInt(mPosition, mAreaWidth - mAreaHeight)
finalPositionAnimator.addUpdateListener({
finalPositionAnimator.addUpdateListener {
mPosition = it.animatedValue as Int
invalidateArea()
})
}

// Animator that bounce away the cursors
val marginAnimator = ValueAnimator.ofInt(mActualAreaMargin, (mInnerRect.width() / 2).toInt() + mActualAreaMargin)
marginAnimator.addUpdateListener({
marginAnimator.addUpdateListener {
mActualAreaMargin = it.animatedValue as Int
invalidateArea()
})
}
marginAnimator.interpolator = AnticipateOvershootInterpolator(2f)

// Animator that reduces the outer area (to right)
Expand Down Expand Up @@ -524,43 +524,43 @@ class SlideToActView(context: Context,

// Animator that enlarges the outer area
val tickAnimator = ValueAnimator.ofInt(mTickMargin, mAreaWidth / 2)
tickAnimator.addUpdateListener({
tickAnimator.addUpdateListener {
mTickMargin = it.animatedValue as Int
invalidateArea()
})
}

// Animator that enlarges the outer area
val areaAnimator = ValueAnimator.ofInt(mActualAreaWidth, 0)
areaAnimator.addUpdateListener({
areaAnimator.addUpdateListener {
// Now we can hide the tick till the next complete
mFlagDrawTick = false
mActualAreaWidth = it.animatedValue as Int
if (Build.VERSION.SDK_INT >= 21) {
invalidateOutline()
}
invalidateArea()
})
}

val positionAnimator = ValueAnimator.ofInt(mPosition, 0)
positionAnimator.addUpdateListener({
positionAnimator.addUpdateListener {
mPosition = it.animatedValue as Int
invalidateArea()
})
}

// Animator that re-draw the cursors
val marginAnimator = ValueAnimator.ofInt(mActualAreaMargin, mOriginAreaMargin)
marginAnimator.addUpdateListener({
marginAnimator.addUpdateListener {
mActualAreaMargin = it.animatedValue as Int
invalidateArea()
})
}
marginAnimator.interpolator = AnticipateOvershootInterpolator(2f)

// Animator that makes the arrow appear
val arrowAnimator = ValueAnimator.ofInt(mArrowMargin, mIconMargin)
arrowAnimator.addUpdateListener({
arrowAnimator.addUpdateListener {
mArrowMargin = it.animatedValue as Int
invalidateArea()
})
}


marginAnimator.interpolator = OvershootInterpolator(2f)
Expand Down Expand Up @@ -680,9 +680,9 @@ class SlideToActView(context: Context,
* This outline will suppress the shadow (till the moment when Android will support
* updatable Outlines).
*/
@RequiresApi(Build.VERSION_CODES.LOLLIPOP)
private inner class SlideToActOutlineProvider : ViewOutlineProvider() {

@RequiresApi(Build.VERSION_CODES.LOLLIPOP)
override fun getOutline(view: View?, outline: Outline?) {
if (view == null || outline == null)
return
Expand Down

0 comments on commit d68fb94

Please sign in to comment.