Example usage for android.support.v4.view WindowInsetsCompat replaceSystemWindowInsets

List of usage examples for android.support.v4.view WindowInsetsCompat replaceSystemWindowInsets

Introduction

In this page you can find the example usage for android.support.v4.view WindowInsetsCompat replaceSystemWindowInsets.

Prototype

public WindowInsetsCompat replaceSystemWindowInsets(Rect rect) 

Source Link

Usage

From source file:ooo.oxo.apps.earth.widget.WindowInsetsFrameLayout.java

@TargetApi(21)
private boolean applySystemWindowInsets21(WindowInsetsCompat insets) {
    boolean consumed = false;

    for (int i = 0; i < getChildCount(); i++) {
        View child = getChildAt(i);

        if (!child.getFitsSystemWindows()) {
            continue;
        }//  w  w w  .ja  v a 2 s  .c  o m

        Rect childInsets = new Rect(insets.getSystemWindowInsetLeft(), insets.getSystemWindowInsetTop(),
                insets.getSystemWindowInsetRight(), insets.getSystemWindowInsetBottom());

        computeInsetsWithGravity(child, childInsets);

        ViewCompat.dispatchApplyWindowInsets(child, insets.replaceSystemWindowInsets(childInsets));

        consumed = true;
    }

    return consumed;
}