-
public class InsetsUtils
-
-
Method Summary
Modifier and Type Method Description static voidaddCutoutAndNavigationInsets(@Nullable() View view)Adds to the view insets from navigation bar and cutout.Insets must be calculated as we use translucent status and navigation bar ininterstitial ad. static CustomInsetsgetCutoutInsets(Context context)static CustomInsetsgetNavigationInsets(Context context)-
-
Method Detail
-
addCutoutAndNavigationInsets
static void addCutoutAndNavigationInsets(@Nullable() View view)
Adds to the view insets from navigation bar and cutout.Insets must be calculated as we use translucent status and navigation bar ininterstitial ad. Must be applied to every view in interstitial ad.
It supports view where parents are RelativeLayout or FrameLayout.
The margins
{@code view}had before any inset was ever applied to it are capturedonce (as a view tag) and reused as the baseline on every subsequent call. This makesrepeated calls (e.g. on every rotation) idempotent: insets never accumulate, and if theresolved gravity/rule changes between calls (RTL flip, position change, etc.) the sidethat no longer applies is reset back to its original margin instead of staying stuck.
-
getCutoutInsets
static CustomInsets getCutoutInsets(Context context)
-
getNavigationInsets
static CustomInsets getNavigationInsets(Context context)
-
-
-
-