diff options
author | Romain Guy <romainguy@android.com> | 2009-08-17 13:05:05 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2009-08-17 13:05:05 -0700 |
commit | 596191889f527952d31a5cfe7000120ad51bbef2 (patch) | |
tree | 9924330c4ba93c50c2cf35b229be302619bc958d /core | |
parent | 8f5af58265d1c87847ea289259d42ae0f161fe67 (diff) | |
parent | 76c830b229fc21d5ea0ea28955084cc187e25fc6 (diff) | |
download | frameworks_base-596191889f527952d31a5cfe7000120ad51bbef2.zip frameworks_base-596191889f527952d31a5cfe7000120ad51bbef2.tar.gz frameworks_base-596191889f527952d31a5cfe7000120ad51bbef2.tar.bz2 |
am 76c830b2: Merge change 21540 into eclair
Merge commit '76c830b229fc21d5ea0ea28955084cc187e25fc6'
* commit '76c830b229fc21d5ea0ea28955084cc187e25fc6':
Fix listview clicks with the trackball.
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/widget/AbsListView.java | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java index b7e8f10..67721c9 100644 --- a/core/java/android/widget/AbsListView.java +++ b/core/java/android/widget/AbsListView.java @@ -546,6 +546,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te private void initAbsListView() { // Setting focusable in touch mode will set the focusable property to true + setClickable(true); setFocusableInTouchMode(true); setWillNotDraw(false); setAlwaysDrawnWithCacheEnabled(false); @@ -1433,6 +1434,10 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te * this is a long press. */ void keyPressed() { + if (!isEnabled() || !isClickable()) { + return; + } + Drawable selector = mSelector; Rect selectorRect = mSelectorRect; if (selector != null && (isFocused() || touchModeDrawsInPressedState()) @@ -1450,8 +1455,8 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te Drawable d = selector.getCurrent(); if (d != null && d instanceof TransitionDrawable) { if (longClickable) { - ((TransitionDrawable) d).startTransition(ViewConfiguration - .getLongPressTimeout()); + ((TransitionDrawable) d).startTransition( + ViewConfiguration.getLongPressTimeout()); } else { ((TransitionDrawable) d).resetTransition(); } @@ -1732,6 +1737,11 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te } @Override + public boolean onKeyDown(int keyCode, KeyEvent event) { + return false; + } + + @Override public boolean onKeyUp(int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_DPAD_CENTER: @@ -1739,8 +1749,7 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te if (!isEnabled()) { return true; } - // Long clickable items don't necessarily have to be clickable - if (isClickable() && (event.getRepeatCount() == 0) && isPressed() && + if (isClickable() && isPressed() && mSelectedPosition >= 0 && mAdapter != null && mSelectedPosition < mAdapter.getCount()) { |