|
4 | 4 | import android.animation.Animator; |
5 | 5 | import android.animation.AnimatorSet; |
6 | 6 | import android.animation.ValueAnimator; |
| 7 | +import android.annotation.SuppressLint; |
7 | 8 | import android.content.Context; |
8 | 9 | import android.content.res.TypedArray; |
9 | 10 | import android.graphics.Canvas; |
@@ -206,25 +207,24 @@ public boolean performClick() { |
206 | 207 | return super.performClick(); |
207 | 208 | } |
208 | 209 |
|
| 210 | + @SuppressLint("ClickableViewAccessibility") |
209 | 211 | @Override |
210 | 212 | public boolean onTouchEvent(MotionEvent event) { |
211 | 213 | if(!isEnabled()){ |
212 | 214 | return true; |
213 | 215 | } |
214 | 216 | switch (event.getAction()){ |
215 | 217 | case MotionEvent.ACTION_DOWN: |
216 | | - mTouchX = event.getX(); |
217 | | - mTouchY = event.getY(); |
218 | | - playRippleAnimation(true); |
219 | | - break; |
| 218 | + mTouchX = event.getX(); |
| 219 | + mTouchY = event.getY(); |
| 220 | + playRippleAnimation(true); |
| 221 | + break; |
220 | 222 | case MotionEvent.ACTION_UP: |
221 | | - case MotionEvent.ACTION_CANCEL: |
222 | 223 | playRippleAnimation(false); |
223 | | - performClick(); |
224 | | - return false; |
| 224 | + break; |
225 | 225 | } |
226 | 226 |
|
227 | | - return super.onTouchEvent(event); |
| 227 | + return true; |
228 | 228 | } |
229 | 229 |
|
230 | 230 | @Override |
@@ -741,7 +741,7 @@ public void onAnimationEnd(Animator animator) { |
741 | 741 | scaleAnimator.start(); |
742 | 742 | } |
743 | 743 |
|
744 | | - private void playRippleAnimation(boolean isTouchDown){ |
| 744 | + private void playRippleAnimation(final boolean isTouchDown){ |
745 | 745 | setShadowDepth2(); |
746 | 746 | ValueAnimator rippleAnimator = ValueAnimator.ofFloat(isTouchDown ? 0 : width/2, isTouchDown ? width/2 : width); |
747 | 747 | rippleAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { |
|
0 commit comments