Skip to content

Commit 3dc7188

Browse files
authored
Merge pull request #947 from Iterable/MOB-11844-Approach2
[MOB-11844] - Support edge to edge to InApps
2 parents bbd9404 + 06e91e4 commit 3dc7188

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

iterableapi/src/main/java/com/iterable/iterableapi/IterableInAppFragmentHTMLNotification.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@
3131
import androidx.annotation.NonNull;
3232
import androidx.annotation.Nullable;
3333
import androidx.core.graphics.ColorUtils;
34+
import androidx.core.graphics.Insets;
35+
import androidx.core.view.ViewCompat;
36+
import androidx.core.view.WindowInsetsCompat;
3437
import androidx.fragment.app.DialogFragment;
3538

3639
public class IterableInAppFragmentHTMLNotification extends DialogFragment implements IterableWebView.HTMLNotificationCallbacks {
@@ -199,6 +202,17 @@ public void run() {
199202
return relativeLayout;
200203
}
201204

205+
@Override
206+
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
207+
super.onViewCreated(view, savedInstanceState);
208+
// Handle edge-to-edge insets with modern approach
209+
ViewCompat.setOnApplyWindowInsetsListener(view, (v, insets) -> {
210+
Insets sysBars = insets.getInsets(WindowInsetsCompat.Type.systemBars());
211+
v.setPadding(0, sysBars.top, 0, sysBars.bottom);
212+
return insets;
213+
});
214+
}
215+
202216
public void setLoaded(boolean loaded) {
203217
this.loaded = loaded;
204218
}

0 commit comments

Comments
 (0)