bug:3510826 longpress, then shortpress behave differenctly in ExpandedListView
Vasu Nori [Fri, 4 Mar 2011 04:01:31 +0000 (20:01 -0800)]
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

index 978416c..4c8c36b 100644 (file)
@@ -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;
             }
         });