View: make sure onDetachedFromWindow() gets called before updating attachedToWindow property

This commit is contained in:
Julian Winkler
2025-02-18 19:04:18 +01:00
parent 24f839f556
commit 2374d44b0f
2 changed files with 10 additions and 6 deletions

View File

@@ -1876,13 +1876,17 @@ public class View implements Drawable.Callback {
native_keep_screen_on(widget, true);
}
protected void onDetachedFromWindow() {
attachedToWindow = false;
if (onAttachStateChangeListener != null) {
onAttachStateChangeListener.onViewDetachedFromWindow(this);
}
if (keepScreenOn)
native_keep_screen_on(widget, false);
}
void detachFromWindowInternal() {
onDetachedFromWindow();
attachedToWindow = false;
}
public void attachToWindowInternal() {
onAttachedToWindow();
}