implement View.getLocationOnScreen() properly

This commit is contained in:
Julian Winkler
2024-03-15 17:49:40 +01:00
committed by Mis012
parent 95be104d5a
commit c8e70d49be

View File

@@ -1040,9 +1040,11 @@ public class View extends Object {
protected void onScrollChanged(int l, int t, int oldl, int oldt) {} protected void onScrollChanged(int l, int t, int oldl, int oldt) {}
public void getLocationOnScreen(int[] location) { // FIXME: actually return the widget's location (and also have the onclick callback convert to window coordinates, because is seems that's what android deals in..) public void getLocationOnScreen(int[] location) {
location[0] = 0; Rect rect = new Rect();
location[1] = 0; getGlobalVisibleRect(rect);
location[0] = rect.left;
location[1] = rect.top;
} }
public boolean performHapticFeedback(int feedbackConstant) { public boolean performHapticFeedback(int feedbackConstant) {