Loading viewcapturelib/src/com/android/app/viewcapture/ViewCapture.java +11 −6 Original line number Diff line number Diff line Loading @@ -161,10 +161,13 @@ public abstract class ViewCapture { public void stopCapture(@NonNull View rootView) { mListeners.forEach(it -> { if (rootView == it.mRoot) { runOnUiThread(() -> it.mRoot.getViewTreeObserver().removeOnDrawListener(it), it.mRoot); runOnUiThread(() -> { if (it.mRoot != null) { it.mRoot.getViewTreeObserver().removeOnDrawListener(it); it.mRoot = null; } }, it.mRoot); } }); } Loading Loading @@ -494,9 +497,11 @@ public abstract class ViewCapture { @AnyThread void detachFromRoot() { mIsActive = false; runOnUiThread(() -> { if (mRoot != null) { runOnUiThread(() -> mRoot.getViewTreeObserver().removeOnDrawListener(this), mRoot); mRoot.getViewTreeObserver().removeOnDrawListener(this); } }, mRoot); } @UiThread Loading Loading
viewcapturelib/src/com/android/app/viewcapture/ViewCapture.java +11 −6 Original line number Diff line number Diff line Loading @@ -161,10 +161,13 @@ public abstract class ViewCapture { public void stopCapture(@NonNull View rootView) { mListeners.forEach(it -> { if (rootView == it.mRoot) { runOnUiThread(() -> it.mRoot.getViewTreeObserver().removeOnDrawListener(it), it.mRoot); runOnUiThread(() -> { if (it.mRoot != null) { it.mRoot.getViewTreeObserver().removeOnDrawListener(it); it.mRoot = null; } }, it.mRoot); } }); } Loading Loading @@ -494,9 +497,11 @@ public abstract class ViewCapture { @AnyThread void detachFromRoot() { mIsActive = false; runOnUiThread(() -> { if (mRoot != null) { runOnUiThread(() -> mRoot.getViewTreeObserver().removeOnDrawListener(this), mRoot); mRoot.getViewTreeObserver().removeOnDrawListener(this); } }, mRoot); } @UiThread Loading