Fix crash when the view was not removed from the window manager in time.#24
Fix crash when the view was not removed from the window manager in time.#24gw0 wants to merge 1 commit intopingpongboss:masterfrom
Conversation
|
You are right. Modifying it to the following does not result in window disappearing if a start animation is specified. But the documentation for try {
// add the view to the window manager
mWindowManager.addView(window, params);
} catch (IllegalStateException ex) {
} catch (Exception ex) {
ex.printStackTrace();
}
// animate
if (animation != null) {
window.getChildAt(0).startAnimation(animation);
} |
|
Can you clarify what you mean by "in this case it doesn't work"? What happens, and what do you expect to happen? If it's about clearing the previous animation, there is View#clearAnimation |
|
Starting the application in the usual way two times (without closing the window between) one would expect the window to remain visible without any exception. But what happens:
So the problem is that the window is not visible if
|
|
I see. For the 3rd case, when getShowAnimation() returns null, you can just directly set window.getChildAt(0).setAlpha(1f); PS: did window.getChildAt(0).clearAnimation() not work? |
Running applications that use StandOutWindow again without closing them before results in a crash. For
StandOut/examplethe window disappears and the Service prints out the following exception:The problematic line in
StandOutWindow.javais:Although the code in Activity looks like:
The problem originates in the fact that the close/hide animation take some time to finish and it doesn't remove the window from the window manager immediately.
The included patch resolves this by forceful removing of the view from the window manager before adding it again.