Java Code Examples for android.support.v4.view.ViewCompat#dispatchApplyWindowInsets()

The following examples show how to use android.support.v4.view.ViewCompat#dispatchApplyWindowInsets() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BottomSheetInsetsBehavior.java    From BottomSheetCoordinatorLayout with Apache License 2.0 5 votes vote down vote up
@NonNull
@Override
public WindowInsetsCompat onApplyWindowInsets(CoordinatorLayout coordinatorLayout, V child, WindowInsetsCompat insets) {
    // Steal the inset and dispatch to view.
    ViewCompat.dispatchApplyWindowInsets(child, insets);
    // Pass unconsumed insets.
    return super.onApplyWindowInsets(coordinatorLayout, child, insets);
}
 
Example 2
Source File: InsetsPercentRelativeLayout.java    From Music-Player with Apache License 2.0 5 votes vote down vote up
private void setWindowInsets(WindowInsetsCompat insets) {
    // Now dispatch them to our children
    for (int i = 0, z = getChildCount(); i < z; i++) {
        final View child = getChildAt(i);
        insets = ViewCompat.dispatchApplyWindowInsets(child, insets);
        if (insets.isConsumed()) {
            break;
        }
    }
}
 
Example 3
Source File: AppBarLayout.java    From ticdesign with Apache License 2.0 5 votes vote down vote up
private void setWindowInsets(WindowInsetsCompat insets) {
    // Invalidate the total scroll range...
    mTotalScrollRange = INVALID_SCROLL_RANGE;
    mLastInsets = insets;

    // Now dispatch them to our children
    for (int i = 0, z = getChildCount(); i < z; i++) {
        final View child = getChildAt(i);
        insets = ViewCompat.dispatchApplyWindowInsets(child, insets);
        if (insets.isConsumed()) {
            break;
        }
    }
}
 
Example 4
Source File: CoordinatorLayout.java    From ticdesign with Apache License 2.0 5 votes vote down vote up
private void dispatchChildApplyWindowInsets(WindowInsetsCompat insets) {
    if (insets.isConsumed()) {
        return;
    }

    for (int i = 0, z = getChildCount(); i < z; i++) {
        final View child = getChildAt(i);
        if (ViewCompat.getFitsSystemWindows(child)) {
            final LayoutParams lp = (LayoutParams) child.getLayoutParams();
            final Behavior b = lp.getBehavior();

            if (b != null) {
                // If the view has a behavior, let it try first
                insets = b.onApplyWindowInsets(this, child, insets);
                if (insets.isConsumed()) {
                    // If it consumed the insets, break
                    break;
                }
            }

            // Now let the view try and consume them
            insets = ViewCompat.dispatchApplyWindowInsets(child, insets);
            if (insets.isConsumed()) {
                break;
            }
        }
    }
}