import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;
+import android.view.WindowInsets;
import android.view.WindowManager;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
private int getStatusBarHeight() {
if (getRootWindowInsets() != null) {
+ WindowInsets insets = getRootWindowInsets();
return Math.max(
- getRootWindowInsets().getSystemWindowInsetTop(),
- getRootWindowInsets().getDisplayCutout().getSafeInsetTop());
+ insets.getSystemWindowInsetTop(),
+ insets.getDisplayCutout() != null
+ ? insets.getDisplayCutout().getSafeInsetTop()
+ : 0);
}
return 0;
if (insets != null) {
return mBubblePaddingPx + Math.max(
insets.getSystemWindowInsetTop(),
- insets.getDisplayCutout().getSafeInsetTop());
+ insets.getDisplayCutout() != null
+ ? insets.getDisplayCutout().getSafeInsetTop()
+ : 0);
}
return mBubblePaddingPx;
- mBubblePadding
+ Math.max(
insets.getSystemWindowInsetLeft(),
- insets.getDisplayCutout().getSafeInsetLeft());
+ insets.getDisplayCutout() != null
+ ? insets.getDisplayCutout().getSafeInsetLeft()
+ : 0);
mAllowableStackPositionRegion.right =
mLayout.getWidth()
- mIndividualBubbleSize
- mBubblePadding
- Math.max(
insets.getSystemWindowInsetRight(),
- insets.getDisplayCutout().getSafeInsetRight());
+ insets.getDisplayCutout() != null
+ ? insets.getDisplayCutout().getSafeInsetRight()
+ : 0);
mAllowableStackPositionRegion.top =
mBubblePadding
+ Math.max(
insets.getSystemWindowInsetTop(),
- insets.getDisplayCutout().getSafeInsetTop());
+ insets.getDisplayCutout() != null
+ ? insets.getDisplayCutout().getSafeInsetTop()
+ : 0);
mAllowableStackPositionRegion.bottom =
mLayout.getHeight()
- mIndividualBubbleSize
- mBubblePadding
- Math.max(
insets.getSystemWindowInsetBottom(),
- insets.getDisplayCutout().getSafeInsetBottom());
+ insets.getDisplayCutout() != null
+ ? insets.getDisplayCutout().getSafeInsetBottom()
+ : 0);
}
return mAllowableStackPositionRegion;