| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -57,13 +57,19 @@ function initializeTouchListener(): void { | |||
| 57 | 57 | ||
| 58 | 58 | @Interfaces([android.view.View.OnTouchListener]) | |
| 59 | 59 | class TouchListenerImpl extends java.lang.Object implements android.view.View.OnTouchListener { | |
| 60 | - constructor(private owner: View) { | ||
| 60 | + private owner: WeakRef<View>; | ||
| 61 | + constructor(owner: View) { | ||
| 61 | 62 | super(); | |
| 63 | + this.owner = new WeakRef(owner); | ||
| 64 | + | ||
| 62 | 65 | return global.__native(this); | |
| 63 | 66 | } | |
| 64 | 67 | ||
| 65 | 68 | onTouch(view: android.view.View, event: android.view.MotionEvent): boolean { | |
| 66 | - const owner = this.owner; | ||
| 69 | + const owner = this.owner.get(); | ||
| 70 | + if (!owner) { | ||
| 71 | + return; | ||
| 72 | + } | ||
| 67 | 73 | owner.handleGestureTouch(event); | |
| 68 | 74 | ||
| 69 | 75 | let nativeView = owner.nativeViewProtected; | |
@@ -211,7 +217,7 @@ function initializeDialogFragment() { | |||
| 211 | 217 | const owner = this.owner; | |
| 212 | 218 | ||
| 213 | 219 | if (owner) { | |
| 214 | - // Android calls onDestroy before onDismiss. | ||
| 220 | + // Android calls onDestroy before onDismiss. | ||
| 215 | 221 | // Make sure we unload first and then call _tearDownUI. | |
| 216 | 222 | if (owner.isLoaded) { | |
| 217 | 223 | owner.callUnloaded(); | |
@@ -298,7 +304,7 @@ export class View extends ViewCommon { | |||
| 298 | 304 | let view: View = this; | |
| 299 | 305 | let frameOrTabViewItemFound = false; | |
| 300 | 306 | while (view) { | |
| 301 | - // when interacting with nested fragments instead of using getSupportFragmentManager | ||
| 307 | + // when interacting with nested fragments instead of using getSupportFragmentManager | ||
| 302 | 308 | // we must always use getChildFragmentManager instead; | |
| 303 | 309 | // we have three sources of fragments -- Frame fragments, TabViewItem fragments, and | |
| 304 | 310 | // modal dialog fragments | |
@@ -1026,4 +1032,4 @@ createNativePercentLengthProperty({ | |||
| 1026 | 1032 | createNativePercentLengthProperty({ | |
| 1027 | 1033 | setter: "_setMinHeightNative", | |
| 1028 | 1034 | get setPixels() { return org.nativescript.widgets.ViewHelper.setMinHeight } | |
| 1029 | - }); | ||
| 1035 | + }); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments