From 9705c34f7f4384236a38ac12b7ced531d17fa459 Mon Sep 17 00:00:00 2001 From: James Coggan Date: Thu, 25 Jan 2018 23:09:45 +0000 Subject: [PATCH] Only animate when the button is marked as clickable --- .../com/spark/submitbutton/SubmitButton.java | 40 ++++++++++--------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/submitbutton/src/main/java/com/spark/submitbutton/SubmitButton.java b/submitbutton/src/main/java/com/spark/submitbutton/SubmitButton.java index 8f41e26..eedd842 100644 --- a/submitbutton/src/main/java/com/spark/submitbutton/SubmitButton.java +++ b/submitbutton/src/main/java/com/spark/submitbutton/SubmitButton.java @@ -111,25 +111,27 @@ protected void onDraw(Canvas canvas) { @Override public boolean onTouchEvent(MotionEvent event) { - switch (event.getAction()) { - case MotionEvent.ACTION_UP: { - if (mStatus.equals(INIT)) { - startAnimation(); - } else { - mStatus = INIT; - rippleAnimator.cancel(); - rippleAlphaAnimator.cancel(); - linePosXAnim.cancel(); - sweepAngAnim.cancel(); - tickRightEndAnim.cancel(); - tickRightStartAnim.cancel(); - tickLeftEndAnim.cancel(); - tickLeftStartAnim.cancel(); - btnBgColorAnim.cancel(); - tickColorAnim.cancel(); - startAnimation(); + if(isClickable()) { + switch (event.getAction()) { + case MotionEvent.ACTION_UP: { + if (mStatus.equals(INIT)) { + startAnimation(); + } else { + mStatus = INIT; + rippleAnimator.cancel(); + rippleAlphaAnimator.cancel(); + linePosXAnim.cancel(); + sweepAngAnim.cancel(); + tickRightEndAnim.cancel(); + tickRightStartAnim.cancel(); + tickLeftEndAnim.cancel(); + tickLeftStartAnim.cancel(); + btnBgColorAnim.cancel(); + tickColorAnim.cancel(); + startAnimation(); + } + break; } - break; } } super.onTouchEvent(event); @@ -463,4 +465,4 @@ public void onAnimationUpdate(ValueAnimator animation) { tickRightStartAnim, btnBgColorAnim,tickColorAnim); animatorSet.start(); } -} \ No newline at end of file +}