diff options
author | Romain Guy <romainguy@android.com> | 2009-08-17 11:09:21 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2009-08-17 11:09:21 -0700 |
commit | 75229368c2721d580d6c8fb11ef25f1aaabba624 (patch) | |
tree | 83907c8de140abac963479a5e5365a3b5729a137 /core | |
parent | cd47012ff3b58c9266595e42cdf606961f577d86 (diff) | |
parent | 54ba86f0e236a55fb4dc3aabbd81078f586321a5 (diff) | |
download | frameworks_base-75229368c2721d580d6c8fb11ef25f1aaabba624.zip frameworks_base-75229368c2721d580d6c8fb11ef25f1aaabba624.tar.gz frameworks_base-75229368c2721d580d6c8fb11ef25f1aaabba624.tar.bz2 |
am 54ba86f0: Merge change 21512 into eclair
Merge commit '54ba86f0e236a55fb4dc3aabbd81078f586321a5'
* commit '54ba86f0e236a55fb4dc3aabbd81078f586321a5':
Honor the clickable and enabled properties in ListView.
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/widget/AbsListView.java | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java index eea97dc..b7e8f10 100644 --- a/core/java/android/widget/AbsListView.java +++ b/core/java/android/widget/AbsListView.java @@ -1736,14 +1736,21 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te switch (keyCode) { case KeyEvent.KEYCODE_DPAD_CENTER: case KeyEvent.KEYCODE_ENTER: - if (isPressed() && mSelectedPosition >= 0 && mAdapter != null && + if (!isEnabled()) { + return true; + } + // Long clickable items don't necessarily have to be clickable + if (isClickable() && (event.getRepeatCount() == 0) && isPressed() && + mSelectedPosition >= 0 && mAdapter != null && mSelectedPosition < mAdapter.getCount()) { + final View view = getChildAt(mSelectedPosition - mFirstPosition); performItemClick(view, mSelectedPosition, mSelectedRowId); setPressed(false); if (view != null) view.setPressed(false); return true; } + break; } return super.onKeyUp(keyCode, event); } @@ -1892,6 +1899,12 @@ public abstract class AbsListView extends AdapterView<ListAdapter> implements Te @Override public boolean onTouchEvent(MotionEvent ev) { + if (!isEnabled()) { + // A disabled view that is clickable still consumes the touch + // events, it just doesn't respond to them. + return isClickable() || isLongClickable(); + } + if (mFastScroller != null) { boolean intercepted = mFastScroller.onTouchEvent(ev); if (intercepted) { |