diff options
| author | Romain Guy <romainguy@google.com> | 2010-01-04 15:40:27 -0800 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2010-01-04 15:40:27 -0800 |
| commit | 1dabb95d280480c4c519b52ded8990d39c8b1614 (patch) | |
| tree | c3549932354a5ded69e394bd87625b620b088601 /core/java | |
| parent | d5c19608c601738a4a9dc168ce97127f891a2645 (diff) | |
| parent | 992cc4282e92c0b7c192247261c54933acab5ad0 (diff) | |
| download | frameworks_base-1dabb95d280480c4c519b52ded8990d39c8b1614.zip frameworks_base-1dabb95d280480c4c519b52ded8990d39c8b1614.tar.gz frameworks_base-1dabb95d280480c4c519b52ded8990d39c8b1614.tar.bz2 | |
Merge "Ignore key events when the widget is disabled. Bug: #2353635."
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/widget/AbsSeekBar.java | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/core/java/android/widget/AbsSeekBar.java b/core/java/android/widget/AbsSeekBar.java index d25530b..d6dd872 100644 --- a/core/java/android/widget/AbsSeekBar.java +++ b/core/java/android/widget/AbsSeekBar.java @@ -26,7 +26,6 @@ import android.view.KeyEvent; import android.view.MotionEvent; public abstract class AbsSeekBar extends ProgressBar { - private Drawable mThumb; private int mThumbOffset; @@ -66,8 +65,9 @@ public abstract class AbsSeekBar extends ProgressBar { Drawable thumb = a.getDrawable(com.android.internal.R.styleable.SeekBar_thumb); setThumb(thumb); // will guess mThumbOffset if thumb != null... // ...but allow layout to override this - int thumbOffset = - a.getDimensionPixelOffset(com.android.internal.R.styleable.SeekBar_thumbOffset, getThumbOffset()); + int thumbOffset = a.getDimensionPixelOffset( + com.android.internal.R.styleable.SeekBar_thumbOffset, getThumbOffset()); + setThumbOffset(thumbOffset); a.recycle(); a = context.obtainStyledAttributes(attrs, @@ -91,7 +91,7 @@ public abstract class AbsSeekBar extends ProgressBar { // Assuming the thumb drawable is symmetric, set the thumb offset // such that the thumb will hang halfway off either edge of the // progress bar. - mThumbOffset = (int)thumb.getIntrinsicWidth() / 2; + mThumbOffset = thumb.getIntrinsicWidth() / 2; } mThumb = thumb; invalidate(); @@ -368,20 +368,21 @@ public abstract class AbsSeekBar extends ProgressBar { @Override public boolean onKeyDown(int keyCode, KeyEvent event) { - int progress = getProgress(); - - switch (keyCode) { - case KeyEvent.KEYCODE_DPAD_LEFT: - if (progress <= 0) break; - setProgress(progress - mKeyProgressIncrement, true); - onKeyChange(); - return true; - - case KeyEvent.KEYCODE_DPAD_RIGHT: - if (progress >= getMax()) break; - setProgress(progress + mKeyProgressIncrement, true); - onKeyChange(); - return true; + if (isEnabled()) { + int progress = getProgress(); + switch (keyCode) { + case KeyEvent.KEYCODE_DPAD_LEFT: + if (progress <= 0) break; + setProgress(progress - mKeyProgressIncrement, true); + onKeyChange(); + return true; + + case KeyEvent.KEYCODE_DPAD_RIGHT: + if (progress >= getMax()) break; + setProgress(progress + mKeyProgressIncrement, true); + onKeyChange(); + return true; + } } return super.onKeyDown(keyCode, event); |
