From 8cf72b84b15ad3887b00f16f02a79ea304469548 Mon Sep 17 00:00:00 2001 From: Vasu Nori Date: Thu, 3 Mar 2011 20:01:31 -0800 Subject: bug:3510826 longpress, then shortpress behave differenctly in ExpandedListView in ListView, the following is the behavior assume setOnItemClickListener() is set on the ListView object. longpress starts selection shortpress thereafter selects the item and DOES NOT call the callback set by setOnItemClickListener() without preceding longpress, shortpress calls the callback set by setOnItemClickListener() in ExpandedListView, assume setOnChildClickListener() is set longpress starts selection, as in ListView shortpress thereafter calls the callback set by setOnChildClickListener() without preceding longpress, shortpress calls the callback set by setOnChildClickListener() as expected. is this expected behavior in ExpandedListView. sounds like some sort of bug in ExpandedListView handling. if this is application bug, is this CL a valid fix? Change-Id: I4e290b5dcaa263c9ea76ba7926a0131d296c86c2 --- ui/src/com/android/providers/downloads/ui/DownloadList.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'ui/src/com/android/providers/downloads') diff --git a/ui/src/com/android/providers/downloads/ui/DownloadList.java b/ui/src/com/android/providers/downloads/ui/DownloadList.java index 978416c7..4c8c36bb 100644 --- a/ui/src/com/android/providers/downloads/ui/DownloadList.java +++ b/ui/src/com/android/providers/downloads/ui/DownloadList.java @@ -232,8 +232,16 @@ public class DownloadList extends Activity { @Override public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) { - mDateSortedAdapter.moveCursorToChildPosition(groupPosition, childPosition); - handleItemClick(mDateSortedCursor); + if (!(v instanceof DownloadItem)) { + // can this even happen? + return false; + } + if (mSelectedIds.size() > 0) { + ((DownloadItem)v).setChecked(true); + } else { + mDateSortedAdapter.moveCursorToChildPosition(groupPosition, childPosition); + handleItemClick(mDateSortedCursor); + } return true; } }); -- cgit v1.2.3