urbanairship-core/src/main/java/com/urbanairship/iam/banner/BannerFragment.java
private void applyWindowInsets(View view) {
        ViewCompat.setOnApplyWindowInsetsListener(view, new OnApplyWindowInsetsListener() {
            @Override
            public WindowInsetsCompat onApplyWindowInsets(View view, WindowInsetsCompat src) {
                WindowInsetsCompat copy = new WindowInsetsCompat(src);

                int left, top, right, bottom;
                left = right = Math.max(src.getSystemWindowInsetLeft(), src.getSystemWindowInsetRight());
                top = src.getSystemWindowInsetTop();
                bottom = src.getSystemWindowInsetBottom();

                if (displayContent.getPlacement().equals(BannerDisplayContent.PLACEMENT_TOP)) {
                    top = isActionBarEnabled() ? 0 : top;
                } else {
                    bottom = isNavigationTranslucent() ? bottom : 0;
                }

                copy = copy.replaceSystemWindowInsets(left, top, right, bottom);
                ViewCompat.onApplyWindowInsets(view, copy);
                return src;
            }
        });


        view.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener() {
            @Override
            public void onViewAttachedToWindow(View view) {
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
                    view.dispatchApplyWindowInsets(view.getRootWindowInsets());
                    return;
                }

                if (displayContent.getPlacement().equals(BannerDisplayContent.PLACEMENT_TOP) && !isActionBarEnabled()) {
                    int resourceId = getResources().getIdentifier("status_bar_height", "dimen", "android");
                    if (resourceId > 0) {
                        int height = getResources().getDimensionPixelSize(resourceId);
                        view.setPadding(0, height, 0, 0);
                    }
                }
            }

            @Override
            public void onViewDetachedFromWindow(View view) {
                view.removeOnAttachStateChangeListener(this);
            }
        });
    }
/**
     * Applies the window insets to the view.
     *
     * @param view The fragment's view.
     */
Applies the window insets to the view.
@param view The fragment's view.
Applies the window insets to the view . @param view The fragment ' s view .
private void applyWindowInsets(View view) {
        ViewCompat.setOnApplyWindowInsetsListener(view, new OnApplyWindowInsetsListener() {
            @Override
            public WindowInsetsCompat onApplyWindowInsets(View view, WindowInsetsCompat src) {
                WindowInsetsCompat copy = new WindowInsetsCompat(src);
                int left, top, right, bottom;
                left = right = Math.max(src.getSystemWindowInsetLeft(), src.getSystemWindowInsetRight());
                top = src.getSystemWindowInsetTop();
                bottom = src.getSystemWindowInsetBottom();
                if (displayContent.getPlacement().equals(BannerDisplayContent.PLACEMENT_TOP)) {
                    top = isActionBarEnabled() ? 0 : top;
                } else {
                    bottom = isNavigationTranslucent() ? bottom : 0;
                }
                copy = copy.replaceSystemWindowInsets(left, top, right, bottom);
                ViewCompat.onApplyWindowInsets(view, copy);
                return src;
            }
        });
        view.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener() {
            @Override
            public void onViewAttachedToWindow(View view) {
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
                    view.dispatchApplyWindowInsets(view.getRootWindowInsets());
                    return;
                }
                if (displayContent.getPlacement().equals(BannerDisplayContent.PLACEMENT_TOP) && !isActionBarEnabled()) {
                    int resourceId = getResources().getIdentifier("status_bar_height", "dimen", "android");
                    if (resourceId > 0) {
                        int height = getResources().getDimensionPixelSize(resourceId);
                        view.setPadding(0, height, 0, 0);
                    }
                }
            }
            @Override
            public void onViewDetachedFromWindow(View view) {
                view.removeOnAttachStateChangeListener(this);
            }
        });
    }
private void applyWindowInsets ( View view ) { ViewCompat . setOnApplyWindowInsetsListener ( view , new OnApplyWindowInsetsListener ( ) { @ Override public WindowInsetsCompat onApplyWindowInsets ( View view , WindowInsetsCompat src ) { WindowInsetsCompat copy = new WindowInsetsCompat ( src ) ; int left , top , right , bottom ; left = right = Math . max ( src . getSystemWindowInsetLeft ( ) , src . getSystemWindowInsetRight ( ) ) ; top = src . getSystemWindowInsetTop ( ) ; bottom = src . getSystemWindowInsetBottom ( ) ; if ( displayContent . getPlacement ( ) . equals ( BannerDisplayContent . PLACEMENT_TOP ) ) { top = isActionBarEnabled ( ) ? 0 : top ; } else { bottom = isNavigationTranslucent ( ) ? bottom : 0 ; } copy = copy . replaceSystemWindowInsets ( left , top , right , bottom ) ; ViewCompat . onApplyWindowInsets ( view , copy ) ; return src ; } } ) ; view . addOnAttachStateChangeListener ( new View . OnAttachStateChangeListener ( ) { @ Override public void onViewAttachedToWindow ( View view ) { if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . M ) { view . dispatchApplyWindowInsets ( view . getRootWindowInsets ( ) ) ; return ; } if ( displayContent . getPlacement ( ) . equals ( BannerDisplayContent . PLACEMENT_TOP ) && ! isActionBarEnabled ( ) ) { int resourceId = getResources ( ) . getIdentifier ( "status_bar_height" , "dimen" , "android" ) ; if ( resourceId > 0 ) { int height = getResources ( ) . getDimensionPixelSize ( resourceId ) ; view . setPadding ( 0 , height , 0 , 0 ) ; } } } @ Override public void onViewDetachedFromWindow ( View view ) { view . removeOnAttachStateChangeListener ( this ) ; } } ) ; }
Applies the window insets to the view.
Applies the window insets to the view .