From 3871fd16d026d7f37c617b999806636fa4b90e47 Mon Sep 17 00:00:00 2001 From: Tomasz Mikolajewski Date: Mon, 11 Apr 2016 17:48:28 +0900 Subject: [PATCH] Fix selecting with touch in multi-window. Bug: 28068983 Change-Id: Ie3ce0540a22a352c55fa18cb5be2cde28417e556 --- .../com/android/documentsui/dirlist/DocumentHolder.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/DocumentsUI/src/com/android/documentsui/dirlist/DocumentHolder.java b/packages/DocumentsUI/src/com/android/documentsui/dirlist/DocumentHolder.java index 450341f9d4fcd..2288fe74184ff 100644 --- a/packages/DocumentsUI/src/com/android/documentsui/dirlist/DocumentHolder.java +++ b/packages/DocumentsUI/src/com/android/documentsui/dirlist/DocumentHolder.java @@ -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);