Skip to content

Commit

Permalink
Merge pull request #1571 from unoplatform/dev/jela/recycler-touch
Browse files Browse the repository at this point in the history
[Android] Fix java NRE handing touch events on detached view
  • Loading branch information
jeromelaban authored Sep 23, 2019
2 parents f25d28e + 960c06b commit 8b9c1a7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
1 change: 1 addition & 0 deletions doc/ReleaseNotes/_ReleaseNotes.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@
* [iOS(iPad)] `ComboBox` : the combobox wasn't fully expanding vertically on first opening.
* `Popup` & `ComboBox` (and other controls using `Popup`) were not behaving properly when `IsLightDismissable` were set to `true`.
* [Wasm] Fix unloaded UIElements are made visible if measured and arranged
* [Android] Fix java NRE handing touch events on detached view

## Release 1.45.0
### Features
Expand Down
21 changes: 13 additions & 8 deletions src/Uno.UI.BindingHelper.Android/Uno/UI/UnoViewGroup.java
Original file line number Diff line number Diff line change
Expand Up @@ -951,14 +951,19 @@ private static float[] getTransformedTouchCoordinate(ViewParent view, MotionEven
return point;
}

// Non-UIElement view, walk the tree up to the next UIElement
// (and adjust coordinate for each layer to include its location, i.e. Top, Left, etc.)
final ViewParent parent = view.getParent();
if (parent instanceof View) {
// Not at root, walk upward
float[] coords = getTransformedTouchCoordinate(parent, e);
calculateTransformedPoint((View) view, coords);
return coords;
if(view != null) {
// The parent view may be null if the touched item is being removed
// from the tree while being touched.

// Non-UIElement view, walk the tree up to the next UIElement
// (and adjust coordinate for each layer to include its location, i.e. Top, Left, etc.)
final ViewParent parent = view.getParent();
if (parent instanceof View) {
// Not at root, walk upward
float[] coords = getTransformedTouchCoordinate(parent, e);
calculateTransformedPoint((View) view, coords);
return coords;
}
}

// We reached the top of the tree
Expand Down

0 comments on commit 8b9c1a7

Please sign in to comment.