Conversation Bubble Absolute Coordinates
Hi
I have a chat list view in the bubble notifications which has a swipe listener requiring the position of the listview items. In a regular activity i get this through:
int[] mylistCoords = new int[2]; mListView.getLocationOnScreen(mylistCoords);
and then subtract the offset of the listview from the touchpoint to match the hitbox of the elements.
int x = (int) motionEvent.getRawX() - listViewCoords[0]; int y = (int) motionEvent.getRawY() - listViewCoords[1]; View child; for (int i = 0; i < childCount; i++) { child = mListView.getChildAt(i); child.getHitRect(rect); if (rect.contains(x, y)) { mDownView = child; break; } }
Now in the bubble this does not work anymore because getLocationOnScreen does not compute the offset of the ConversationBubbleView to the actual main screen. Instead it only considers the ConversationBubbleView as the full screen and as a result the the touch point is offset by the same amount toward the bottom. Any ideas how I can get access to these coordinates? Thanks in advance.