From eb9fdc21b14368b2f8c71939eb063ddcee8c28a2 Mon Sep 17 00:00:00 2001 From: Daniel Sandler Date: Mon, 14 Sep 2009 13:05:43 -0400 Subject: [PATCH] Fix http://b/issue?id=2098873 (drawing glitch in SeekBar). The underlying ProgressBar implementation doesn't know how to correctly update the thumb graphic, so AbsSeekBar must call invalidate() at key moments to ensure things look correct. This bug is one such instance: when you pick your finger up off the seekbar, the "value" of the progressbar appears not to change, so ProgressBar feels no compunction to repaint. AbsSeekBar now invalidate()s on ACTION_UP and ACTION_CANCEL to ensure that the thumb is correctly drawn. --- core/java/android/widget/AbsSeekBar.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/java/android/widget/AbsSeekBar.java b/core/java/android/widget/AbsSeekBar.java index 2a0e5e5161f58..d25530b3dfd6f 100644 --- a/core/java/android/widget/AbsSeekBar.java +++ b/core/java/android/widget/AbsSeekBar.java @@ -301,11 +301,16 @@ public abstract class AbsSeekBar extends ProgressBar { trackTouchEvent(event); onStopTrackingTouch(); setPressed(false); + // ProgressBar doesn't know to repaint the thumb drawable + // in its inactive state when the touch stops (because the + // value has not apparently changed) + invalidate(); break; case MotionEvent.ACTION_CANCEL: onStopTrackingTouch(); setPressed(false); + invalidate(); // see above explanation break; } return true;