diff options
author | Jeff Sharkey <jsharkey@android.com> | 2009-08-17 10:59:35 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2009-08-17 10:59:35 -0700 |
commit | 32b72f7a533fb63b85eca4ff28e3b801ccec9e33 (patch) | |
tree | 8c631d621e12e6e80108b30695a80515b5d95c5f /core | |
parent | 4a1035508fa8826b974b2954e46784a17e3bbdf2 (diff) | |
parent | fd0d627569cb250f7060a83161cc845b9616e5a1 (diff) | |
download | frameworks_base-32b72f7a533fb63b85eca4ff28e3b801ccec9e33.zip frameworks_base-32b72f7a533fb63b85eca4ff28e3b801ccec9e33.tar.gz frameworks_base-32b72f7a533fb63b85eca4ff28e3b801ccec9e33.tar.bz2 |
am fd0d6275: Fix ExpandableListView context menus when has header views.
Merge commit 'fd0d627569cb250f7060a83161cc845b9616e5a1'
* commit 'fd0d627569cb250f7060a83161cc845b9616e5a1':
Fix ExpandableListView context menus when has header views.
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/widget/ExpandableListView.java | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/core/java/android/widget/ExpandableListView.java b/core/java/android/widget/ExpandableListView.java index 5360621..6abb2ae 100644 --- a/core/java/android/widget/ExpandableListView.java +++ b/core/java/android/widget/ExpandableListView.java @@ -33,6 +33,7 @@ import android.view.ContextMenu; import android.view.SoundEffectConstants; import android.view.View; import android.view.ContextMenu.ContextMenuInfo; +import android.widget.AdapterView.AdapterContextMenuInfo; import android.widget.ExpandableListConnector.PositionMetadata; /** @@ -916,7 +917,14 @@ public class ExpandableListView extends ListView { @Override ContextMenuInfo createContextMenuInfo(View view, int flatListPosition, long id) { - PositionMetadata pm = mConnector.getUnflattenedPos(flatListPosition); + // Adjust for and handle for header views + final int adjustedPosition = flatListPosition - getHeaderViewsCount(); + if (adjustedPosition < 0) { + // Return normal info for header view context menus + return new AdapterContextMenuInfo(view, flatListPosition, id); + } + + PositionMetadata pm = mConnector.getUnflattenedPos(adjustedPosition); ExpandableListPosition pos = pm.position; pm.recycle(); |