Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,8 @@ public IterableInAppFragmentHTMLNotification() {
@Override
public void onStart() {
super.onStart();

// Set dialog positioning after the dialog is created and shown (only for non-fullscreen)
Dialog dialog = getDialog();
if (dialog != null && getInAppLayout(insetPadding) != InAppLayout.FULLSCREEN) {
applyWindowGravity(dialog.getWindow(), "onStart");
}
// Window gravity is set once in onCreateDialog to avoid redundant updates
// that cause flickering with Jetpack Compose recomposition.
}

@Override
Expand Down Expand Up @@ -172,6 +168,14 @@ public void onCancel(DialogInterface dialog) {
});
dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);

// Disable default window animations to prevent flickering with Jetpack Compose.
// Compose's recomposition cycle can conflict with the window animation system,
// causing visual artifacts. We handle animations manually via showAndAnimateWebView().
Window dialogWindow = dialog.getWindow();
if (dialogWindow != null) {
dialogWindow.setWindowAnimations(0);
}

// Set window gravity for the dialog (only for non-fullscreen)
if (getInAppLayout(insetPadding) != InAppLayout.FULLSCREEN) {
applyWindowGravity(dialog.getWindow(), "onCreateDialog");
Expand All @@ -196,17 +200,18 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c
getDialog().getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
}

// Set initial window gravity based on inset padding (only for non-fullscreen)
if (getInAppLayout(insetPadding) != InAppLayout.FULLSCREEN) {
applyWindowGravity(getDialog().getWindow(), "onCreateView");
}
// Window gravity is set once in onCreateDialog; avoid redundant calls
// that trigger layout invalidation and cause flickering with Compose.

webView = createWebViewSafely(getContext());
if (webView == null) {
dismissAllowingStateLoss();
return null;
}
webView.setId(R.id.webView);
// Use hardware layer to stabilize rendering and prevent flickering
// during Jetpack Compose layout passes
webView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
webView.createWithHtml(this, htmlString);

if (orientationListener == null) {
Expand Down Expand Up @@ -662,11 +667,11 @@ public void run() {
// Apply the new layout params to WebView
webView.setLayoutParams(webViewParams);

// Force layout updates
webView.requestLayout();
if (webView.getParent() instanceof ViewGroup) {
((ViewGroup) webView.getParent()).requestLayout();
}
// Skip explicit requestLayout() calls - setLayoutParams() already triggers
// a layout pass internally. Redundant requestLayout() calls cause layout
// thrashing with Jetpack Compose's recomposition cycle, leading to flickering.
//
//

IterableLogger.d(TAG, "Applied explicit size and positioning to WebView: " + newWebViewWidth + "x" + newWebViewHeight);
}
Expand Down
Loading