List of usage examples for android.support.v4.view WindowInsetsCompat hasSystemWindowInsets
public boolean hasSystemWindowInsets()
From source file:android.support.design.testapp.custom.NavigationTestView.java
@Override protected void onInsetsChanged(WindowInsetsCompat insets) { super.onInsetsChanged(insets); hasSystemWindowInsets = insets.hasSystemWindowInsets(); }
From source file:android.support.design.widget.NavigationTestView.java
@Override protected void onInsetsChanged(WindowInsetsCompat insets) { super.onInsetsChanged(insets); mHashSystemWindowInsets = insets.hasSystemWindowInsets(); }
From source file:android.support.design.internal.ScrimInsetsFrameLayout.java
public ScrimInsetsFrameLayout(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.ScrimInsetsFrameLayout, defStyleAttr, R.style.Widget_Design_ScrimInsetsFrameLayout); mInsetForeground = a.getDrawable(R.styleable.ScrimInsetsFrameLayout_insetForeground); a.recycle();/* ww w . j a v a 2s .c o m*/ setWillNotDraw(true); // No need to draw until the insets are adjusted ViewCompat.setOnApplyWindowInsetsListener(this, new android.support.v4.view.OnApplyWindowInsetsListener() { @Override public WindowInsetsCompat onApplyWindowInsets(View v, WindowInsetsCompat insets) { if (null == mInsets) { mInsets = new Rect(); } mInsets.set(insets.getSystemWindowInsetLeft(), insets.getSystemWindowInsetTop(), insets.getSystemWindowInsetRight(), insets.getSystemWindowInsetBottom()); onInsetsChanged(insets); setWillNotDraw(!insets.hasSystemWindowInsets() || mInsetForeground == null); ViewCompat.postInvalidateOnAnimation(ScrimInsetsFrameLayout.this); return insets.consumeSystemWindowInsets(); } }); }
From source file:com.ericyl.utils.ui.widget.translucent.ScrimInsetsFrameLayout.java
public ScrimInsetsFrameLayout(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); final TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.MineScrimInsetsFrameLayout, defStyleAttr, R.style.defaultStyle_ScrimInsetsFrameLayout); mInsetForeground = a.getDrawable(R.styleable.MineScrimInsetsFrameLayout_insetForeground); a.recycle();/*from w w w . j a v a 2 s. co m*/ setWillNotDraw(true); // No need to draw until the insets are adjusted ViewCompat.setOnApplyWindowInsetsListener(this, new android.support.v4.view.OnApplyWindowInsetsListener() { @Override public WindowInsetsCompat onApplyWindowInsets(View v, WindowInsetsCompat insets) { if (null == mInsets) { mInsets = new Rect(); } mInsets.set(insets.getSystemWindowInsetLeft(), insets.getSystemWindowInsetTop(), insets.getSystemWindowInsetRight(), insets.getSystemWindowInsetBottom()); onInsetsChanged(insets); setWillNotDraw(!insets.hasSystemWindowInsets() || mInsetForeground == null); ViewCompat.postInvalidateOnAnimation(ScrimInsetsFrameLayout.this); return insets.consumeSystemWindowInsets(); } }); }
From source file:de.mrapp.android.dialog.decorator.MaterialDialogDecorator.java
/** * Creates and returns a listener, which allows to observe when window insets are applied to the * root view of the view hierarchy, which is modified by the decorator. * * @return The listener, which has been created, as an instance of the type {@link * OnApplyWindowInsetsListener}/*from w w w .j av a 2s . c om*/ */ private OnApplyWindowInsetsListener createWindowInsetsListener() { return new OnApplyWindowInsetsListener() { @Override public WindowInsetsCompat onApplyWindowInsets(final View v, final WindowInsetsCompat insets) { windowInsets = insets.hasSystemWindowInsets() ? new Rect(insets.getSystemWindowInsetLeft(), insets.getSystemWindowInsetTop(), insets.getSystemWindowInsetRight(), insets.getSystemWindowInsetBottom()) : null; adaptLayoutParams(); return insets; } }; }