OSDN Git Service

Fix selecting with touch in multi-window.
authorTomasz Mikolajewski <mtomasz@google.com>
Mon, 11 Apr 2016 08:48:28 +0000 (17:48 +0900)
committerTomasz Mikolajewski <mtomasz@google.com>
Mon, 11 Apr 2016 08:54:24 +0000 (17:54 +0900)
Bug: 28068983
Change-Id: Ie3ce0540a22a352c55fa18cb5be2cde28417e556

packages/DocumentsUI/src/com/android/documentsui/dirlist/DocumentHolder.java

index 450341f..2288fe7 100644 (file)
@@ -139,11 +139,13 @@ public abstract class DocumentHolder
             }
 
             // Do everything in global coordinates - it makes things simpler.
-            Rect rect = new Rect();
-            mSelectionHotspot.getGlobalVisibleRect(rect);
+            int[] coords = new int[2];
+            mSelectionHotspot.getLocationOnScreen(coords);
+            Rect rect = new Rect(coords[0], coords[1], coords[0] + mSelectionHotspot.getWidth(),
+                    coords[1] + mSelectionHotspot.getHeight());
 
             // If the tap occurred within the icon rect, consider it a selection.
-            if (rect.contains((int)event.getRawX(), (int)event.getRawY())) {
+            if (rect.contains((int) event.getRawX(), (int) event.getRawY())) {
                 return mEventListener.onSelect(this);
             } else {
                 return mEventListener.onActivate(this);