Example usage for android.view View getFitsSystemWindows

List of usage examples for android.view View getFitsSystemWindows

Introduction

In this page you can find the example usage for android.view View getFitsSystemWindows.

Prototype

@ViewDebug.ExportedProperty
public boolean getFitsSystemWindows() 

Source Link

Document

Check for state of #setFitsSystemWindows(boolean) .

Usage

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

@TargetApi(19)
private boolean applySystemWindowInsets19(Rect insets) {
    boolean consumed = false;

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

        if (!child.getFitsSystemWindows()) {
            continue;
        }/*from   www .j av  a2 s . c  o m*/

        Rect childInsets = new Rect(insets);

        computeInsetsWithGravity(child, childInsets);

        child.setPadding(childInsets.left, childInsets.top, childInsets.right, childInsets.bottom);

        consumed = true;
    }

    return consumed;
}

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  ww .  ja  v  a 2  s  . com*/

        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;
}