Skip to content

Commit 1d6d08f

Browse files
committed
Fix dialog handling without getActiveDialog
1 parent d871a5d commit 1d6d08f

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

docs/demos/common/src/test/java/com/codenameone/developerguide/animations/AnimationDemosScreenshotTest.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ private void returnToHost(Form demoForm, Form host) {
176176
}
177177

178178
while (System.currentTimeMillis() <= deadline) {
179-
Dialog activeDialog = Dialog.getActiveDialog();
179+
Dialog activeDialog = activeDialog();
180180
if (activeDialog != null) {
181181
activeDialog.dispose();
182182
animateCurrentForm();
@@ -228,14 +228,19 @@ private Form currentForm() {
228228
return (current instanceof Form) ? (Form) current : null;
229229
}
230230

231+
private Dialog activeDialog() {
232+
Component current = Display.getInstance().getCurrent();
233+
return (current instanceof Dialog) ? (Dialog) current : null;
234+
}
235+
231236
private void animateCurrentForm() {
232237
Form current = currentForm();
233238
if (current != null) {
234239
current.animate();
235240
return;
236241
}
237242

238-
Dialog dialog = Dialog.getActiveDialog();
243+
Dialog dialog = activeDialog();
239244
if (dialog != null) {
240245
dialog.animate();
241246
}

0 commit comments

Comments
 (0)